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
Showing
6 changed files
with
138 additions
and
27 deletions
@@ -98,6 +98,8 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | @@ -98,6 +98,8 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | ||
98 | GrassArticle article = new GrassArticle(); | 98 | GrassArticle article = new GrassArticle(); |
99 | article.setAuthorUid(req.getAuthorUid()); | 99 | article.setAuthorUid(req.getAuthorUid()); |
100 | article.setCreateTime(now); | 100 | article.setCreateTime(now); |
101 | + article.setAuthStatus(1); | ||
102 | + article.setAuthTime(System.currentTimeMillis()); | ||
101 | try{ | 103 | try{ |
102 | grassArticleDao.insertArticleSeletive(article); | 104 | grassArticleDao.insertArticleSeletive(article); |
103 | logger.info("insert grass article success, uid is {}, ariticle id is {}", article.getAuthorUid(), article.getId()); | 105 | logger.info("insert grass article success, uid is {}, ariticle id is {}", article.getAuthorUid(), article.getId()); |
@@ -301,12 +303,21 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | @@ -301,12 +303,21 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | ||
301 | GrassArticle grassArticle = new GrassArticle(); | 303 | GrassArticle grassArticle = new GrassArticle(); |
302 | grassArticle.setId(req.getArticleId()); | 304 | grassArticle.setId(req.getArticleId()); |
303 | if(isRecommend !=null){ | 305 | if(isRecommend !=null){ |
306 | + if(isRecommend == 0){ | ||
307 | + grassArticle.setIsTop(0); | ||
308 | + grassArticle.setTopTime(0L); | ||
309 | + } | ||
304 | grassArticle.setIsRecommend(isRecommend); | 310 | grassArticle.setIsRecommend(isRecommend); |
305 | grassArticle.setRecommendTime(System.currentTimeMillis()); | 311 | grassArticle.setRecommendTime(System.currentTimeMillis()); |
306 | } | 312 | } |
307 | if(isTop !=null){ | 313 | if(isTop !=null){ |
308 | grassArticle.setIsTop(isTop); | 314 | grassArticle.setIsTop(isTop); |
309 | - grassArticle.setTopTime(System.currentTimeMillis()); | 315 | + if(isTop == 1){ |
316 | + grassArticle.setTopTime(System.currentTimeMillis()); | ||
317 | + } | ||
318 | + if(isTop == 0){ | ||
319 | + grassArticle.setTopTime(0L); | ||
320 | + } | ||
310 | } | 321 | } |
311 | grassArticleDao.updateByPrimaryKeySelective(grassArticle); | 322 | grassArticleDao.updateByPrimaryKeySelective(grassArticle); |
312 | } | 323 | } |
@@ -547,10 +558,10 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | @@ -547,10 +558,10 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | ||
547 | logger.info("publishCheck images is null"); | 558 | logger.info("publishCheck images is null"); |
548 | throw new PlatformException("publish images is null", 403); | 559 | throw new PlatformException("publish images is null", 403); |
549 | } | 560 | } |
550 | - if(StringUtils.isEmpty(req.getContent())){ | ||
551 | - logger.info("publishCheck content is null"); | ||
552 | - throw new PlatformException("publish content is null", 403); | ||
553 | - } | 561 | +// if(StringUtils.isEmpty(req.getContent())){ |
562 | +// logger.info("publishCheck content is null"); | ||
563 | +// throw new PlatformException("publish content is null", 403); | ||
564 | +// } | ||
554 | 565 | ||
555 | } | 566 | } |
556 | } | 567 | } |
1 | package com.yohobuy.platform.operations.service.impl; | 1 | package com.yohobuy.platform.operations.service.impl; |
2 | 2 | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
3 | import com.google.common.collect.Lists; | 4 | import com.google.common.collect.Lists; |
5 | +import com.yoho.core.rabbitmq.YhProducer; | ||
4 | import com.yoho.core.rest.client.ServiceCaller; | 6 | import com.yoho.core.rest.client.ServiceCaller; |
5 | import com.yoho.message.sdk.utils.DateUtils; | 7 | import com.yoho.message.sdk.utils.DateUtils; |
6 | import com.yohobuy.platform.common.util.DateUtil; | 8 | import com.yohobuy.platform.common.util.DateUtil; |
@@ -27,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -27,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
27 | import org.springframework.beans.factory.annotation.Value; | 29 | import org.springframework.beans.factory.annotation.Value; |
28 | import org.springframework.stereotype.Service; | 30 | import org.springframework.stereotype.Service; |
29 | 31 | ||
32 | +import javax.annotation.Resource; | ||
30 | import java.text.SimpleDateFormat; | 33 | import java.text.SimpleDateFormat; |
31 | import java.util.*; | 34 | import java.util.*; |
32 | 35 | ||
@@ -53,6 +56,11 @@ public class RedpacketConfigServiceImpl implements IRedpacketConfigService { | @@ -53,6 +56,11 @@ public class RedpacketConfigServiceImpl implements IRedpacketConfigService { | ||
53 | @Value("${api.yoho.url:http://api.yoho.cn}") | 56 | @Value("${api.yoho.url:http://api.yoho.cn}") |
54 | private String apiUrl; | 57 | private String apiUrl; |
55 | 58 | ||
59 | + @Resource(name = "producerCommon") | ||
60 | + private YhProducer yhProducerCommon; | ||
61 | + | ||
62 | + public static final String TOPIC_CLEAR_RED_PACKET_RULE = "clear.redPacketRule"; | ||
63 | + | ||
56 | 64 | ||
57 | private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 65 | private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
58 | 66 | ||
@@ -78,7 +86,7 @@ public class RedpacketConfigServiceImpl implements IRedpacketConfigService { | @@ -78,7 +86,7 @@ public class RedpacketConfigServiceImpl implements IRedpacketConfigService { | ||
78 | 86 | ||
79 | HtmlContent htmlContent = iHtmlContentDao.selectOneByNodeCode(RED_PACKAET_NODE_CODE); | 87 | HtmlContent htmlContent = iHtmlContentDao.selectOneByNodeCode(RED_PACKAET_NODE_CODE); |
80 | if (htmlContent != null && StringUtils.isNotBlank(htmlContent.getInuseContent())){ | 88 | if (htmlContent != null && StringUtils.isNotBlank(htmlContent.getInuseContent())){ |
81 | - redPacketRuleBo.setMyRedpacketQuestion(htmlContent.getInuseContent()); | 89 | + redPacketRuleBo.setMyRedpacketQuestion(htmlContent.getInuseContent().replace("<br/>","\n")); |
82 | } | 90 | } |
83 | 91 | ||
84 | return redPacketRuleBo; | 92 | return redPacketRuleBo; |
@@ -154,13 +162,21 @@ public class RedpacketConfigServiceImpl implements IRedpacketConfigService { | @@ -154,13 +162,21 @@ public class RedpacketConfigServiceImpl implements IRedpacketConfigService { | ||
154 | 162 | ||
155 | 163 | ||
156 | // 更新红包规则中的-我的红包中的问号介绍 | 164 | // 更新红包规则中的-我的红包中的问号介绍 |
165 | + // 将后台传过来的字符串中\n替换成<br/> | ||
166 | + String myRepacketQuestion = redPacketRuleBo.getMyRedpacketQuestion(); | ||
167 | + myRepacketQuestion = myRepacketQuestion.replaceAll("\n","<br/>"); | ||
168 | + logger.info("myRepacketQuestion change before {}, after {}", redPacketRuleBo.getMyRedpacketQuestion(), myRepacketQuestion); | ||
157 | HtmlContent htmlContent = iHtmlContentDao.selectOneByNodeCode(RED_PACKAET_NODE_CODE); | 169 | HtmlContent htmlContent = iHtmlContentDao.selectOneByNodeCode(RED_PACKAET_NODE_CODE); |
158 | // 不考虑不存在的情况 | 170 | // 不考虑不存在的情况 |
159 | if (htmlContent != null){ | 171 | if (htmlContent != null){ |
160 | - htmlContent.setInuseContent(redPacketRuleBo.getMyRedpacketQuestion()); | 172 | + htmlContent.setInuseContent(myRepacketQuestion); |
161 | iHtmlContentDao.updateInuseContent(htmlContent); | 173 | iHtmlContentDao.updateInuseContent(htmlContent); |
174 | + | ||
162 | } | 175 | } |
163 | 176 | ||
177 | + JSONObject jsonObject = new JSONObject(); | ||
178 | + jsonObject.put("nodeCode", RED_PACKAET_NODE_CODE); | ||
179 | + yhProducerCommon.send(TOPIC_CLEAR_RED_PACKET_RULE, jsonObject); | ||
164 | 180 | ||
165 | } | 181 | } |
166 | 182 |
@@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
5 | <title>Yoho!Buy运营平台</title> | 5 | <title>Yoho!Buy运营平台</title> |
6 | <script src="/pfcms/js/include.js"></script> | 6 | <script src="/pfcms/js/include.js"></script> |
7 | <script src="/pfcms/js/ajaxfileupload.js"></script> | 7 | <script src="/pfcms/js/ajaxfileupload.js"></script> |
8 | + <script src="/pfcms/js/jquery.imageUpload.js"></script> | ||
8 | <style> | 9 | <style> |
9 | .btn-long { | 10 | .btn-long { |
10 | width: 120px; | 11 | width: 120px; |
@@ -155,7 +156,7 @@ | @@ -155,7 +156,7 @@ | ||
155 | return defaultLoadFilter(data); | 156 | return defaultLoadFilter(data); |
156 | } | 157 | } |
157 | }); | 158 | }); |
158 | - initimg(); | 159 | + |
159 | 160 | ||
160 | $("#subBotton").linkbutton({ | 161 | $("#subBotton").linkbutton({ |
161 | iconCls: "icon-save", | 162 | iconCls: "icon-save", |
@@ -173,6 +174,7 @@ | @@ -173,6 +174,7 @@ | ||
173 | return false; | 174 | return false; |
174 | } | 175 | } |
175 | var imgs = ''; | 176 | var imgs = ''; |
177 | + var imageCount = 0; | ||
176 | $("input[name='url']").each(function(j,item){ | 178 | $("input[name='url']").each(function(j,item){ |
177 | debugger | 179 | debugger |
178 | var url = item.value; | 180 | var url = item.value; |
@@ -181,8 +183,13 @@ | @@ -181,8 +183,13 @@ | ||
181 | }else{ | 183 | }else{ |
182 | imgs = imgs + ","+url; | 184 | imgs = imgs + ","+url; |
183 | } | 185 | } |
186 | + imageCount++; | ||
184 | }); | 187 | }); |
185 | $("#imgs").val(imgs); | 188 | $("#imgs").val(imgs); |
189 | + if(imageCount > 9){ | ||
190 | + $.messager.alert("保存失败", "最多只能选择9张图片", "error"); | ||
191 | + return false; | ||
192 | + } | ||
186 | var labels = ''; | 193 | var labels = ''; |
187 | $("input[name='labelId']").each(function(j,item){ | 194 | $("input[name='labelId']").each(function(j,item){ |
188 | debugger | 195 | debugger |
@@ -200,9 +207,9 @@ | @@ -200,9 +207,9 @@ | ||
200 | if (data) { | 207 | if (data) { |
201 | data = $.parseJSON(data); | 208 | data = $.parseJSON(data); |
202 | if (data.code == 200) { | 209 | if (data.code == 200) { |
203 | - // $.messager.alert("保存成功","保存成功", "success"); | ||
204 | - alert("保存成功"); | ||
205 | - window.location.reload(); | 210 | + $.messager.alert("提示","保存成功", "info", function(){window.location.reload()}); |
211 | + // alert("保存成功"); | ||
212 | + | ||
206 | 213 | ||
207 | } else { | 214 | } else { |
208 | $.messager.alert("保存失败", data.message, "error"); | 215 | $.messager.alert("保存失败", data.message, "error"); |
@@ -215,6 +222,47 @@ | @@ -215,6 +222,47 @@ | ||
215 | 222 | ||
216 | } | 223 | } |
217 | }); | 224 | }); |
225 | + | ||
226 | + | ||
227 | + $("#imageUpload1").imageUpload({ | ||
228 | + width: 171, | ||
229 | + height: 120, | ||
230 | + realInputName: "url", | ||
231 | + uploadInputName: "files", | ||
232 | + url: serverContextPath + '/fileupload/uploads', | ||
233 | + queryParams: { | ||
234 | + bucket: "grassImg" | ||
235 | + }, | ||
236 | + onBeforeSubmit: function () { | ||
237 | + $.messager.progress({ | ||
238 | + title: "正在执行", | ||
239 | + msg: "正在执行,请稍后...", | ||
240 | + interval: 500, | ||
241 | + text: "" | ||
242 | + }); | ||
243 | + }, | ||
244 | + filterFileName: function (data) { | ||
245 | + debugger; | ||
246 | + if (!data || data.code != 200) { | ||
247 | + $.messager.progress("close"); | ||
248 | + $.messager.alert("错误",data.message); | ||
249 | + return ""; | ||
250 | + } | ||
251 | + return data.data[0]; | ||
252 | + }, | ||
253 | + onLoadSuccess: function (data) { | ||
254 | + debugger; | ||
255 | + initimg(1,data.data.length); | ||
256 | + for (var i= 1; i<= data.data.length; i++){ | ||
257 | + $("#imageUpload"+i).imageUpload("setValue",data.data[i-1]) | ||
258 | + } | ||
259 | + $.messager.progress("close"); | ||
260 | + return false; | ||
261 | + }, | ||
262 | + onClose:function(data){ | ||
263 | + $("#imageUpload1").remove(); | ||
264 | + } | ||
265 | + }); | ||
218 | }); | 266 | }); |
219 | 267 | ||
220 | 268 | ||
@@ -272,14 +320,29 @@ | @@ -272,14 +320,29 @@ | ||
272 | 320 | ||
273 | function oo(num){ | 321 | function oo(num){ |
274 | // debugger | 322 | // debugger |
275 | - if(num >9){ | ||
276 | - return | 323 | + // if(num >9){ |
324 | + // return | ||
325 | + // } | ||
326 | + var imageCount = 0; | ||
327 | + $("input[name='url']").each(function(j,item){ | ||
328 | + debugger | ||
329 | + var url = item.value; | ||
330 | + if(imgs == ''){ | ||
331 | + imgs = url; | ||
332 | + }else{ | ||
333 | + imgs = imgs + ","+url; | ||
334 | + } | ||
335 | + imageCount++; | ||
336 | + }); | ||
337 | + if(imageCount > 9 ){ | ||
338 | + return; | ||
277 | } | 339 | } |
278 | $("#imageUpload"+num).imageUpload({ | 340 | $("#imageUpload"+num).imageUpload({ |
279 | width: 171, | 341 | width: 171, |
280 | height: 120, | 342 | height: 120, |
281 | realInputName: "url", | 343 | realInputName: "url", |
282 | - url: serverContextPath + '/fileupload/uploadFile', | 344 | + uploadInputName: "files", |
345 | + url: serverContextPath + '/fileupload/uploads', | ||
283 | queryParams: { | 346 | queryParams: { |
284 | bucket: "grassImg" | 347 | bucket: "grassImg" |
285 | }, | 348 | }, |
@@ -298,21 +361,35 @@ | @@ -298,21 +361,35 @@ | ||
298 | $.messager.alert("错误",data.message); | 361 | $.messager.alert("错误",data.message); |
299 | return ""; | 362 | return ""; |
300 | } | 363 | } |
301 | - return data.data.url; | 364 | + return data.data[0]; |
302 | }, | 365 | }, |
303 | onLoadSuccess: function (data) { | 366 | onLoadSuccess: function (data) { |
304 | debugger; | 367 | debugger; |
368 | + initimg(num,data.data.length); | ||
369 | + var c =0; | ||
370 | + for (var i= 0; i<= data.data.length; i++){ | ||
371 | + nnum = num +i; | ||
372 | + $("#imageUpload"+nnum).imageUpload("setValue",data.data[c]); | ||
373 | + c++; | ||
374 | + } | ||
305 | $.messager.progress("close"); | 375 | $.messager.progress("close"); |
306 | return false; | 376 | return false; |
377 | + }, | ||
378 | + onClose:function(data){ | ||
379 | + $("#imageUpload"+num).remove(); | ||
307 | } | 380 | } |
308 | }); | 381 | }); |
309 | } | 382 | } |
310 | - function initimg() { | ||
311 | - for (var i =1 ; i<=9; i++){ | ||
312 | - var nnum = i+1; | ||
313 | - $("#imageUpload"+i).after('<div id="imageUpload'+nnum+'"> </div>'); | 383 | + |
384 | + | ||
385 | + | ||
386 | + function initimg(m,n) { | ||
387 | + for (var i =1 ; i<=n; i++){ | ||
388 | + debugger | ||
389 | + var nnum = m+i; | ||
390 | + $("#imageUpload"+(nnum-1)).after('<div id="imageUpload'+nnum+'"> </div>'); | ||
314 | count = count+1; | 391 | count = count+1; |
315 | - oo(i); | 392 | + oo(nnum); |
316 | } | 393 | } |
317 | } | 394 | } |
318 | 395 |
@@ -67,7 +67,7 @@ | @@ -67,7 +67,7 @@ | ||
67 | $(function() { | 67 | $(function() { |
68 | //用于页面刷新后的数据行定位 | 68 | //用于页面刷新后的数据行定位 |
69 | var index =""; | 69 | var index =""; |
70 | - | 70 | + |
71 | $("#allBtn").linkbutton({ | 71 | $("#allBtn").linkbutton({ |
72 | iconCls : "icon-search", | 72 | iconCls : "icon-search", |
73 | onClick : function() { | 73 | onClick : function() { |
@@ -178,10 +178,12 @@ | @@ -178,10 +178,12 @@ | ||
178 | var imgList = rowData.imgList; | 178 | var imgList = rowData.imgList; |
179 | str =str + '<p>'; | 179 | str =str + '<p>'; |
180 | for (var i=0; i<imgList.length; i++) { | 180 | for (var i=0; i<imgList.length; i++) { |
181 | + | ||
181 | if(i > 0 && i % 4 == 0){ | 182 | if(i > 0 && i % 4 == 0){ |
182 | str = str + "</br>";//每四张换行 | 183 | str = str + "</br>";//每四张换行 |
183 | } | 184 | } |
184 | str = str + ' <img style="width: 60px; height: 60px" src="'+ imgList[i]+'" onclick="bigImage(this);>'; | 185 | str = str + ' <img style="width: 60px; height: 60px" src="'+ imgList[i]+'" onclick="bigImage(this);>'; |
186 | + | ||
185 | } | 187 | } |
186 | str =str + '</p>'; | 188 | str =str + '</p>'; |
187 | var labelList = rowData.labelList; | 189 | var labelList = rowData.labelList; |
@@ -314,11 +316,14 @@ | @@ -314,11 +316,14 @@ | ||
314 | var optStr = rowData.isRecommend == 1 ? "取消推荐</a>" : "推荐</a>"; | 316 | var optStr = rowData.isRecommend == 1 ? "取消推荐</a>" : "推荐</a>"; |
315 | str += optStr; | 317 | str += optStr; |
316 | 318 | ||
317 | - str += "<a role='switchT'" | ||
318 | - var classStr = rowData.isTop == 1 ? "class='btn-danger'" : "class='btn-success'"; | ||
319 | - str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex +"' status='" + rowData.isTop + "' style='margin-left:10px'>"; | ||
320 | - var optStr = rowData.isTop == 1 ? "取消置顶</a>" : "置顶</a>"; | ||
321 | - str += optStr; | 319 | + if(rowData.isRecommend == 1){ |
320 | + str += "<a role='switchT'" | ||
321 | + var classStr = rowData.isTop == 1 ? "class='btn-danger'" : "class='btn-success'"; | ||
322 | + str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex +"' status='" + rowData.isTop + "' style='margin-left:10px'>"; | ||
323 | + var optStr = rowData.isTop == 1 ? "取消置顶</a>" : "置顶</a>"; | ||
324 | + str += optStr; | ||
325 | + } | ||
326 | + | ||
322 | } | 327 | } |
323 | if(rowData.authStatus == 0){ | 328 | if(rowData.authStatus == 0){ |
324 | str += "待审核" | 329 | str += "待审核" |
@@ -342,6 +347,8 @@ | @@ -342,6 +347,8 @@ | ||
342 | if(index != ""){ | 347 | if(index != ""){ |
343 | $(this).datagrid("scrollTo",index); | 348 | $(this).datagrid("scrollTo",index); |
344 | index = ""; | 349 | index = ""; |
350 | + }else{ | ||
351 | + $(this).datagrid("scrollTo",1); | ||
345 | } | 352 | } |
346 | 353 | ||
347 | $(this).datagrid("getPanel").find("a[role='switchR']").linkbutton({ | 354 | $(this).datagrid("getPanel").find("a[role='switchR']").linkbutton({ |
@@ -279,7 +279,7 @@ | @@ -279,7 +279,7 @@ | ||
279 | "line-height" : opt.text ? (opt.height * 0.8) + "px" : opt.height + "px" | 279 | "line-height" : opt.text ? (opt.height * 0.8) + "px" : opt.height + "px" |
280 | }).html("+")); | 280 | }).html("+")); |
281 | 281 | ||
282 | - var ifile = $("<input type='"+ (opt.readonly === true ? "text" : "file") +"'>").attr({ | 282 | + var ifile = $("<input type='"+ (opt.readonly === true ? "text" : "file") +"' multiple>").attr({ |
283 | name : opt.uploadInputName, | 283 | name : opt.uploadInputName, |
284 | id : opt.uploadInputName | 284 | id : opt.uploadInputName |
285 | }); | 285 | }); |
-
Please register or login to post a comment