Commit 627a03be4a266e3bb2f323cea662cbc708cf4cc0
1 parent
0cd82d40
update
Showing
1 changed file
with
12 additions
and
12 deletions
src/main/java/com/cnlive/shenhe/job/CommentsJob.java
| ... | ... | @@ -33,8 +33,8 @@ public class CommentsJob { |
| 33 | 33 | UsersServiceImpl usersService; |
| 34 | 34 | |
| 35 | 35 | |
| 36 | - @Scheduled(fixedRate = 30 * 60 * 1000) | |
| 37 | - public void syncComments() { | |
| 36 | + @Scheduled(fixedRate = 60 * 1000) | |
| 37 | + public void updateComments() { | |
| 38 | 38 | |
| 39 | 39 | //收集免审的spid |
| 40 | 40 | List<ShySites> sitesList = sitesService.findAll(); |
| ... | ... | @@ -52,6 +52,7 @@ public class CommentsJob { |
| 52 | 52 | ShyComments shyComments = new ShyComments(); |
| 53 | 53 | for (int spid : sites) { |
| 54 | 54 | shyComments.setSpid(spid); |
| 55 | + shyComments.setState(CommonConst.AUDIT_INTT); | |
| 55 | 56 | List<ShyComments> commentsList = commentsService.findshyComments(shyComments); |
| 56 | 57 | if (commentsList.size() > 0) { |
| 57 | 58 | for (ShyComments comments : commentsList) { |
| ... | ... | @@ -64,19 +65,18 @@ public class CommentsJob { |
| 64 | 65 | JSONObject result = new JSONObject(); |
| 65 | 66 | try { |
| 66 | 67 | result = Pass.commentPass(json1, comments.getCallback()); |
| 68 | + Integer code = result.getInteger("code"); | |
| 69 | + if (0 == code) { | |
| 70 | + int i = commentsService.updateComment(comments.getId(), CommonConst.AUDIT_SUCCESS, json1.getString("msg")); | |
| 71 | + if (i != 1) { | |
| 72 | + logger.error("评论审核回调失败,activity_id:{},code:{},msg:{}", comments.getActivity_id(), code, result.getString("msg")); | |
| 73 | + } | |
| 74 | + } else { | |
| 75 | + logger.error("评论审核回调失败,activity_id:{},code:{},msg:{}", comments.getActivity_id(), code, result.getString("msg")); | |
| 76 | + } | |
| 67 | 77 | } catch (Exception e) { |
| 68 | 78 | logger.error("评论回调失败,activity_id:{}", comments.getActivity_id()); |
| 69 | 79 | } |
| 70 | - comments.setState(CommonConst.AUDIT_SUCCESS); | |
| 71 | - int i = commentsService.updateComment(comments.getId(), CommonConst.AUDIT_SUCCESS, json1.getString("msg")); | |
| 72 | - if (i > 0) { | |
| 73 | - logger.info("评论修改成功"); | |
| 74 | - System.out.println("评论修改成功"); | |
| 75 | - } else { | |
| 76 | - logger.info("评论修改失败"); | |
| 77 | - System.out.println("评论修改失败"); | |
| 78 | - | |
| 79 | - } | |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | } | ... | ... |