Commit cfa1ee3fb55ab72c3aa1ee510bd8693fe4d3b8e6

Authored by 周伟鹏
1 parent 1226c53e

update

src/main/java/com/cnlive/shenhe/api/CommentsControllerApi.java
@@ -42,6 +42,7 @@ public class CommentsControllerApi { @@ -42,6 +42,7 @@ public class CommentsControllerApi {
42 JSONObject json = JSONObject.parseObject(param); 42 JSONObject json = JSONObject.parseObject(param);
43 ShyComments shyComments = new ShyComments(); 43 ShyComments shyComments = new ShyComments();
44 ShySites shySites = new ShySites(); 44 ShySites shySites = new ShySites();
  45 + String callback = json.getString("callback");
45 shyComments.setState(CommonConst.AUDIT_INTT); 46 shyComments.setState(CommonConst.AUDIT_INTT);
46 //判断是否白名单 47 //判断是否白名单
47 shySites.setSpid(json.getInteger("spId")); 48 shySites.setSpid(json.getInteger("spId"));
@@ -61,7 +62,7 @@ public class CommentsControllerApi { @@ -61,7 +62,7 @@ public class CommentsControllerApi {
61 json1.put("msg", ""); 62 json1.put("msg", "");
62 JSONObject result = new JSONObject(); 63 JSONObject result = new JSONObject();
63 try{ 64 try{
64 - result = Pass.commentPass(json1); 65 + result = Pass.commentPass(json1,callback);
65 }catch (Exception e){ 66 }catch (Exception e){
66 return new ResponseBean(ErrorEnum.BACK_ERROR); 67 return new ResponseBean(ErrorEnum.BACK_ERROR);
67 } 68 }
@@ -88,7 +89,7 @@ public class CommentsControllerApi { @@ -88,7 +89,7 @@ public class CommentsControllerApi {
88 shyComments.setPlatform(json.getString("platform")); 89 shyComments.setPlatform(json.getString("platform"));
89 shyComments.setActivity_id(json.getString("activityId")); 90 shyComments.setActivity_id(json.getString("activityId"));
90 shyComments.setIs_hot(json.getBoolean("priority")); 91 shyComments.setIs_hot(json.getBoolean("priority"));
91 - shyComments.setCallback(json.getString("callback")); 92 + shyComments.setCallback(callback);
92 int i = commentsService.impotComments(shyComments); 93 int i = commentsService.impotComments(shyComments);
93 if (i > 0) { 94 if (i > 0) {
94 return new ResponseBean(ErrorEnum.SUCCESS); 95 return new ResponseBean(ErrorEnum.SUCCESS);
src/main/java/com/cnlive/shenhe/api/VideosControllerApi.java
@@ -49,6 +49,7 @@ public class VideosControllerApi { @@ -49,6 +49,7 @@ public class VideosControllerApi {
49 shySites.setSpid(json.getInteger("spId")); 49 shySites.setSpid(json.getInteger("spId"));
50 List<ShySites> shySitesList = videosService.getBusiness(shySites); 50 List<ShySites> shySitesList = videosService.getBusiness(shySites);
51 String videoId = json.getString("videoId"); 51 String videoId = json.getString("videoId");
  52 + String callback = json.getString("callback");
52 if (!shySitesList.isEmpty()) { 53 if (!shySitesList.isEmpty()) {
53 if (CommonUtils.isNotEmpty(shySitesList.get(0).getWrite_business())) { 54 if (CommonUtils.isNotEmpty(shySitesList.get(0).getWrite_business())) {
54 String write_business = shySitesList.get(0).getWrite_business(); 55 String write_business = shySitesList.get(0).getWrite_business();
@@ -58,7 +59,7 @@ public class VideosControllerApi { @@ -58,7 +59,7 @@ public class VideosControllerApi {
58 logger.info("白名单回调通过:videoId==="+videoId); 59 logger.info("白名单回调通过:videoId==="+videoId);
59 JSONObject result = new JSONObject(); 60 JSONObject result = new JSONObject();
60 try{ 61 try{
61 - result = Pass.auditPass(videoId, 3, "", ""); 62 + result = Pass.auditPass(videoId, 3, "", "",callback);
62 }catch (Exception e){ 63 }catch (Exception e){
63 return new ResponseBean(ErrorEnum.BACK_ERROR); 64 return new ResponseBean(ErrorEnum.BACK_ERROR);
64 } 65 }
@@ -83,7 +84,7 @@ public class VideosControllerApi { @@ -83,7 +84,7 @@ public class VideosControllerApi {
83 shyVideos.setVideo_desc(json.getString("videoIntro")); 84 shyVideos.setVideo_desc(json.getString("videoIntro"));
84 shyVideos.setVideo_keyword(json.getString("videoKeyword")); 85 shyVideos.setVideo_keyword(json.getString("videoKeyword"));
85 shyVideos.setVideo_priority(json.getString("priority")); 86 shyVideos.setVideo_priority(json.getString("priority"));
86 - shyVideos.setCallback(json.getString("callback")); 87 + shyVideos.setCallback(callback);
87 shyVideos.setSpid(Integer.parseInt(json.getString("spId"))); 88 shyVideos.setSpid(Integer.parseInt(json.getString("spId")));
88 int i = videosService.impotVideo(shyVideos); 89 int i = videosService.impotVideo(shyVideos);
89 if (i > 0) { 90 if (i > 0) {
src/main/java/com/cnlive/shenhe/controller/CommentsController.java
1 package com.cnlive.shenhe.controller; 1 package com.cnlive.shenhe.controller;
2 2
3 -import com.alibaba.fastjson.JSONObject;  
4 import com.cnlive.shenhe.bean.ErrorEnum; 3 import com.cnlive.shenhe.bean.ErrorEnum;
5 import com.cnlive.shenhe.bean.ResponseBean; 4 import com.cnlive.shenhe.bean.ResponseBean;
6 import com.cnlive.shenhe.bean.SessionUser; 5 import com.cnlive.shenhe.bean.SessionUser;
@@ -34,30 +33,6 @@ public class CommentsController { @@ -34,30 +33,6 @@ public class CommentsController {
34 UsersServiceImpl usersService; 33 UsersServiceImpl usersService;
35 34
36 /** 35 /**
37 - * 评论修改状态接口  
38 - *  
39 - * @param json  
40 - * @return  
41 - */  
42 - @PostMapping("/shenheComment")  
43 - @ResponseBody  
44 - public ResponseBean shenheInfo(@RequestBody JSONObject json, Integer id, HttpSession session) {  
45 - JSONObject result = Pass.commentPass(json);  
46 - Integer code = result.getInteger("errorCode");  
47 - if (code != 0) {  
48 - return new ResponseBean(code, result.getString("errorMessage"));  
49 - }  
50 - SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());  
51 - String userId = sessionUser.getUserId();  
52 - int i = commentsService.updateComment(json, id, userId);  
53 - if (i == 0) {  
54 - return new ResponseBean(ErrorEnum.ERROR);  
55 - } else {  
56 - return new ResponseBean(ErrorEnum.SUCCESS);  
57 - }  
58 - }  
59 -  
60 - /**  
61 * 评论列表页 36 * 评论列表页
62 * 37 *
63 * @param activity_id 38 * @param activity_id
src/main/java/com/cnlive/shenhe/controller/VideosController.java
@@ -15,6 +15,8 @@ import com.github.pagehelper.PageInfo; @@ -15,6 +15,8 @@ import com.github.pagehelper.PageInfo;
15 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
16 import org.springframework.stereotype.Controller; 16 import org.springframework.stereotype.Controller;
17 import org.springframework.ui.Model; 17 import org.springframework.ui.Model;
  18 +import org.springframework.web.bind.annotation.GetMapping;
  19 +import org.springframework.web.bind.annotation.PostMapping;
18 import org.springframework.web.bind.annotation.RequestMapping; 20 import org.springframework.web.bind.annotation.RequestMapping;
19 import org.springframework.web.bind.annotation.ResponseBody; 21 import org.springframework.web.bind.annotation.ResponseBody;
20 22
@@ -43,8 +45,6 @@ public class VideosController { @@ -43,8 +45,6 @@ public class VideosController {
43 user.put("company", shyUsers.getCompany_brief()); 45 user.put("company", shyUsers.getCompany_brief());
44 user.put("spid", shyUsers.getSp_id()); 46 user.put("spid", shyUsers.getSp_id());
45 model.addAttribute("user", user); 47 model.addAttribute("user", user);
46 -  
47 -  
48 return "page/video.html"; 48 return "page/video.html";
49 } 49 }
50 50
@@ -57,18 +57,18 @@ public class VideosController { @@ -57,18 +57,18 @@ public class VideosController {
57 * @param msg 备注信息 57 * @param msg 备注信息
58 * @return 58 * @return
59 */ 59 */
60 - @RequestMapping("/shenheVideo") 60 + @PostMapping("/shenheVideo")
61 @ResponseBody 61 @ResponseBody
62 - public ResponseBean shenheInfo(Integer id, String activity_id, Integer state, String attr_tags, String msg, HttpSession session) { 62 + public ResponseBean shenheInfo(Integer id, String activity_id, Integer state, String attr_tags, String msg, String callback, HttpSession session) {
63 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 63 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
64 String userId = sessionUser.getUserId(); 64 String userId = sessionUser.getUserId();
65 - JSONObject result = Pass.auditPass(activity_id, state, attr_tags, msg); 65 + JSONObject result = Pass.auditPass(activity_id, state, attr_tags, msg, callback);
66 Integer code = result.getInteger("code"); 66 Integer code = result.getInteger("code");
67 if (code != 0) { 67 if (code != 0) {
68 return new ResponseBean(code, result.getString("msg")); 68 return new ResponseBean(code, result.getString("msg"));
69 } 69 }
70 - state = state==4 ? 2 : 1;  
71 - int i = videosService.updateVideo(id, userId, state, msg); 70 + state = state == 4 ? 2 : 1;
  71 + int i = videosService.updateVideo(id, userId, state, msg);
72 if (i == 0) { 72 if (i == 0) {
73 return new ResponseBean(ErrorEnum.ERROR); 73 return new ResponseBean(ErrorEnum.ERROR);
74 } 74 }
@@ -87,7 +87,7 @@ public class VideosController { @@ -87,7 +87,7 @@ public class VideosController {
87 * @param orderByClause 87 * @param orderByClause
88 * @return 88 * @return
89 */ 89 */
90 - @RequestMapping("/page") 90 + @GetMapping("/page")
91 public Object getListVideos(Model model, String video_title, String start_date, String end_date, Integer state, Integer page, Integer pageSize, String video_priority, String orderByClause, HttpSession session) { 91 public Object getListVideos(Model model, String video_title, String start_date, String end_date, Integer state, Integer page, Integer pageSize, String video_priority, String orderByClause, HttpSession session) {
92 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 92 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
93 Integer spid = sessionUser.getSpid(); 93 Integer spid = sessionUser.getSpid();
@@ -121,8 +121,8 @@ public class VideosController { @@ -121,8 +121,8 @@ public class VideosController {
121 * @param id 121 * @param id
122 * @return 122 * @return
123 */ 123 */
124 - @RequestMapping("/details")  
125 - public Object getDetailsVideo(Model model,Integer id) { 124 + @GetMapping("/details")
  125 + public Object getDetailsVideo(Model model, Integer id) {
126 ShyVideos detailsContent = videosService.getDetailsContent(id); 126 ShyVideos detailsContent = videosService.getDetailsContent(id);
127 Object images = JSON.parse(detailsContent.getVideo_imgs()); 127 Object images = JSON.parse(detailsContent.getVideo_imgs());
128 model.addAttribute("images", images); 128 model.addAttribute("images", images);
src/main/java/com/cnlive/shenhe/serviceImpl/CommentsServiceImpl.java
@@ -123,7 +123,7 @@ public class CommentsServiceImpl { @@ -123,7 +123,7 @@ public class CommentsServiceImpl {
123 json.put("msg", ""); 123 json.put("msg", "");
124 JSONObject result = new JSONObject(); 124 JSONObject result = new JSONObject();
125 try { 125 try {
126 - result = Pass.commentPass(json); 126 + result = Pass.commentPass(json,comment.getCallback());
127 } catch (Exception e) { 127 } catch (Exception e) {
128 logger.error("评论回调失败,activity_id:{}", comment.getActivity_id()); 128 logger.error("评论回调失败,activity_id:{}", comment.getActivity_id());
129 success = false; 129 success = false;
src/main/java/com/cnlive/shenhe/utils/AuditPass.java
@@ -6,8 +6,6 @@ import org.slf4j.LoggerFactory; @@ -6,8 +6,6 @@ import org.slf4j.LoggerFactory;
6 import org.springframework.beans.factory.annotation.Value; 6 import org.springframework.beans.factory.annotation.Value;
7 import org.springframework.stereotype.Component; 7 import org.springframework.stereotype.Component;
8 8
9 -import java.io.UnsupportedEncodingException;  
10 -import java.security.NoSuchAlgorithmException;  
11 import java.util.HashMap; 9 import java.util.HashMap;
12 import java.util.Map; 10 import java.util.Map;
13 11
@@ -19,14 +17,10 @@ import java.util.Map; @@ -19,14 +17,10 @@ import java.util.Map;
19 @Component 17 @Component
20 public class AuditPass { 18 public class AuditPass {
21 private static Logger logger = LoggerFactory.getLogger(AuditPass.class); 19 private static Logger logger = LoggerFactory.getLogger(AuditPass.class);
22 - @Value("${url}")  
23 - private String url;//点播url  
24 @Value("${platformKey}") 20 @Value("${platformKey}")
25 private String platformKey;//点播platformKey 21 private String platformKey;//点播platformKey
26 @Value("${platformValue}") 22 @Value("${platformValue}")
27 private String platformValue;//点播platformValue 23 private String platformValue;//点播platformValue
28 - @Value("${commenturl}")  
29 - private String commentUrl;  
30 @Value("${token}") 24 @Value("${token}")
31 private String token; 25 private String token;
32 /** 26 /**
@@ -37,7 +31,7 @@ public class AuditPass { @@ -37,7 +31,7 @@ public class AuditPass {
37 * @param msg 31 * @param msg
38 * @return 32 * @return
39 */ 33 */
40 - public JSONObject auditPass(String video_id,int state,String attr_tags,String msg){ 34 + public JSONObject auditPass(String video_id,int state,String attr_tags,String msg,String callBack){
41 logger.info("点播回调:video_id:{},state:{},attr_tags:{},msg:{}",video_id,state,attr_tags,msg); 35 logger.info("点播回调:video_id:{},state:{},attr_tags:{},msg:{}",video_id,state,attr_tags,msg);
42 Map<String, String> paramsMap = new HashMap<>(); 36 Map<String, String> paramsMap = new HashMap<>();
43 JSONObject params = new JSONObject(); 37 JSONObject params = new JSONObject();
@@ -47,16 +41,16 @@ public class AuditPass { @@ -47,16 +41,16 @@ public class AuditPass {
47 params.put("msg",msg); 41 params.put("msg",msg);
48 paramsMap.put("params",params.toJSONString()); 42 paramsMap.put("params",params.toJSONString());
49 HttpUtil httpUtil = HttpUtil.init(); 43 HttpUtil httpUtil = HttpUtil.init();
50 - String URL =url+"?platform="+platformKey+"&token="+token; 44 + String URL =callBack+"?platform="+platformKey+"&token="+token;
51 httpUtil.setParamMap(paramsMap); 45 httpUtil.setParamMap(paramsMap);
52 Map<String, String> post = httpUtil.post(URL); 46 Map<String, String> post = httpUtil.post(URL);
53 return JSONObject.parseObject(post.get("result")); 47 return JSONObject.parseObject(post.get("result"));
54 } 48 }
55 49
56 - public JSONObject commentPass(JSONObject json){ 50 + public JSONObject commentPass(JSONObject json,String callBack){
57 HttpUtil httpUtil = HttpUtil.init(); 51 HttpUtil httpUtil = HttpUtil.init();
58 httpUtil.setStringParam(json.toJSONString()); 52 httpUtil.setStringParam(json.toJSONString());
59 - Map<String, String> post = httpUtil.post(commentUrl); 53 + Map<String, String> post = httpUtil.post(callBack);
60 return JSONObject.parseObject(post.get("result")); 54 return JSONObject.parseObject(post.get("result"));
61 } 55 }
62 } 56 }
src/main/resources/templates/page/videoDetail.html
@@ -226,6 +226,7 @@ @@ -226,6 +226,7 @@
226 var row_id = $("#video_id").val(); 226 var row_id = $("#video_id").val();
227 var attr_tags = $('#attr_tags').val();//获取标签属性信息 227 var attr_tags = $('#attr_tags').val();//获取标签属性信息
228 var msg = $('#msg').val(); //获取审核msg 228 var msg = $('#msg').val(); //获取审核msg
  229 + var callback = [[${video.callback}]];
229 if (attr_tags == null && msg == '') { //两个都为空 不行 230 if (attr_tags == null && msg == '') { //两个都为空 不行
230 alert('请输入审核备注或者常用审核意见!'); 231 alert('请输入审核备注或者常用审核意见!');
231 return false; 232 return false;
@@ -237,8 +238,8 @@ @@ -237,8 +238,8 @@
237 var action_note_type = $("#action_note_type").val(); 238 var action_note_type = $("#action_note_type").val();
238 if (action_note_type == 'reject') { 239 if (action_note_type == 'reject') {
239 $.ajax({ 240 $.ajax({
240 - type: 'get',  
241 - data: {'id':id,'activity_id': activity_id, 'state': state, 'attr_tags': msg,'msg':msg}, 241 + type: 'post',
  242 + data: {'id':id,'activity_id': activity_id, 'state': state, 'attr_tags': msg,'msg':msg,'callback':callback[0]},
242 url: '/videos/shenheVideo', 243 url: '/videos/shenheVideo',
243 success: function (data) { 244 success: function (data) {
244 window.location.href = '/videos/page?state=0' 245 window.location.href = '/videos/page?state=0'
@@ -257,12 +258,13 @@ @@ -257,12 +258,13 @@
257 var activity_id =[[${video.video_id}]]; 258 var activity_id =[[${video.video_id}]];
258 var attr_tags = $('#attr_tags').val();//获取标签属性信息 259 var attr_tags = $('#attr_tags').val();//获取标签属性信息
259 var msg = $('#msg').val(); //获取审核msg 260 var msg = $('#msg').val(); //获取审核msg
  261 + var callback = [[${video.callback}]];
260 if (typeof(activity_id) == "undefined") { 262 if (typeof(activity_id) == "undefined") {
261 return false; 263 return false;
262 } 264 }
263 $.ajax({ 265 $.ajax({
264 - type: 'get',  
265 - data: {'id':id,'activity_id': activity_id, 'state': state, 'attr_tags': msg,'msg':msg}, 266 + type: 'post',
  267 + data: {'id':id,'activity_id': activity_id, 'state': state, 'attr_tags': msg,'msg':msg,'callback':callback[0]},
266 url: '/videos/shenheVideo', 268 url: '/videos/shenheVideo',
267 success: function (data) { 269 success: function (data) {
268 window.location.href = '/videos/page?state=0' 270 window.location.href = '/videos/page?state=0'