Commit af4fec7496042157bb31431a3d0ae6ace6def05d

Authored by 徐近程
1 parent dbd10515

update

src/main/java/com/cnlive/shenhe/job/VideosJob.java
@@ -54,7 +54,7 @@ public class VideosJob { @@ -54,7 +54,7 @@ public class VideosJob {
54 /** 54 /**
55 * 定时向易盾发送视频进行检测 55 * 定时向易盾发送视频进行检测
56 */ 56 */
57 - //@Scheduled(cron = "0 0/1 10-23 * * ? ")//每天10点到23点执行,每分钟一次 57 + @Scheduled(cron = "0 0/1 10-23 * * ? ")//每天10点到23点执行,每分钟一次
58 public void videofilter() { 58 public void videofilter() {
59 ShyVideos shyVideos = new ShyVideos(); 59 ShyVideos shyVideos = new ShyVideos();
60 shyVideos.setShenhe_type(CommonConst.AUDIT_TYPE_MACHANE);//审核类型为机审 60 shyVideos.setShenhe_type(CommonConst.AUDIT_TYPE_MACHANE);//审核类型为机审
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
@@ -5,19 +5,12 @@ import com.alibaba.fastjson.JSONArray; @@ -5,19 +5,12 @@ import com.alibaba.fastjson.JSONArray;
5 import com.alibaba.fastjson.JSONObject; 5 import com.alibaba.fastjson.JSONObject;
6 import com.cnlive.shenhe.bean.ErrorEnum; 6 import com.cnlive.shenhe.bean.ErrorEnum;
7 import com.cnlive.shenhe.bean.ResponseBean; 7 import com.cnlive.shenhe.bean.ResponseBean;
8 -import com.cnlive.shenhe.entity.ShySites;  
9 -import com.cnlive.shenhe.entity.ShyUsers;  
10 -import com.cnlive.shenhe.entity.ShyUsersfree;  
11 -import com.cnlive.shenhe.entity.ShyVideofilter;  
12 -import com.cnlive.shenhe.entity.ShyVideos; 8 +import com.cnlive.shenhe.entity.*;
13 import com.cnlive.shenhe.job.VideosJob; 9 import com.cnlive.shenhe.job.VideosJob;
14 import com.cnlive.shenhe.mapper.ShySitesMapper; 10 import com.cnlive.shenhe.mapper.ShySitesMapper;
15 import com.cnlive.shenhe.mapper.ShyUsersMapper; 11 import com.cnlive.shenhe.mapper.ShyUsersMapper;
16 import com.cnlive.shenhe.mapper.ShyVideosMapper; 12 import com.cnlive.shenhe.mapper.ShyVideosMapper;
17 -import com.cnlive.shenhe.utils.AntiFraudUtil;  
18 -import com.cnlive.shenhe.utils.AuditPass;  
19 -import com.cnlive.shenhe.utils.CommonConst;  
20 -import com.cnlive.shenhe.utils.CommonUtils; 13 +import com.cnlive.shenhe.utils.*;
21 import com.github.pagehelper.PageHelper; 14 import com.github.pagehelper.PageHelper;
22 import com.github.pagehelper.PageInfo; 15 import com.github.pagehelper.PageInfo;
23 16
@@ -32,11 +25,7 @@ import tk.mybatis.mapper.entity.Example; @@ -32,11 +25,7 @@ import tk.mybatis.mapper.entity.Example;
32 25
33 import java.sql.Timestamp; 26 import java.sql.Timestamp;
34 import java.text.ParseException; 27 import java.text.ParseException;
35 -import java.util.ArrayList;  
36 -import java.util.Arrays;  
37 -import java.util.HashMap;  
38 -import java.util.List;  
39 -import java.util.Map; 28 +import java.util.*;
40 29
41 /** 30 /**
42 * @Auther: chenhao 31 * @Auther: chenhao
@@ -45,31 +34,33 @@ import java.util.Map; @@ -45,31 +34,33 @@ import java.util.Map;
45 */ 34 */
46 @Service 35 @Service
47 public class VideosServiceImpl { 36 public class VideosServiceImpl {
48 - private static Logger logger = LoggerFactory.getLogger(VideosServiceImpl.class); 37 + private static Logger logger = LoggerFactory.getLogger(VideosServiceImpl.class);
49 @Autowired 38 @Autowired
50 ShyVideosMapper shyVideosMapper; 39 ShyVideosMapper shyVideosMapper;
51 @Autowired 40 @Autowired
52 ShySitesMapper shySitesMapper; 41 ShySitesMapper shySitesMapper;
53 @Autowired 42 @Autowired
54 ShyUsersMapper shyUsersMapper; 43 ShyUsersMapper shyUsersMapper;
55 - 44 +
56 @Autowired 45 @Autowired
57 VideosServiceImpl videosService; 46 VideosServiceImpl videosService;
58 @Autowired 47 @Autowired
59 SitesServiceImpl sitesService; 48 SitesServiceImpl sitesService;
60 - 49 +
61 @Autowired 50 @Autowired
62 UsersfreeServiceImpl usersfreeServiceImpl; 51 UsersfreeServiceImpl usersfreeServiceImpl;
63 - 52 +
64 @Autowired 53 @Autowired
65 VideofilterServiceImpl videofilterServiceImpl; 54 VideofilterServiceImpl videofilterServiceImpl;
66 - 55 + @Autowired
  56 + YiDunServiceImpl yiDunServiceImpl;
  57 +
67 @Value("${qn_domain}") 58 @Value("${qn_domain}")
68 String qn_domain; 59 String qn_domain;
69 60
70 @Value("${ks_domain}") 61 @Value("${ks_domain}")
71 String ks_domain; 62 String ks_domain;
72 - 63 +
73 @Autowired 64 @Autowired
74 AuditPass Pass; 65 AuditPass Pass;
75 66
@@ -99,21 +90,21 @@ public class VideosServiceImpl { @@ -99,21 +90,21 @@ public class VideosServiceImpl {
99 return true; 90 return true;
100 } 91 }
101 92
102 - public int updateVideo(Integer id, String auditor_id,String updater,String attr_tags, Integer state, String msg) { 93 + public int updateVideo(Integer id, String auditor_id, String updater, String attr_tags, Integer state, String msg) {
103 ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(id); 94 ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(id);
104 shyVideos.setAuditor_id(auditor_id); 95 shyVideos.setAuditor_id(auditor_id);
105 shyVideos.setState(state); 96 shyVideos.setState(state);
106 - if(CommonUtils.isNotEmpty(attr_tags)){  
107 - shyVideos.setAttr_tags(attr_tags); 97 + if (CommonUtils.isNotEmpty(attr_tags)) {
  98 + shyVideos.setAttr_tags(attr_tags);
108 } 99 }
109 - if(CommonUtils.isNotEmpty(msg)){  
110 - shyVideos.setMsg(msg); 100 + if (CommonUtils.isNotEmpty(msg)) {
  101 + shyVideos.setMsg(msg);
111 } 102 }
112 shyVideos.setUpdater(updater); 103 shyVideos.setUpdater(updater);
113 - if(CommonUtils.isNotEmpty(auditor_id)){  
114 - shyVideos.setReceive(CommonConst.RECEIVE_AFTER);  
115 - shyVideos.setReceive_user_id(auditor_id);  
116 - shyVideos.setShenhe_type(CommonConst.AUDIT_TYPE_USER); 104 + if (CommonUtils.isNotEmpty(auditor_id)) {
  105 + shyVideos.setReceive(CommonConst.RECEIVE_AFTER);
  106 + shyVideos.setReceive_user_id(auditor_id);
  107 + shyVideos.setShenhe_type(CommonConst.AUDIT_TYPE_USER);
117 } 108 }
118 return shyVideosMapper.updateByPrimaryKey(shyVideos); 109 return shyVideosMapper.updateByPrimaryKey(shyVideos);
119 } 110 }
@@ -145,7 +136,7 @@ public class VideosServiceImpl { @@ -145,7 +136,7 @@ public class VideosServiceImpl {
145 criteria.andLike("video_title", "%" + video_title + "%"); 136 criteria.andLike("video_title", "%" + video_title + "%");
146 criteria2.andLike("video_title", "%" + video_title + "%"); 137 criteria2.andLike("video_title", "%" + video_title + "%");
147 } 138 }
148 - 139 +
149 if (CommonUtils.isNotEmpty(video_priority)) { 140 if (CommonUtils.isNotEmpty(video_priority)) {
150 criteria.andEqualTo("video_priority", video_priority); 141 criteria.andEqualTo("video_priority", video_priority);
151 criteria2.andEqualTo("video_priority", video_priority); 142 criteria2.andEqualTo("video_priority", video_priority);
@@ -180,14 +171,14 @@ public class VideosServiceImpl { @@ -180,14 +171,14 @@ public class VideosServiceImpl {
180 public ShyVideos getDetailsContent(Integer id) { 171 public ShyVideos getDetailsContent(Integer id) {
181 ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(id); 172 ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(id);
182 if (shyVideos.getState() != CommonConst.AUDIT_INTT) { 173 if (shyVideos.getState() != CommonConst.AUDIT_INTT) {
183 - String updater = CommonUtils.isEmpty(shyVideos.getUpdater()) || "null".equals(shyVideos.getUpdater())? "白名单":shyVideos.getUpdater(); 174 + String updater = CommonUtils.isEmpty(shyVideos.getUpdater()) || "null".equals(shyVideos.getUpdater()) ? "白名单" : shyVideos.getUpdater();
184 String auditor_id = shyVideos.getAuditor_id(); 175 String auditor_id = shyVideos.getAuditor_id();
185 if (CommonUtils.isNotEmpty(auditor_id)) { 176 if (CommonUtils.isNotEmpty(auditor_id)) {
186 ShyUsers user = new ShyUsers(); 177 ShyUsers user = new ShyUsers();
187 user.setUser_id(auditor_id); 178 user.setUser_id(auditor_id);
188 user = shyUsersMapper.selectOne(user); 179 user = shyUsersMapper.selectOne(user);
189 - String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail())? "" : user.getEmail();  
190 - String userName = CommonUtils.isEmpty(user.getUsername()) ? email: user.getUsername(); 180 + String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();
  181 + String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();
191 updater = userName; 182 updater = userName;
192 } 183 }
193 shyVideos.setUpdater(updater); 184 shyVideos.setUpdater(updater);
@@ -201,7 +192,7 @@ public class VideosServiceImpl { @@ -201,7 +192,7 @@ public class VideosServiceImpl {
201 String[] cids = ids.split(","); 192 String[] cids = ids.split(",");
202 for (String cid : cids) { 193 for (String cid : cids) {
203 ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(Integer.parseInt(cid)); 194 ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(Integer.parseInt(cid));
204 - if (CommonUtils.isNotNull(shyVideos) && shyVideos.getState() == CommonConst.AUDIT_INTT && shyVideos.getReceive()==CommonConst.RECEIVE_BEFORE) { 195 + if (CommonUtils.isNotNull(shyVideos) && shyVideos.getState() == CommonConst.AUDIT_INTT && shyVideos.getReceive() == CommonConst.RECEIVE_BEFORE) {
205 shyVideos.setReceive_user_id(userId); 196 shyVideos.setReceive_user_id(userId);
206 shyVideos.setReceive(CommonConst.RECEIVE_AFTER); 197 shyVideos.setReceive(CommonConst.RECEIVE_AFTER);
207 shyVideosMapper.updateByPrimaryKeySelective(shyVideos); 198 shyVideosMapper.updateByPrimaryKeySelective(shyVideos);
@@ -232,7 +223,7 @@ public class VideosServiceImpl { @@ -232,7 +223,7 @@ public class VideosServiceImpl {
232 String[] cids = ids.split(","); 223 String[] cids = ids.split(",");
233 for (String cid : cids) { 224 for (String cid : cids) {
234 ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(Integer.parseInt(cid)); 225 ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(Integer.parseInt(cid));
235 - if (shyVideos.getState() == CommonConst.AUDIT_INTT && shyVideos.getReceive()==CommonConst.RECEIVE_AFTER && shyVideos.getReceive_user_id().equals(userId)) { 226 + if (shyVideos.getState() == CommonConst.AUDIT_INTT && shyVideos.getReceive() == CommonConst.RECEIVE_AFTER && shyVideos.getReceive_user_id().equals(userId)) {
236 shyVideos.setReceive(CommonConst.RECEIVE_BEFORE); 227 shyVideos.setReceive(CommonConst.RECEIVE_BEFORE);
237 shyVideos.setReceive_user_id(null); 228 shyVideos.setReceive_user_id(null);
238 int i = shyVideosMapper.updateByPrimaryKey(shyVideos); 229 int i = shyVideosMapper.updateByPrimaryKey(shyVideos);
@@ -308,96 +299,101 @@ public class VideosServiceImpl { @@ -308,96 +299,101 @@ public class VideosServiceImpl {
308 List<ShyVideos> shyVideosList = shyVideosMapper.selectByExample(example); 299 List<ShyVideos> shyVideosList = shyVideosMapper.selectByExample(example);
309 return shyVideosList; 300 return shyVideosList;
310 } 301 }
311 - 302 +
312 /** 303 /**
313 - * 数美视频(图片)过滤 304 + * 易盾视频(图片)过滤
  305 + *
314 * @param cid 审核云中视频的id 306 * @param cid 审核云中视频的id
315 * @return 307 * @return
316 */ 308 */
317 - public int videoFilter(Integer cid){  
318 - ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(cid);  
319 - shyVideos.setUpdater("自动审核");  
320 - Integer plat = shyVideos.getPlat();  
321 - String yuming = "";  
322 - if (plat == CommonConst.QINIU_PLAT) {  
323 - yuming = qn_domain + "/";  
324 - } else if (plat == CommonConst.KS_PLAT) {  
325 - yuming = ks_domain + "/";  
326 - }  
327 - List<String> imgList =JSONArray.parseArray(shyVideos.getAvsample_imgs(),String.class);  
328 - List<Map<String,Object>> list=new ArrayList<>();  
329 - for (String imgStr : imgList) {  
330 - String imgUrl=yuming+imgStr;  
331 - Map<String,Object> map=new HashMap<>();  
332 - map.put("imageUrl", imgUrl);  
333 - list.add(map);  
334 - }  
335 - String jsonList = JSONArray.toJSONString(list);  
336 - JSONObject result = null;//数美返回结果  
337 - String type="";//数美返回结果的类型  
338 - String desc="";//数美失败结果的详情  
339 - try{  
340 - //调用数美接口  
341 - result = AntiFraudUtil.filterImg(shyVideos.getTask_id(),jsonList,CommonConst.DYNAMIC_USER);  
342 - type=result.getString("type");  
343 - desc=result.getString("desc");//数美失败结果的详情  
344 - }catch(Exception e){  
345 - type=CommonConst.REJECT;//报错就给一个拒绝状态  
346 - desc="数美审核报错了";  
347 - }  
348 - if(type.toLowerCase().equals(CommonConst.PASS)){//数美通过  
349 - desc="数美审核通过了";  
350 - shyVideos.setMsg(desc);  
351 - //修改点播云视频状态  
352 - videosService.updateDianboAndShenhe(shyVideos,3);  
353 - }else if(type.toLowerCase().equals(CommonConst.REJECT)){//数美拒绝  
354 - shyVideos.setShenhe_type(CommonConst.AUDIT_TYPE_USER);//审核类型改为人工审核  
355 - shyVideos.setMsg(desc);//拒绝原因  
356 - videosService.updateshyVideos(shyVideos);  
357 -// videosService.updateDianboAndShenhe(shyVideos,4);  
358 - }  
359 - ShyVideofilter videofilter=new ShyVideofilter();  
360 - //videofilter.setChannel(channel);  
361 - videofilter.setDesc_msg(desc);  
362 - videofilter.setResult_type(type);  
363 - videofilter.setToken_id(shyVideos.getTask_id());  
364 - videofilter.setVideos_id(cid);  
365 - videofilter.setDuration(shyVideos.getDuration());  
366 - videofilter.setCreated_at(CommonUtils.getCurrentTime());  
367 - videofilterServiceImpl.impotVideofilter(videofilter);  
368 -  
369 - return 0; 309 + public int videoFilter(Integer cid) {
  310 + ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(cid);
  311 + shyVideos.setUpdater("自动审核");
  312 + Integer plat = shyVideos.getPlat();
  313 + String yuming = "";
  314 + if (plat == CommonConst.QINIU_PLAT) {
  315 + yuming = qn_domain + "/";
  316 + } else if (plat == CommonConst.KS_PLAT) {
  317 + yuming = ks_domain + "/";
  318 + }
  319 + String url = "";
  320 + JSONArray jsonArray = new JSONArray();
  321 + List<String> imgList = JSONArray.parseArray(shyVideos.getAvsample_imgs(), String.class);
  322 + for (String imgStr : imgList) {
  323 + String imgUrl = yuming + imgStr;
  324 + JSONObject image = new JSONObject();
  325 + String uuid = UUID.randomUUID().toString();
  326 + image.put("name", uuid);
  327 + image.put("type", 1);
  328 + image.put("data", imgUrl);
  329 + jsonArray.add(image);
  330 + url = url + "(" + uuid + ")";
  331 + }
  332 + //易盾返回结果的类型
  333 + String type = "";
  334 + //易盾失败结果的详情
  335 + String desc = "";
  336 + //调用易盾智能图片审核接口
  337 + JSONObject imagesFilter = YiDunAntiFraudUtil.getImagesFilter(jsonArray.toJSONString());
  338 + type = imagesFilter.getString("type");
  339 + desc = imagesFilter.getString("desc");
  340 + if (type.toLowerCase().equals(CommonConst.PASS)) {
  341 + shyVideos.setMsg(desc);
  342 + //修改点播云视频状态
  343 + videosService.updateDianboAndShenhe(shyVideos, 3);
  344 + } else if (type.toLowerCase().equals(CommonConst.REJECT)) {
  345 + //审核类型改为人工审核
  346 + shyVideos.setShenhe_type(CommonConst.AUDIT_TYPE_USER);
  347 + //拒绝原因
  348 + shyVideos.setMsg(desc);
  349 + videosService.updateshyVideos(shyVideos);
  350 + //videosService.updateDianboAndShenhe(shyVideos,4);
  351 + }
  352 + try {
  353 + ShyYidun shyYidun = new ShyYidun();
  354 + shyYidun.setId(UUID.randomUUID().toString());
  355 + shyYidun.setContent_id(cid.toString());
  356 + shyYidun.setUrl(url);
  357 + shyYidun.setDesc_msg(desc);
  358 + shyYidun.setDuration(shyVideos.getDuration());
  359 + shyYidun.setCreate_time(new Date());
  360 + yiDunServiceImpl.addYiDunMsg(shyYidun);
  361 + } catch (Exception e) {
  362 + e.printStackTrace();
  363 + }
  364 + return 0;
370 } 365 }
371 - 366 +
372 /** 367 /**
373 * 更新点播和审核的视频状态 368 * 更新点播和审核的视频状态
  369 + *
374 * @param video 370 * @param video
375 * @param dianboState 视频状态,3通过,4不通过 371 * @param dianboState 视频状态,3通过,4不通过
376 * @return 372 * @return
377 */ 373 */
378 - public int updateDianboAndShenhe(ShyVideos video,int dianboState) {  
379 - //修改点播云的视频状态  
380 - JSONObject result = Pass.auditPass(video.getVideo_id(), dianboState, video.getMsg(), video.getMsg(), video.getCallback());  
381 - Integer code = result.getInteger("code");  
382 - Integer shenheState=CommonConst.AUDIT_REFUSE;  
383 - if (0 == code) {  
384 - if(dianboState==3){  
385 - shenheState=CommonConst.AUDIT_SUCCESS;  
386 - }  
387 - //修改审核云的视频状态  
388 - int i = videosService.updateVideo(video.getId(), null,video.getUpdater(),"", shenheState, video.getMsg());  
389 - if (i != 1) { 374 + public int updateDianboAndShenhe(ShyVideos video, int dianboState) {
  375 + //修改点播云的视频状态
  376 + JSONObject result = Pass.auditPass(video.getVideo_id(), dianboState, video.getMsg(), video.getMsg(), video.getCallback());
  377 + Integer code = result.getInteger("code");
  378 + Integer shenheState = CommonConst.AUDIT_REFUSE;
  379 + if (0 == code) {
  380 + if (dianboState == 3) {
  381 + shenheState = CommonConst.AUDIT_SUCCESS;
  382 + }
  383 + //修改审核云的视频状态
  384 + int i = videosService.updateVideo(video.getId(), null, video.getUpdater(), "", shenheState, video.getMsg());
  385 + if (i != 1) {
390 logger.error("点播视频更改失败,activity_id:{}", video.getVideo_id()); 386 logger.error("点播视频更改失败,activity_id:{}", video.getVideo_id());
391 } 387 }
392 - return i;  
393 - } else {  
394 - video.setMsg("点播视频回调失败,"+video.getMsg());  
395 - videosService.updateVideo(video.getId(), null,video.getUpdater(),"", CommonConst.AUDIT_CALLBACK_FAIL, video.getMsg());  
396 - logger.error("点播视频回调失败,activity_id:{},code:{},msg:{}", video.getVideo_id(), code, result.getString("msg"));  
397 - }  
398 -  
399 - return 0;  
400 - } 388 + return i;
  389 + } else {
  390 + video.setMsg("点播视频回调失败," + video.getMsg());
  391 + videosService.updateVideo(video.getId(), null, video.getUpdater(), "", CommonConst.AUDIT_CALLBACK_FAIL, video.getMsg());
  392 + logger.error("点播视频回调失败,activity_id:{},code:{},msg:{}", video.getVideo_id(), code, result.getString("msg"));
  393 + }
  394 +
  395 + return 0;
  396 + }
401 397
402 398
403 /** 399 /**
@@ -445,37 +441,37 @@ public class VideosServiceImpl { @@ -445,37 +441,37 @@ public class VideosServiceImpl {
445 } 441 }
446 shyVideo.setShenhe_type(shenheType); 442 shyVideo.setShenhe_type(shenheType);
447 } 443 }
448 -  
449 -  
450 - public String repulse(String shyVideoId,String msg,String userId){  
451 - String showMsg="";  
452 - ShyVideos shyVideos = videosService.selectByPrimaryKey(Integer.parseInt(shyVideoId));  
453 - JSONObject result = null;  
454 - try {  
455 - result = Pass.auditPass(shyVideos.getVideo_id(), 4, msg, msg, shyVideos.getCallback());  
456 - } catch (Exception e) {  
457 - logger.error("视频审核失败,id==" + shyVideoId, e);  
458 - showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败";  
459 - return showMsg;  
460 - }  
461 - if (result == null) {  
462 - logger.error("视频审核失败且接口错误没有返回信息,id==" + shyVideoId);  
463 - showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败";  
464 - return showMsg;  
465 - }  
466 - Integer code = result.getInteger("code");  
467 - if (code != 0) {  
468 - logger.error("视频审核失败,id:{},code:{}", shyVideoId, code);  
469 - showMsg = showMsg + "," + shyVideos.getVideo_title() + " " + result.getString("msg");  
470 - return showMsg;  
471 - }  
472 - int i = videosService.updateVideo(Integer.parseInt(shyVideoId), userId,null,"", 2, msg);  
473 - if (i == 0) {  
474 - showMsg = showMsg + "," + shyVideos.getVideo_title() + " 更新失败";  
475 - return showMsg;  
476 - }  
477 -  
478 - return showMsg;  
479 - } 444 +
  445 +
  446 + public String repulse(String shyVideoId, String msg, String userId) {
  447 + String showMsg = "";
  448 + ShyVideos shyVideos = videosService.selectByPrimaryKey(Integer.parseInt(shyVideoId));
  449 + JSONObject result = null;
  450 + try {
  451 + result = Pass.auditPass(shyVideos.getVideo_id(), 4, msg, msg, shyVideos.getCallback());
  452 + } catch (Exception e) {
  453 + logger.error("视频审核失败,id==" + shyVideoId, e);
  454 + showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败";
  455 + return showMsg;
  456 + }
  457 + if (result == null) {
  458 + logger.error("视频审核失败且接口错误没有返回信息,id==" + shyVideoId);
  459 + showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败";
  460 + return showMsg;
  461 + }
  462 + Integer code = result.getInteger("code");
  463 + if (code != 0) {
  464 + logger.error("视频审核失败,id:{},code:{}", shyVideoId, code);
  465 + showMsg = showMsg + "," + shyVideos.getVideo_title() + " " + result.getString("msg");
  466 + return showMsg;
  467 + }
  468 + int i = videosService.updateVideo(Integer.parseInt(shyVideoId), userId, null, "", 2, msg);
  469 + if (i == 0) {
  470 + showMsg = showMsg + "," + shyVideos.getVideo_title() + " 更新失败";
  471 + return showMsg;
  472 + }
  473 +
  474 + return showMsg;
  475 + }
480 476
481 } 477 }
src/main/java/com/cnlive/shenhe/utils/YiDunAntiFraudUtil.java
@@ -82,24 +82,24 @@ public class YiDunAntiFraudUtil { @@ -82,24 +82,24 @@ public class YiDunAntiFraudUtil {
82 //getTextFilter("王八蛋"); 82 //getTextFilter("王八蛋");
83 83
84 //智能图片识别审核测试 84 //智能图片识别审核测试
85 - /*JSONArray jsonArray = new JSONArray(); 85 + JSONArray jsonArray = new JSONArray();
86 JSONObject image1 = new JSONObject(); 86 JSONObject image1 = new JSONObject();
87 - image1.put("name", "http://article-bj.bj.bcebos.com//20200326/7f3d23bbb28421e6e2a6f131273554fb_15.jpg?authorization=bce-auth-v1%2F1eda661c3697440eaaca912ccb6f959c%2F2020-03-30T05%3A42%3A21Z%2F604800%2F%2F39f195e2327ef87270bd095fa64dfdcadad6f01a0d6dc6a4313306f164591cc5"); 87 + image1.put("name", UUID.randomUUID());
88 image1.put("type", 1); 88 image1.put("type", 1);
89 image1.put("data", "http://article-bj.bj.bcebos.com//20200326/7f3d23bbb28421e6e2a6f131273554fb_15.jpg?authorization=bce-auth-v1%2F1eda661c3697440eaaca912ccb6f959c%2F2020-03-30T05%3A42%3A21Z%2F604800%2F%2F39f195e2327ef87270bd095fa64dfdcadad6f01a0d6dc6a4313306f164591cc5"); 89 image1.put("data", "http://article-bj.bj.bcebos.com//20200326/7f3d23bbb28421e6e2a6f131273554fb_15.jpg?authorization=bce-auth-v1%2F1eda661c3697440eaaca912ccb6f959c%2F2020-03-30T05%3A42%3A21Z%2F604800%2F%2F39f195e2327ef87270bd095fa64dfdcadad6f01a0d6dc6a4313306f164591cc5");
90 jsonArray.add(image1); 90 jsonArray.add(image1);
91 JSONObject image2 = new JSONObject(); 91 JSONObject image2 = new JSONObject();
92 - image2.put("name", "http://test.qnvod.cnlive.com/shen/802/2020/03/01/8a8a878c6dce5cfe017096cd07940c84/000002.jpg"); 92 + image2.put("name", UUID.randomUUID());
93 image2.put("type", 1); 93 image2.put("type", 1);
94 image2.put("data", "http://test.qnvod.cnlive.com/shen/802/2020/03/01/8a8a878c6dce5cfe017096cd07940c84/000002.jpg"); 94 image2.put("data", "http://test.qnvod.cnlive.com/shen/802/2020/03/01/8a8a878c6dce5cfe017096cd07940c84/000002.jpg");
95 jsonArray.add(image2); 95 jsonArray.add(image2);
96 JSONObject image3 = new JSONObject(); 96 JSONObject image3 = new JSONObject();
97 - image3.put("name", "https://wjj.ys2.cnliveimg.com/769/img/0/2020/03/21/158474856886077030277.jpg"); 97 + image3.put("name", UUID.randomUUID());
98 image3.put("type", 1); 98 image3.put("type", 1);
99 image3.put("data", "https://wjj.ys2.cnliveimg.com/769/img/0/2020/03/21/158474856886077030277.jpg"); 99 image3.put("data", "https://wjj.ys2.cnliveimg.com/769/img/0/2020/03/21/158474856886077030277.jpg");
100 jsonArray.add(image3); 100 jsonArray.add(image3);
101 // 101 //
102 - getImagesFilter(jsonArray.toJSONString());*/ 102 + getImagesFilter(jsonArray.toJSONString());
103 103
104 } 104 }
105 105