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 4 import com.cnlive.shenhe.bean.ErrorEnum;
5 5 import com.cnlive.shenhe.bean.ResponseBean;
6 6 import com.cnlive.shenhe.entity.ShyComments;
7   -import com.cnlive.shenhe.entity.ShySites;
8 7 import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl;
9 8 import com.cnlive.shenhe.utils.AuditPass;
10 9 import com.cnlive.shenhe.utils.CommonConst;
... ... @@ -92,7 +91,6 @@ public class CommentsControllerApi {
92 91 shyComments.setSpid(json.getInteger("spId"));
93 92 shyComments.setApp_id(json.getString("appId"));
94 93 shyComments.setPlatform(json.getString("platform"));
95   - shyComments.setActivity_id(json.getString("activityId"));
96 94 shyComments.setIs_hot(json.getBoolean("priority"));
97 95 shyComments.setCallback(json.getString("callback"));
98 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 3 import com.alibaba.fastjson.JSONObject;
4 4 import com.cnlive.shenhe.bean.ErrorEnum;
5 5 import com.cnlive.shenhe.bean.ResponseBean;
6   -import com.cnlive.shenhe.entity.ShySites;
7 6 import com.cnlive.shenhe.entity.ShyVideos;
8 7 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
9 8 import com.cnlive.shenhe.serviceImpl.VideosServiceImpl;
... ... @@ -18,7 +17,6 @@ import org.springframework.web.bind.annotation.PostMapping;
18 17 import org.springframework.web.bind.annotation.RequestMapping;
19 18 import org.springframework.web.bind.annotation.ResponseBody;
20 19  
21   -import java.util.Arrays;
22 20 import java.util.List;
23 21  
24 22 /**
... ... @@ -76,7 +74,6 @@ public class VideosControllerApi {
76 74 }
77 75 }
78 76 //查了,没有,直接插入数据库
79   - shyVideos1.setVideo_id(videoId);
80 77 shyVideos1.setVideo_title(json.getString("videoTitle"));
81 78 shyVideos1.setVideo_url(json.getString("videoUrl"));
82 79 String videoCoverUrl = json.getString("videoCoverUrl");
... ...
src/main/java/com/cnlive/shenhe/job/VideosJob.java
... ... @@ -22,7 +22,7 @@ import java.util.List;
22 22  
23 23 @Component
24 24 public class VideosJob {
25   - private static Logger logger = LoggerFactory.getLogger(CommentsJob.class);
  25 + private static Logger logger = LoggerFactory.getLogger(VideosJob.class);
26 26 @Autowired
27 27 SitesServiceImpl sitesService;
28 28 @Autowired
... ... @@ -35,9 +35,8 @@ public class VideosJob {
35 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 40 //收集免审的spid
42 41 List<ShySites> sitesList = sitesService.findAll();
43 42 ArrayList<Integer> sites = new ArrayList<Integer>();
... ... @@ -54,22 +53,25 @@ public class VideosJob {
54 53 ShyVideos shyVideos = new ShyVideos();
55 54 for (int spid : sites) {
56 55 shyVideos.setSpid(spid);
  56 + shyVideos.setState(CommonConst.AUDIT_INTT);
57 57 List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);
58 58 if (shyVideosList.size() > 0) {
59 59 for (ShyVideos video : shyVideosList) {
60 60 JSONObject result = new JSONObject();
61 61 try {
62 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 72 } catch (Exception e) {
64 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 }
... ...