Commit e76668bad73eb34173d0f0b218b0c1fef5ee1058

Authored by 周伟鹏
1 parent cc73da74

update

src/main/java/com/cnlive/shenhe/api/CommentsControllerApi.java
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject; @@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
4 import com.cnlive.shenhe.bean.ErrorEnum; 4 import com.cnlive.shenhe.bean.ErrorEnum;
5 import com.cnlive.shenhe.bean.ResponseBean; 5 import com.cnlive.shenhe.bean.ResponseBean;
6 import com.cnlive.shenhe.entity.ShyComments; 6 import com.cnlive.shenhe.entity.ShyComments;
7 -import com.cnlive.shenhe.entity.ShySites;  
8 import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl; 7 import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl;
9 import com.cnlive.shenhe.utils.AuditPass; 8 import com.cnlive.shenhe.utils.AuditPass;
10 import com.cnlive.shenhe.utils.CommonConst; 9 import com.cnlive.shenhe.utils.CommonConst;
@@ -92,7 +91,6 @@ public class CommentsControllerApi { @@ -92,7 +91,6 @@ public class CommentsControllerApi {
92 shyComments.setSpid(json.getInteger("spId")); 91 shyComments.setSpid(json.getInteger("spId"));
93 shyComments.setApp_id(json.getString("appId")); 92 shyComments.setApp_id(json.getString("appId"));
94 shyComments.setPlatform(json.getString("platform")); 93 shyComments.setPlatform(json.getString("platform"));
95 - shyComments.setActivity_id(json.getString("activityId"));  
96 shyComments.setIs_hot(json.getBoolean("priority")); 94 shyComments.setIs_hot(json.getBoolean("priority"));
97 shyComments.setCallback(json.getString("callback")); 95 shyComments.setCallback(json.getString("callback"));
98 boolean YorN = commentsService.impotComments(shyComments); 96 boolean YorN = commentsService.impotComments(shyComments);
src/main/java/com/cnlive/shenhe/api/VideosControllerApi.java
@@ -3,7 +3,6 @@ package com.cnlive.shenhe.api; @@ -3,7 +3,6 @@ package com.cnlive.shenhe.api;
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
4 import com.cnlive.shenhe.bean.ErrorEnum; 4 import com.cnlive.shenhe.bean.ErrorEnum;
5 import com.cnlive.shenhe.bean.ResponseBean; 5 import com.cnlive.shenhe.bean.ResponseBean;
6 -import com.cnlive.shenhe.entity.ShySites;  
7 import com.cnlive.shenhe.entity.ShyVideos; 6 import com.cnlive.shenhe.entity.ShyVideos;
8 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; 7 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
9 import com.cnlive.shenhe.serviceImpl.VideosServiceImpl; 8 import com.cnlive.shenhe.serviceImpl.VideosServiceImpl;
@@ -18,7 +17,6 @@ import org.springframework.web.bind.annotation.PostMapping; @@ -18,7 +17,6 @@ import org.springframework.web.bind.annotation.PostMapping;
18 import org.springframework.web.bind.annotation.RequestMapping; 17 import org.springframework.web.bind.annotation.RequestMapping;
19 import org.springframework.web.bind.annotation.ResponseBody; 18 import org.springframework.web.bind.annotation.ResponseBody;
20 19
21 -import java.util.Arrays;  
22 import java.util.List; 20 import java.util.List;
23 21
24 /** 22 /**
@@ -76,7 +74,6 @@ public class VideosControllerApi { @@ -76,7 +74,6 @@ public class VideosControllerApi {
76 } 74 }
77 } 75 }
78 //查了,没有,直接插入数据库 76 //查了,没有,直接插入数据库
79 - shyVideos1.setVideo_id(videoId);  
80 shyVideos1.setVideo_title(json.getString("videoTitle")); 77 shyVideos1.setVideo_title(json.getString("videoTitle"));
81 shyVideos1.setVideo_url(json.getString("videoUrl")); 78 shyVideos1.setVideo_url(json.getString("videoUrl"));
82 String videoCoverUrl = json.getString("videoCoverUrl"); 79 String videoCoverUrl = json.getString("videoCoverUrl");
src/main/java/com/cnlive/shenhe/job/VideosJob.java
@@ -22,7 +22,7 @@ import java.util.List; @@ -22,7 +22,7 @@ import java.util.List;
22 22
23 @Component 23 @Component
24 public class VideosJob { 24 public class VideosJob {
25 - private static Logger logger = LoggerFactory.getLogger(CommentsJob.class); 25 + private static Logger logger = LoggerFactory.getLogger(VideosJob.class);
26 @Autowired 26 @Autowired
27 SitesServiceImpl sitesService; 27 SitesServiceImpl sitesService;
28 @Autowired 28 @Autowired
@@ -35,9 +35,8 @@ public class VideosJob { @@ -35,9 +35,8 @@ public class VideosJob {
35 VideosServiceImpl videosService; 35 VideosServiceImpl videosService;
36 36
37 37
38 - @Scheduled(fixedRate = 30 * 60 * 1000)  
39 - public void syncComments() {  
40 - 38 + @Scheduled(fixedRate = 60 * 1000)
  39 + public void updateVideos() {
41 //收集免审的spid 40 //收集免审的spid
42 List<ShySites> sitesList = sitesService.findAll(); 41 List<ShySites> sitesList = sitesService.findAll();
43 ArrayList<Integer> sites = new ArrayList<Integer>(); 42 ArrayList<Integer> sites = new ArrayList<Integer>();
@@ -54,22 +53,25 @@ public class VideosJob { @@ -54,22 +53,25 @@ public class VideosJob {
54 ShyVideos shyVideos = new ShyVideos(); 53 ShyVideos shyVideos = new ShyVideos();
55 for (int spid : sites) { 54 for (int spid : sites) {
56 shyVideos.setSpid(spid); 55 shyVideos.setSpid(spid);
  56 + shyVideos.setState(CommonConst.AUDIT_INTT);
57 List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos); 57 List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);
58 if (shyVideosList.size() > 0) { 58 if (shyVideosList.size() > 0) {
59 for (ShyVideos video : shyVideosList) { 59 for (ShyVideos video : shyVideosList) {
60 JSONObject result = new JSONObject(); 60 JSONObject result = new JSONObject();
61 try { 61 try {
62 result = Pass.auditPass(video.getVideo_id(), 3, "", "", video.getCallback()); 62 result = Pass.auditPass(video.getVideo_id(), 3, "", "", video.getCallback());
  63 + Integer code = result.getInteger("code");
  64 + if (0 == code) {
  65 + int i = videosService.updateVideo(video.getId(), video.getAuditor_id(), CommonConst.AUDIT_SUCCESS, "");
  66 + if (i != 1) {
  67 + logger.error("点播视频更改失败,activity_id:{}", video.getVideo_id());
  68 + }
  69 + } else {
  70 + logger.error("点播视频回调失败,activity_id:{},code:{},msg:{}", video.getVideo_id(), code, result.getString("msg"));
  71 + }
63 } catch (Exception e) { 72 } catch (Exception e) {
64 logger.error("点播视频回调失败,activity_id:{}", video.getVideo_id()); 73 logger.error("点播视频回调失败,activity_id:{}", video.getVideo_id());
65 } 74 }
66 - int i = videosService.updateVideo(video.getId(), video.getAuditor_id(), CommonConst.AUDIT_SUCCESS, "");  
67 - if (i > 0) {  
68 - System.out.println("点播视频更改成功");  
69 - logger.info("点播视频更改成功");  
70 - } else {  
71 - logger.info("点播视频更改失败");  
72 - }  
73 } 75 }
74 } 76 }
75 } 77 }