Commit cce808d8e43834ea59e5ff185887ac1c113eb334
1 parent
43d81996
屏蔽白名单回调有问题的数据
Showing
6 changed files
with
16 additions
and
5 deletions
src/main/java/com/cnlive/shenhe/api/AvsampleCallBackControllerApi.java
| 1 | package com.cnlive.shenhe.api; | 1 | package com.cnlive.shenhe.api; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | +import com.cnlive.shenhe.bean.ErrorEnum; | ||
| 5 | +import com.cnlive.shenhe.bean.ResponseBean; | ||
| 4 | import com.cnlive.shenhe.entity.ShyVideos; | 6 | import com.cnlive.shenhe.entity.ShyVideos; |
| 5 | import com.cnlive.shenhe.serviceImpl.VideosServiceImpl; | 7 | import com.cnlive.shenhe.serviceImpl.VideosServiceImpl; |
| 6 | import com.cnlive.shenhe.utils.CommonConst; | 8 | import com.cnlive.shenhe.utils.CommonConst; |
| @@ -34,7 +36,7 @@ public class AvsampleCallBackControllerApi { | @@ -34,7 +36,7 @@ public class AvsampleCallBackControllerApi { | ||
| 34 | * @param json | 36 | * @param json |
| 35 | */ | 37 | */ |
| 36 | @PostMapping("/callback") | 38 | @PostMapping("/callback") |
| 37 | - public void callback(@RequestBody JSONObject json) { | 39 | + public ResponseBean callback(@RequestBody JSONObject json) { |
| 38 | logger.info("抽帧回调请求。。。。json=="+json.toJSONString()); | 40 | logger.info("抽帧回调请求。。。。json=="+json.toJSONString()); |
| 39 | String taskId = json.getString("taskId"); | 41 | String taskId = json.getString("taskId"); |
| 40 | if(CommonUtils.isNotEmpty(taskId)){ | 42 | if(CommonUtils.isNotEmpty(taskId)){ |
| @@ -54,6 +56,8 @@ public class AvsampleCallBackControllerApi { | @@ -54,6 +56,8 @@ public class AvsampleCallBackControllerApi { | ||
| 54 | videosService.updateshyVideos(video); | 56 | videosService.updateshyVideos(video); |
| 55 | } | 57 | } |
| 56 | 58 | ||
| 59 | + return new ResponseBean(); | ||
| 57 | } | 60 | } |
| 61 | + return new ResponseBean(ErrorEnum.ERROR); | ||
| 58 | } | 62 | } |
| 59 | } | 63 | } |
src/main/java/com/cnlive/shenhe/api/VideosControllerApi.java
| @@ -165,7 +165,7 @@ public class VideosControllerApi { | @@ -165,7 +165,7 @@ public class VideosControllerApi { | ||
| 165 | params.put("dstBucket", qn_bucket); | 165 | params.put("dstBucket", qn_bucket); |
| 166 | } | 166 | } |
| 167 | String dstDir = desdir + "/" + spid + "/" + CommonUtils.getCurrentDate("yyyy/MM/dd"); | 167 | String dstDir = desdir + "/" + spid + "/" + CommonUtils.getCurrentDate("yyyy/MM/dd"); |
| 168 | - String formats = video_url.substring(video_url.indexOf(".") + 1); | 168 | + String formats = path.substring(path.indexOf(".") + 1); |
| 169 | params.put("path", path); | 169 | params.put("path", path); |
| 170 | params.put("dstDir", dstDir); | 170 | params.put("dstDir", dstDir); |
| 171 | params.put("type", "avsample"); | 171 | params.put("type", "avsample"); |
| @@ -185,6 +185,7 @@ public class VideosControllerApi { | @@ -185,6 +185,7 @@ public class VideosControllerApi { | ||
| 185 | httpUtil.setParamMap(dataMap); | 185 | httpUtil.setParamMap(dataMap); |
| 186 | Map<String, String> resultMap = httpUtil.post(url); | 186 | Map<String, String> resultMap = httpUtil.post(url); |
| 187 | JSONObject result = JSON.parseObject(resultMap.get("result")); | 187 | JSONObject result = JSON.parseObject(resultMap.get("result")); |
| 188 | + logger.info("请求抽帧结果:result:{}",result); | ||
| 188 | Integer code = result.getInteger("code"); | 189 | Integer code = result.getInteger("code"); |
| 189 | if (code == 0) { | 190 | if (code == 0) { |
| 190 | video.setAvsample(CommonConst.AVSAMPLE_ING); | 191 | video.setAvsample(CommonConst.AVSAMPLE_ING); |
src/main/java/com/cnlive/shenhe/job/CommentsJob.java
| @@ -72,6 +72,7 @@ public class CommentsJob { | @@ -72,6 +72,7 @@ public class CommentsJob { | ||
| 72 | logger.error("评论审核回调失败,activity_id:{},errorCode:{},errorMessage:{}", comments.getActivity_id(), errorCode, result.getString("errorMessage")); | 72 | logger.error("评论审核回调失败,activity_id:{},errorCode:{},errorMessage:{}", comments.getActivity_id(), errorCode, result.getString("errorMessage")); |
| 73 | } | 73 | } |
| 74 | } else { | 74 | } else { |
| 75 | + commentsService.updateComment(comments.getId(), CommonConst.AUDIT_CALLBACK_FAIL, "白名单回调失败"); | ||
| 75 | logger.error("评论审核回调失败,activity_id:{},errorCode:{},errorMessage:{}", comments.getActivity_id(), errorCode, result.getString("errorMessage")); | 76 | logger.error("评论审核回调失败,activity_id:{},errorCode:{},errorMessage:{}", comments.getActivity_id(), errorCode, result.getString("errorMessage")); |
| 76 | } | 77 | } |
| 77 | } catch (Exception e) { | 78 | } catch (Exception e) { |
src/main/java/com/cnlive/shenhe/job/VideosJob.java
| @@ -62,11 +62,12 @@ public class VideosJob { | @@ -62,11 +62,12 @@ public class VideosJob { | ||
| 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"); | 63 | Integer code = result.getInteger("code"); |
| 64 | if (0 == code) { | 64 | if (0 == code) { |
| 65 | - int i = videosService.updateVideo(video.getId(), video.getAuditor_id(), CommonConst.AUDIT_SUCCESS, ""); | 65 | + int i = videosService.updateVideo(video.getId(), null, CommonConst.AUDIT_SUCCESS, result.getString("msg")); |
| 66 | if (i != 1) { | 66 | if (i != 1) { |
| 67 | logger.error("点播视频更改失败,activity_id:{}", video.getVideo_id()); | 67 | logger.error("点播视频更改失败,activity_id:{}", video.getVideo_id()); |
| 68 | } | 68 | } |
| 69 | } else { | 69 | } else { |
| 70 | + videosService.updateVideo(video.getId(), null, CommonConst.AUDIT_CALLBACK_FAIL, "白名单回调失败"); | ||
| 70 | logger.error("点播视频回调失败,activity_id:{},code:{},msg:{}", video.getVideo_id(), code, result.getString("msg")); | 71 | logger.error("点播视频回调失败,activity_id:{},code:{},msg:{}", video.getVideo_id(), code, result.getString("msg")); |
| 71 | } | 72 | } |
| 72 | } catch (Exception e) { | 73 | } catch (Exception e) { |
src/main/java/com/cnlive/shenhe/utils/CommonConst.java
| @@ -23,6 +23,10 @@ public class CommonConst { | @@ -23,6 +23,10 @@ public class CommonConst { | ||
| 23 | */ | 23 | */ |
| 24 | public static Integer AUDIT_REFUSE = 2; | 24 | public static Integer AUDIT_REFUSE = 2; |
| 25 | 25 | ||
| 26 | + /** | ||
| 27 | + * 审核状态:白名单通过回调失败 | ||
| 28 | + */ | ||
| 29 | + public static Integer AUDIT_CALLBACK_FAIL = 3; | ||
| 26 | 30 | ||
| 27 | /** | 31 | /** |
| 28 | * 领取状态:未领 | 32 | * 领取状态:未领 |
src/main/resources/application.properties
| @@ -38,8 +38,8 @@ platformValue=10011438 | @@ -38,8 +38,8 @@ platformValue=10011438 | ||
| 38 | 38 | ||
| 39 | #抽帧常量 | 39 | #抽帧常量 |
| 40 | avsmple_appKey=6962df5e02d846f490d64f3a68ac89fc | 40 | avsmple_appKey=6962df5e02d846f490d64f3a68ac89fc |
| 41 | -avsmple_appSecret=a34b7b6ff20c4816981465a1fd901a9f0419921382844328948373eee63934d4 | ||
| 42 | -avsmple_url=http://transcode.cnlive.com/api/request | 41 | +avsmple_appSecret=a34b7b6ff20c4816981465a1fd901a9f0419921382844328948373eee639f9d4 |
| 42 | +avsmple_url=http://test.transcode.cnlive.com/api/request | ||
| 43 | avsmple_callback=http://test.shen.cnlive.com/api/avsample/callback | 43 | avsmple_callback=http://test.shen.cnlive.com/api/avsample/callback |
| 44 | 44 | ||
| 45 | #抽帧存放bucket和域名 | 45 | #抽帧存放bucket和域名 |