Authored by mlge

Merge branch 'test6.8.6' of http://git.yoho.cn/platform/platform-cms into test6.8.6

# Conflicts:
#	web/src/main/webapp/html/grass/articleManage/articleList.html
... ... @@ -98,6 +98,8 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
GrassArticle article = new GrassArticle();
article.setAuthorUid(req.getAuthorUid());
article.setCreateTime(now);
article.setAuthStatus(1);
article.setAuthTime(System.currentTimeMillis());
try{
grassArticleDao.insertArticleSeletive(article);
logger.info("insert grass article success, uid is {}, ariticle id is {}", article.getAuthorUid(), article.getId());
... ... @@ -301,12 +303,21 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
GrassArticle grassArticle = new GrassArticle();
grassArticle.setId(req.getArticleId());
if(isRecommend !=null){
if(isRecommend == 0){
grassArticle.setIsTop(0);
grassArticle.setTopTime(0L);
}
grassArticle.setIsRecommend(isRecommend);
grassArticle.setRecommendTime(System.currentTimeMillis());
}
if(isTop !=null){
grassArticle.setIsTop(isTop);
grassArticle.setTopTime(System.currentTimeMillis());
if(isTop == 1){
grassArticle.setTopTime(System.currentTimeMillis());
}
if(isTop == 0){
grassArticle.setTopTime(0L);
}
}
grassArticleDao.updateByPrimaryKeySelective(grassArticle);
}
... ... @@ -547,10 +558,10 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
logger.info("publishCheck images is null");
throw new PlatformException("publish images is null", 403);
}
if(StringUtils.isEmpty(req.getContent())){
logger.info("publishCheck content is null");
throw new PlatformException("publish content is null", 403);
}
// if(StringUtils.isEmpty(req.getContent())){
// logger.info("publishCheck content is null");
// throw new PlatformException("publish content is null", 403);
// }
}
}
... ...
package com.yohobuy.platform.operations.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.yoho.core.rabbitmq.YhProducer;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.message.sdk.utils.DateUtils;
import com.yohobuy.platform.common.util.DateUtil;
... ... @@ -27,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
... ... @@ -53,6 +56,11 @@ public class RedpacketConfigServiceImpl implements IRedpacketConfigService {
@Value("${api.yoho.url:http://api.yoho.cn}")
private String apiUrl;
@Resource(name = "producerCommon")
private YhProducer yhProducerCommon;
public static final String TOPIC_CLEAR_RED_PACKET_RULE = "clear.redPacketRule";
private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
... ... @@ -78,7 +86,7 @@ public class RedpacketConfigServiceImpl implements IRedpacketConfigService {
HtmlContent htmlContent = iHtmlContentDao.selectOneByNodeCode(RED_PACKAET_NODE_CODE);
if (htmlContent != null && StringUtils.isNotBlank(htmlContent.getInuseContent())){
redPacketRuleBo.setMyRedpacketQuestion(htmlContent.getInuseContent());
redPacketRuleBo.setMyRedpacketQuestion(htmlContent.getInuseContent().replace("<br/>","\n"));
}
return redPacketRuleBo;
... ... @@ -154,13 +162,21 @@ public class RedpacketConfigServiceImpl implements IRedpacketConfigService {
// 更新红包规则中的-我的红包中的问号介绍
// 将后台传过来的字符串中\n替换成<br/>
String myRepacketQuestion = redPacketRuleBo.getMyRedpacketQuestion();
myRepacketQuestion = myRepacketQuestion.replaceAll("\n","<br/>");
logger.info("myRepacketQuestion change before {}, after {}", redPacketRuleBo.getMyRedpacketQuestion(), myRepacketQuestion);
HtmlContent htmlContent = iHtmlContentDao.selectOneByNodeCode(RED_PACKAET_NODE_CODE);
// 不考虑不存在的情况
if (htmlContent != null){
htmlContent.setInuseContent(redPacketRuleBo.getMyRedpacketQuestion());
htmlContent.setInuseContent(myRepacketQuestion);
iHtmlContentDao.updateInuseContent(htmlContent);
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("nodeCode", RED_PACKAET_NODE_CODE);
yhProducerCommon.send(TOPIC_CLEAR_RED_PACKET_RULE, jsonObject);
}
... ...
... ... @@ -5,6 +5,7 @@
<title>Yoho!Buy运营平台</title>
<script src="/pfcms/js/include.js"></script>
<script src="/pfcms/js/ajaxfileupload.js"></script>
<script src="/pfcms/js/jquery.imageUpload.js"></script>
<style>
.btn-long {
width: 120px;
... ... @@ -155,7 +156,7 @@
return defaultLoadFilter(data);
}
});
initimg();
$("#subBotton").linkbutton({
iconCls: "icon-save",
... ... @@ -173,6 +174,7 @@
return false;
}
var imgs = '';
var imageCount = 0;
$("input[name='url']").each(function(j,item){
debugger
var url = item.value;
... ... @@ -181,8 +183,13 @@
}else{
imgs = imgs + ","+url;
}
imageCount++;
});
$("#imgs").val(imgs);
if(imageCount > 9){
$.messager.alert("保存失败", "最多只能选择9张图片", "error");
return false;
}
var labels = '';
$("input[name='labelId']").each(function(j,item){
debugger
... ... @@ -200,9 +207,9 @@
if (data) {
data = $.parseJSON(data);
if (data.code == 200) {
// $.messager.alert("保存成功","保存成功", "success");
alert("保存成功");
window.location.reload();
$.messager.alert("提示","保存成功", "info", function(){window.location.reload()});
// alert("保存成功");
} else {
$.messager.alert("保存失败", data.message, "error");
... ... @@ -215,6 +222,47 @@
}
});
$("#imageUpload1").imageUpload({
width: 171,
height: 120,
realInputName: "url",
uploadInputName: "files",
url: serverContextPath + '/fileupload/uploads',
queryParams: {
bucket: "grassImg"
},
onBeforeSubmit: function () {
$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后...",
interval: 500,
text: ""
});
},
filterFileName: function (data) {
debugger;
if (!data || data.code != 200) {
$.messager.progress("close");
$.messager.alert("错误",data.message);
return "";
}
return data.data[0];
},
onLoadSuccess: function (data) {
debugger;
initimg(1,data.data.length);
for (var i= 1; i<= data.data.length; i++){
$("#imageUpload"+i).imageUpload("setValue",data.data[i-1])
}
$.messager.progress("close");
return false;
},
onClose:function(data){
$("#imageUpload1").remove();
}
});
});
... ... @@ -272,14 +320,29 @@
function oo(num){
// debugger
if(num >9){
return
// if(num >9){
// return
// }
var imageCount = 0;
$("input[name='url']").each(function(j,item){
debugger
var url = item.value;
if(imgs == ''){
imgs = url;
}else{
imgs = imgs + ","+url;
}
imageCount++;
});
if(imageCount > 9 ){
return;
}
$("#imageUpload"+num).imageUpload({
width: 171,
height: 120,
realInputName: "url",
url: serverContextPath + '/fileupload/uploadFile',
uploadInputName: "files",
url: serverContextPath + '/fileupload/uploads',
queryParams: {
bucket: "grassImg"
},
... ... @@ -298,21 +361,35 @@
$.messager.alert("错误",data.message);
return "";
}
return data.data.url;
return data.data[0];
},
onLoadSuccess: function (data) {
debugger;
initimg(num,data.data.length);
var c =0;
for (var i= 0; i<= data.data.length; i++){
nnum = num +i;
$("#imageUpload"+nnum).imageUpload("setValue",data.data[c]);
c++;
}
$.messager.progress("close");
return false;
},
onClose:function(data){
$("#imageUpload"+num).remove();
}
});
}
function initimg() {
for (var i =1 ; i<=9; i++){
var nnum = i+1;
$("#imageUpload"+i).after('<div id="imageUpload'+nnum+'"> </div>');
function initimg(m,n) {
for (var i =1 ; i<=n; i++){
debugger
var nnum = m+i;
$("#imageUpload"+(nnum-1)).after('<div id="imageUpload'+nnum+'"> </div>');
count = count+1;
oo(i);
oo(nnum);
}
}
... ...
... ... @@ -67,7 +67,7 @@
$(function() {
//用于页面刷新后的数据行定位
var index ="";
$("#allBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
... ...
... ... @@ -178,10 +178,12 @@
var imgList = rowData.imgList;
str =str + '<p>';
for (var i=0; i<imgList.length; i++) {
if(i > 0 && i % 4 == 0){
str = str + "</br>";//每四张换行
}
str = str + ' <img style="width: 60px; height: 60px" src="'+ imgList[i]+'" onclick="bigImage(this);>';
}
str =str + '</p>';
var labelList = rowData.labelList;
... ... @@ -314,11 +316,14 @@
var optStr = rowData.isRecommend == 1 ? "取消推荐</a>" : "推荐</a>";
str += optStr;
str += "<a role='switchT'"
var classStr = rowData.isTop == 1 ? "class='btn-danger'" : "class='btn-success'";
str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex +"' status='" + rowData.isTop + "' style='margin-left:10px'>";
var optStr = rowData.isTop == 1 ? "取消置顶</a>" : "置顶</a>";
str += optStr;
if(rowData.isRecommend == 1){
str += "<a role='switchT'"
var classStr = rowData.isTop == 1 ? "class='btn-danger'" : "class='btn-success'";
str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex +"' status='" + rowData.isTop + "' style='margin-left:10px'>";
var optStr = rowData.isTop == 1 ? "取消置顶</a>" : "置顶</a>";
str += optStr;
}
}
if(rowData.authStatus == 0){
str += "待审核"
... ... @@ -342,6 +347,8 @@
if(index != ""){
$(this).datagrid("scrollTo",index);
index = "";
}else{
$(this).datagrid("scrollTo",1);
}
$(this).datagrid("getPanel").find("a[role='switchR']").linkbutton({
... ...
... ... @@ -279,7 +279,7 @@
"line-height" : opt.text ? (opt.height * 0.8) + "px" : opt.height + "px"
}).html("+"));
var ifile = $("<input type='"+ (opt.readonly === true ? "text" : "file") +"'>").attr({
var ifile = $("<input type='"+ (opt.readonly === true ? "text" : "file") +"' multiple>").attr({
name : opt.uploadInputName,
id : opt.uploadInputName
});
... ...