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