Commit abf850675e362c91a836ef0b8faa138cdda9f5e3
1 parent
c3927772
网页内容送审易盾审核
Showing
12 changed files
with
211 additions
and
134 deletions
src/main/java/com/cnlive/shenhe/api/AudioControllerApi.java
| @@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONObject; | @@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONObject; | ||
| 5 | import com.cnlive.shenhe.bean.ErrorEnum; | 5 | import com.cnlive.shenhe.bean.ErrorEnum; |
| 6 | import com.cnlive.shenhe.bean.ResponseBean; | 6 | import com.cnlive.shenhe.bean.ResponseBean; |
| 7 | import com.cnlive.shenhe.entity.ShyAudio; | 7 | import com.cnlive.shenhe.entity.ShyAudio; |
| 8 | -import com.cnlive.shenhe.entity.ShyContent; | ||
| 9 | import com.cnlive.shenhe.entity.ShyYidun; | 8 | import com.cnlive.shenhe.entity.ShyYidun; |
| 10 | import com.cnlive.shenhe.enums.TextLabels; | 9 | import com.cnlive.shenhe.enums.TextLabels; |
| 11 | import com.cnlive.shenhe.serviceImpl.AudioServiceImpl; | 10 | import com.cnlive.shenhe.serviceImpl.AudioServiceImpl; |
| @@ -14,20 +13,15 @@ import com.cnlive.shenhe.utils.AuditPass; | @@ -14,20 +13,15 @@ import com.cnlive.shenhe.utils.AuditPass; | ||
| 14 | import com.cnlive.shenhe.utils.CommonConst; | 13 | import com.cnlive.shenhe.utils.CommonConst; |
| 15 | import com.cnlive.shenhe.utils.YiDunAntiFraudUtil; | 14 | import com.cnlive.shenhe.utils.YiDunAntiFraudUtil; |
| 16 | import com.google.common.collect.EvictingQueue; | 15 | import com.google.common.collect.EvictingQueue; |
| 17 | -import com.google.common.collect.Maps; | ||
| 18 | -import org.apache.commons.lang3.StringUtils; | ||
| 19 | import org.slf4j.Logger; | 16 | import org.slf4j.Logger; |
| 20 | import org.slf4j.LoggerFactory; | 17 | import org.slf4j.LoggerFactory; |
| 21 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 22 | import org.springframework.stereotype.Controller; | 19 | import org.springframework.stereotype.Controller; |
| 23 | import org.springframework.web.bind.annotation.PostMapping; | 20 | import org.springframework.web.bind.annotation.PostMapping; |
| 24 | -import org.springframework.web.bind.annotation.RequestBody; | ||
| 25 | import org.springframework.web.bind.annotation.RequestMapping; | 21 | import org.springframework.web.bind.annotation.RequestMapping; |
| 26 | import org.springframework.web.bind.annotation.ResponseBody; | 22 | import org.springframework.web.bind.annotation.ResponseBody; |
| 27 | 23 | ||
| 28 | import java.util.Date; | 24 | import java.util.Date; |
| 29 | -import java.util.HashMap; | ||
| 30 | -import java.util.Map; | ||
| 31 | 25 | ||
| 32 | /** | 26 | /** |
| 33 | * @Author: xujincheng | 27 | * @Author: xujincheng |
| @@ -143,6 +137,7 @@ public class AudioControllerApi { | @@ -143,6 +137,7 @@ public class AudioControllerApi { | ||
| 143 | newshyAudio.setId(shyAudio.getId()); | 137 | newshyAudio.setId(shyAudio.getId()); |
| 144 | if (action == 0 && asrStatus == 3) { | 138 | if (action == 0 && asrStatus == 3) { |
| 145 | newYiDunMsg.setDesc_msg("易盾点播音频审核通过了"); | 139 | newYiDunMsg.setDesc_msg("易盾点播音频审核通过了"); |
| 140 | + newYiDunMsg.setCheck_status(0); | ||
| 146 | newshyAudio.setMsg("易盾点播音频审核通过了"); | 141 | newshyAudio.setMsg("易盾点播音频审核通过了"); |
| 147 | newshyAudio.setUploader("机审通过"); | 142 | newshyAudio.setUploader("机审通过"); |
| 148 | newshyAudio.setState(1); | 143 | newshyAudio.setState(1); |
| @@ -176,6 +171,8 @@ public class AudioControllerApi { | @@ -176,6 +171,8 @@ public class AudioControllerApi { | ||
| 176 | newshyAudio.setState(0); | 171 | newshyAudio.setState(0); |
| 177 | newshyAudio.setShenhe_type(CommonConst.AUDIT_TYPE_USER); | 172 | newshyAudio.setShenhe_type(CommonConst.AUDIT_TYPE_USER); |
| 178 | newshyAudio.setReceive(CommonConst.RECEIVE_BEFORE); | 173 | newshyAudio.setReceive(CommonConst.RECEIVE_BEFORE); |
| 174 | + //审核失败 | ||
| 175 | + newYiDunMsg.setCheck_status(2); | ||
| 179 | } | 176 | } |
| 180 | newYiDunMsg.setResult_type(String.valueOf(action)); | 177 | newYiDunMsg.setResult_type(String.valueOf(action)); |
| 181 | } catch (NumberFormatException e) { | 178 | } catch (NumberFormatException e) { |
src/main/java/com/cnlive/shenhe/api/ContentControllerApi.java
| @@ -101,7 +101,7 @@ public class ContentControllerApi { | @@ -101,7 +101,7 @@ public class ContentControllerApi { | ||
| 101 | return new ResponseBean(ErrorEnum.ERROR); | 101 | return new ResponseBean(ErrorEnum.ERROR); |
| 102 | } | 102 | } |
| 103 | } | 103 | } |
| 104 | - return saveContent(json, shyContent, shenheType, newContentTag); | 104 | + return saveContent(json, shyContent, shenheType); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | /** | 107 | /** |
| @@ -112,7 +112,7 @@ public class ContentControllerApi { | @@ -112,7 +112,7 @@ public class ContentControllerApi { | ||
| 112 | * @param shenheType | 112 | * @param shenheType |
| 113 | * @return | 113 | * @return |
| 114 | */ | 114 | */ |
| 115 | - private ResponseBean saveContent(JSONObject json, ShyContent shyContent, Integer shenheType, String contentTag) { | 115 | + private ResponseBean saveContent(JSONObject json, ShyContent shyContent, Integer shenheType) { |
| 116 | //如果不存在直接插入 | 116 | //如果不存在直接插入 |
| 117 | //标题 | 117 | //标题 |
| 118 | shyContent.setTitle(json.getString("title")); | 118 | shyContent.setTitle(json.getString("title")); |
| @@ -135,7 +135,8 @@ public class ContentControllerApi { | @@ -135,7 +135,8 @@ public class ContentControllerApi { | ||
| 135 | shyContent.setContent_time(timestamp); | 135 | shyContent.setContent_time(timestamp); |
| 136 | 136 | ||
| 137 | } | 137 | } |
| 138 | - shyContent.setContent_tag(contentTag); | 138 | + String contentTag = json.getString("content_tag"); |
| 139 | + shyContent.setContent_tag(StringUtils.isEmpty(contentTag) ? "content" : contentTag); | ||
| 139 | 140 | ||
| 140 | shyContent.setCreate_date(CommonUtils.getCurrentTime()); | 141 | shyContent.setCreate_date(CommonUtils.getCurrentTime()); |
| 141 | //回调地址 | 142 | //回调地址 |
src/main/java/com/cnlive/shenhe/api/YiDunControllerApi.java
| @@ -72,7 +72,6 @@ public class YiDunControllerApi { | @@ -72,7 +72,6 @@ public class YiDunControllerApi { | ||
| 72 | params.put("signature", signature); | 72 | params.put("signature", signature); |
| 73 | 73 | ||
| 74 | // 4.发送HTTP请求 | 74 | // 4.发送HTTP请求 |
| 75 | - //String response = HttpClient4Utils.sendPost(httpClient, API_URL, params, Consts.UTF_8); | ||
| 76 | String s = HttpClientUtils.post_str(URL_SUBMIT, params); | 75 | String s = HttpClientUtils.post_str(URL_SUBMIT, params); |
| 77 | logger.info("向易盾提交网站检测地址返回的结果:{}", s); | 76 | logger.info("向易盾提交网站检测地址返回的结果:{}", s); |
| 78 | JSONObject jsonObject = JSONObject.parseObject(s); | 77 | JSONObject jsonObject = JSONObject.parseObject(s); |
| @@ -81,8 +80,13 @@ public class YiDunControllerApi { | @@ -81,8 +80,13 @@ public class YiDunControllerApi { | ||
| 81 | if (code == 200 && "ok".equals(msg)) { | 80 | if (code == 200 && "ok".equals(msg)) { |
| 82 | JSONObject result = jsonObject.getJSONObject("result"); | 81 | JSONObject result = jsonObject.getJSONObject("result"); |
| 83 | String dataId = result.getString("dataId"); | 82 | String dataId = result.getString("dataId"); |
| 83 | + String taskId = result.getString("taskId"); | ||
| 84 | ShyYidun shyYidun = new ShyYidun(); | 84 | ShyYidun shyYidun = new ShyYidun(); |
| 85 | shyYidun.setId(dataId); | 85 | shyYidun.setId(dataId); |
| 86 | + shyYidun.setTask_id(taskId); | ||
| 87 | + shyYidun.setData_id(dataId); | ||
| 88 | + //网页 | ||
| 89 | + shyYidun.setCheck_type(3); | ||
| 86 | shyYidun.setCreate_time(new Date()); | 90 | shyYidun.setCreate_time(new Date()); |
| 87 | yiDunServiceImpl.addYiDunMsg(shyYidun); | 91 | yiDunServiceImpl.addYiDunMsg(shyYidun); |
| 88 | } | 92 | } |
src/main/java/com/cnlive/shenhe/entity/ShyYidun.java
| 1 | package com.cnlive.shenhe.entity; | 1 | package com.cnlive.shenhe.entity; |
| 2 | 2 | ||
| 3 | +import javax.persistence.Id; | ||
| 4 | +import javax.persistence.Table; | ||
| 3 | import java.util.Date; | 5 | import java.util.Date; |
| 4 | -import javax.persistence.*; | ||
| 5 | 6 | ||
| 6 | @Table(name = "shy_yidun") | 7 | @Table(name = "shy_yidun") |
| 7 | public class ShyYidun { | 8 | public class ShyYidun { |
| @@ -191,17 +192,59 @@ public class ShyYidun { | @@ -191,17 +192,59 @@ public class ShyYidun { | ||
| 191 | this.update_time = update_time; | 192 | this.update_time = update_time; |
| 192 | } | 193 | } |
| 193 | 194 | ||
| 194 | - public ShyYidun() { | 195 | + private String task_id; |
| 196 | + private String data_id; | ||
| 197 | + private Integer check_type; | ||
| 198 | + private Integer check_status; | ||
| 199 | + | ||
| 200 | + public String getTask_id() { | ||
| 201 | + return task_id; | ||
| 195 | } | 202 | } |
| 196 | 203 | ||
| 197 | - public ShyYidun(String id, String content_id, String url, String result_type, String desc_msg, Integer duration, Date create_time, Date update_time) { | ||
| 198 | - this.id = id; | ||
| 199 | - this.content_id = content_id; | ||
| 200 | - this.url = url; | ||
| 201 | - this.result_type = result_type; | ||
| 202 | - this.desc_msg = desc_msg; | ||
| 203 | - this.duration = duration; | ||
| 204 | - this.create_time = create_time; | ||
| 205 | - this.update_time = update_time; | 204 | + public void setTask_id(String task_id) { |
| 205 | + this.task_id = task_id; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + public Integer getCheck_type() { | ||
| 209 | + return check_type; | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + public void setCheck_type(Integer check_type) { | ||
| 213 | + this.check_type = check_type; | ||
| 206 | } | 214 | } |
| 215 | + | ||
| 216 | + public Integer getCheck_status() { | ||
| 217 | + return check_status; | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + public void setCheck_status(Integer check_status) { | ||
| 221 | + this.check_status = check_status; | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + public String getData_id() { | ||
| 225 | + return data_id; | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + public void setData_id(String data_id) { | ||
| 229 | + this.data_id = data_id; | ||
| 230 | + } | ||
| 231 | + | ||
| 232 | + | ||
| 233 | + public ShyYidun() { | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | +// public ShyYidun(String id, String content_id, String url, String result_type, String desc_msg, Integer duration, Date create_time, Date update_time | ||
| 237 | +// , Integer check_type, String task_id) { | ||
| 238 | +// this.id = id; | ||
| 239 | +// this.content_id = content_id; | ||
| 240 | +// this.url = url; | ||
| 241 | +// this.result_type = result_type; | ||
| 242 | +// this.desc_msg = desc_msg; | ||
| 243 | +// this.duration = duration; | ||
| 244 | +// this.create_time = create_time; | ||
| 245 | +// this.update_time = update_time; | ||
| 246 | +// this.check_type = check_type; | ||
| 247 | +// this.task_id = task_id; | ||
| 248 | +// } | ||
| 249 | + | ||
| 207 | } | 250 | } |
| 208 | \ No newline at end of file | 251 | \ No newline at end of file |
src/main/java/com/cnlive/shenhe/job/AudioJob.java
| @@ -63,13 +63,15 @@ public class AudioJob { | @@ -63,13 +63,15 @@ public class AudioJob { | ||
| 63 | List<ShyAudio> shyAudioList = audioService.findshyAudio(shyAudio); | 63 | List<ShyAudio> shyAudioList = audioService.findshyAudio(shyAudio); |
| 64 | if (shyAudioList != null && shyAudioList.size() > 0) { | 64 | if (shyAudioList != null && shyAudioList.size() > 0) { |
| 65 | for (ShyAudio audio : shyAudioList) { | 65 | for (ShyAudio audio : shyAudioList) { |
| 66 | - ShyYidun shyYidun = new ShyYidun(); | ||
| 67 | - shyYidun.setContent_id(audio.getId().toString()); | ||
| 68 | - ShyYidun shyYidun1 = yiDunServiceImpl.getidunMsgByContentId(shyYidun); | ||
| 69 | - if (shyYidun1 == null) { | ||
| 70 | - logger.info("定时向易盾发送点播音频检测视频的audioId:" + audio.getAudioId()); | ||
| 71 | - audioService.audioFilter(audio); | ||
| 72 | - } | 66 | +// ShyYidun shyYidun = new ShyYidun(); |
| 67 | +// shyYidun.setContent_id(audio.getId().toString()); | ||
| 68 | +// //点播视频 | ||
| 69 | +// shyYidun.setCheck_type(4); | ||
| 70 | +// ShyYidun shyYidun1 = yiDunServiceImpl.getidunMsgByContentId(shyYidun); | ||
| 71 | +// if (shyYidun1 == null) { | ||
| 72 | + logger.info("定时向易盾发送点播音频检测视频的audioId:" + audio.getAudioId()); | ||
| 73 | + audioService.audioFilter(audio); | ||
| 74 | +// } | ||
| 73 | } | 75 | } |
| 74 | } | 76 | } |
| 75 | } | 77 | } |
src/main/java/com/cnlive/shenhe/job/ContentJob.java
| 1 | package com.cnlive.shenhe.job; | 1 | package com.cnlive.shenhe.job; |
| 2 | 2 | ||
| 3 | import com.cnlive.shenhe.entity.ShyContent; | 3 | import com.cnlive.shenhe.entity.ShyContent; |
| 4 | -import com.cnlive.shenhe.entity.ShyYidun; | ||
| 5 | import com.cnlive.shenhe.serviceImpl.ContentServiceImpl; | 4 | import com.cnlive.shenhe.serviceImpl.ContentServiceImpl; |
| 6 | import com.cnlive.shenhe.serviceImpl.YiDunServiceImpl; | 5 | import com.cnlive.shenhe.serviceImpl.YiDunServiceImpl; |
| 7 | import com.cnlive.shenhe.utils.CommonConst; | 6 | import com.cnlive.shenhe.utils.CommonConst; |
| @@ -23,9 +22,6 @@ public class ContentJob { | @@ -23,9 +22,6 @@ public class ContentJob { | ||
| 23 | private static Logger logger = LoggerFactory.getLogger(ContentJob.class); | 22 | private static Logger logger = LoggerFactory.getLogger(ContentJob.class); |
| 24 | @Autowired | 23 | @Autowired |
| 25 | ContentServiceImpl contentService; | 24 | ContentServiceImpl contentService; |
| 26 | - @Autowired | ||
| 27 | - YiDunServiceImpl yiDunServiceImpl; | ||
| 28 | - | ||
| 29 | 25 | ||
| 30 | /** | 26 | /** |
| 31 | * 白名单sp图文通过 | 27 | * 白名单sp图文通过 |
| @@ -52,25 +48,23 @@ public class ContentJob { | @@ -52,25 +48,23 @@ public class ContentJob { | ||
| 52 | * 定时向易盾提交网站地址 | 48 | * 定时向易盾提交网站地址 |
| 53 | * //每分钟一次 | 49 | * //每分钟一次 |
| 54 | */ | 50 | */ |
| 55 | - @Scheduled(cron = "0 0/1 * * * ? ") | 51 | + @Scheduled(cron = "0 0/5 * * * ? ") |
| 56 | public void videofilter() { | 52 | public void videofilter() { |
| 57 | - logger.info("提交网页审核到易盾..........."); | ||
| 58 | - ShyContent shyContent = new ShyContent(); | ||
| 59 | - //机审 | ||
| 60 | - shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_MACHANE); | ||
| 61 | - //待审 | ||
| 62 | - shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE); | ||
| 63 | - | ||
| 64 | - List<ShyContent> shyContentList = contentService.findshyContent(shyContent); | 53 | + logger.info("审核云提交网页审核到易盾..........."); |
| 54 | + List<ShyContent> shyContentList = contentService.findShyContentWithWebPage(); | ||
| 65 | if (shyContentList != null && shyContentList.size() > 0) { | 55 | if (shyContentList != null && shyContentList.size() > 0) { |
| 56 | + logger.info("审核云提交网页审核到易盾数据个数:{}", shyContentList.size()); | ||
| 66 | for (ShyContent content : shyContentList) { | 57 | for (ShyContent content : shyContentList) { |
| 67 | //易盾网站过滤 | 58 | //易盾网站过滤 |
| 68 | - ShyYidun shyYidun = new ShyYidun(); | ||
| 69 | - shyYidun.setContent_id(content.getId().toString()); | ||
| 70 | - ShyYidun shyYidun1 = yiDunServiceImpl.getidunMsgByContentId(shyYidun); | ||
| 71 | - if (shyYidun1 == null) { | ||
| 72 | - contentService.contentFilter(content); | ||
| 73 | - } | 59 | +// ShyYidun shyYidun = new ShyYidun(); |
| 60 | +// shyYidun.setContent_id(content.getId().toString()); | ||
| 61 | +// //网页类型 | ||
| 62 | +// shyYidun.setCheck_type(3); | ||
| 63 | +// ShyYidun shyYidun1 = yiDunServiceImpl.getidunMsgByContentId(shyYidun); | ||
| 64 | +// logger.info("审核云ShyYidun表里不为空提交网页审核到易盾单条数据:{}", JSON.toJSONString(content)); | ||
| 65 | +// if (shyYidun1 == null) { | ||
| 66 | + contentService.contentFilter(content); | ||
| 67 | +// } | ||
| 74 | } | 68 | } |
| 75 | } | 69 | } |
| 76 | } | 70 | } |
src/main/java/com/cnlive/shenhe/job/VideosJob.java
| 1 | package com.cnlive.shenhe.job; | 1 | package com.cnlive.shenhe.job; |
| 2 | 2 | ||
| 3 | import com.cnlive.shenhe.entity.ShyVideos; | 3 | import com.cnlive.shenhe.entity.ShyVideos; |
| 4 | +import com.cnlive.shenhe.entity.ShyYidun; | ||
| 4 | import com.cnlive.shenhe.serviceImpl.VideosServiceImpl; | 5 | import com.cnlive.shenhe.serviceImpl.VideosServiceImpl; |
| 6 | +import com.cnlive.shenhe.serviceImpl.YiDunServiceImpl; | ||
| 5 | import com.cnlive.shenhe.utils.CommonConst; | 7 | import com.cnlive.shenhe.utils.CommonConst; |
| 6 | import org.slf4j.Logger; | 8 | import org.slf4j.Logger; |
| 7 | import org.slf4j.LoggerFactory; | 9 | import org.slf4j.LoggerFactory; |
| @@ -17,6 +19,9 @@ public class VideosJob { | @@ -17,6 +19,9 @@ public class VideosJob { | ||
| 17 | @Autowired | 19 | @Autowired |
| 18 | VideosServiceImpl videosService; | 20 | VideosServiceImpl videosService; |
| 19 | 21 | ||
| 22 | + @Autowired | ||
| 23 | + YiDunServiceImpl yiDunServiceImpl; | ||
| 24 | + | ||
| 20 | /** | 25 | /** |
| 21 | * 白名单sp视频通过 | 26 | * 白名单sp视频通过 |
| 22 | */ | 27 | */ |
| @@ -37,21 +42,32 @@ public class VideosJob { | @@ -37,21 +42,32 @@ public class VideosJob { | ||
| 37 | } | 42 | } |
| 38 | 43 | ||
| 39 | /** | 44 | /** |
| 40 | - * 定时向易盾发送视频进行检测 | 45 | + * 定时向易盾发送视频抽帧图片进行检测 |
| 41 | */ | 46 | */ |
| 42 | @Scheduled(cron = "0 0/1 10-23 * * ? ")//每天10点到23点执行,每分钟一次 | 47 | @Scheduled(cron = "0 0/1 10-23 * * ? ")//每天10点到23点执行,每分钟一次 |
| 43 | public void videofilter() { | 48 | public void videofilter() { |
| 44 | ShyVideos shyVideos = new ShyVideos(); | 49 | ShyVideos shyVideos = new ShyVideos(); |
| 45 | - shyVideos.setShenhe_type(CommonConst.AUDIT_TYPE_MACHANE);//审核类型为机审 | ||
| 46 | - shyVideos.setState(CommonConst.AUDIT_INTT);//待审核状态 | ||
| 47 | - shyVideos.setAvsample(CommonConst.AVSAMPLE_SUCCESS);//抽帧完成 | 50 | + //审核类型为机审 |
| 51 | + shyVideos.setShenhe_type(CommonConst.AUDIT_TYPE_MACHANE); | ||
| 52 | + //待审核状态 | ||
| 53 | + shyVideos.setState(CommonConst.AUDIT_INTT); | ||
| 54 | + //抽帧完成 | ||
| 55 | + shyVideos.setAvsample(CommonConst.AVSAMPLE_SUCCESS); | ||
| 48 | List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos); | 56 | List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos); |
| 49 | if (shyVideosList != null && shyVideosList.size() > 0) { | 57 | if (shyVideosList != null && shyVideosList.size() > 0) { |
| 50 | for (ShyVideos video : shyVideosList) { | 58 | for (ShyVideos video : shyVideosList) { |
| 51 | - logger.info("定时向易盾发送检测视频的videos_id:" + video.getId()); | 59 | + logger.info("定时向易盾发送检测视频的videos_id:{}", video.getId()); |
| 52 | //易盾图片过滤 | 60 | //易盾图片过滤 |
| 61 | +// ShyYidun shyYidun = new ShyYidun(); | ||
| 62 | +// //点播视频 | ||
| 63 | +// shyYidun.setContent_id(video.getId().toString()); | ||
| 64 | +// //图片类型 | ||
| 65 | +// shyYidun.setCheck_type(2); | ||
| 66 | +// ShyYidun shyYidun1 = yiDunServiceImpl.getidunMsgByContentId(shyYidun); | ||
| 67 | +// if (shyYidun1 == null) { | ||
| 68 | + logger.info("审核云定时向易盾发送视频抽帧图片检测:{}", video.getVideo_id()); | ||
| 53 | videosService.videoFilter(video.getId()); | 69 | videosService.videoFilter(video.getId()); |
| 54 | - | 70 | +// } |
| 55 | } | 71 | } |
| 56 | } | 72 | } |
| 57 | } | 73 | } |
| @@ -64,13 +80,16 @@ public class VideosJob { | @@ -64,13 +80,16 @@ public class VideosJob { | ||
| 64 | public void autoRetReceive() { | 80 | public void autoRetReceive() { |
| 65 | logger.info("点播自动退领的进入....."); | 81 | logger.info("点播自动退领的进入....."); |
| 66 | ShyVideos shyVideos = new ShyVideos(); | 82 | ShyVideos shyVideos = new ShyVideos(); |
| 67 | - shyVideos.setState(CommonConst.AUDIT_INTT);//审核状态:未审核 | ||
| 68 | - shyVideos.setReceive(CommonConst.RECEIVE_AFTER);//已领取 | 83 | + //审核状态:未审核 |
| 84 | + shyVideos.setState(CommonConst.AUDIT_INTT); | ||
| 85 | + //已领取 | ||
| 86 | + shyVideos.setReceive(CommonConst.RECEIVE_AFTER); | ||
| 69 | List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos); | 87 | List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos); |
| 70 | if (shyVideosList.size() > 0) { | 88 | if (shyVideosList.size() > 0) { |
| 71 | for (ShyVideos shyVideos2 : shyVideosList) { | 89 | for (ShyVideos shyVideos2 : shyVideosList) { |
| 72 | logger.info("自动退领的videos_id:" + shyVideos2.getId()); | 90 | logger.info("自动退领的videos_id:" + shyVideos2.getId()); |
| 73 | - shyVideos2.setReceive(CommonConst.RECEIVE_BEFORE);//未领取 | 91 | + //未领取 |
| 92 | + shyVideos2.setReceive(CommonConst.RECEIVE_BEFORE); | ||
| 74 | shyVideos2.setReceive_user_id(null); | 93 | shyVideos2.setReceive_user_id(null); |
| 75 | videosService.updateshyVideos(shyVideos2); | 94 | videosService.updateshyVideos(shyVideos2); |
| 76 | } | 95 | } |
src/main/java/com/cnlive/shenhe/job/YiDunUrlResultJob.java
| @@ -23,7 +23,7 @@ import java.util.Map; | @@ -23,7 +23,7 @@ import java.util.Map; | ||
| 23 | import java.util.Random; | 23 | import java.util.Random; |
| 24 | 24 | ||
| 25 | /** | 25 | /** |
| 26 | - * 易盾网站检测 | 26 | + * 易盾网站检测定时拉取检测结果 |
| 27 | * | 27 | * |
| 28 | * @Author: xujincheng | 28 | * @Author: xujincheng |
| 29 | * @Date: 2020/3/23 15:16 | 29 | * @Date: 2020/3/23 15:16 |
| @@ -56,10 +56,10 @@ public class YiDunUrlResultJob { | @@ -56,10 +56,10 @@ public class YiDunUrlResultJob { | ||
| 56 | /** | 56 | /** |
| 57 | * 定时查询易盾网站检测结果接口 | 57 | * 定时查询易盾网站检测结果接口 |
| 58 | */ | 58 | */ |
| 59 | - @Scheduled(cron = "0 0/5 * * * ? ")//每5分钟一次 | 59 | + @Scheduled(cron = "0 0/1 * * * ? ")//每分钟一次 |
| 60 | public void YiDunUrl() { | 60 | public void YiDunUrl() { |
| 61 | try { | 61 | try { |
| 62 | - Map<String, String> params = new HashMap<String, String>(5); | 62 | + Map<String, String> params = new HashMap<>(5); |
| 63 | // 1.设置公共参数 | 63 | // 1.设置公共参数 |
| 64 | params.put("secretId", SECRETID); | 64 | params.put("secretId", SECRETID); |
| 65 | params.put("version", "v1.0"); | 65 | params.put("version", "v1.0"); |
| @@ -72,7 +72,7 @@ public class YiDunUrlResultJob { | @@ -72,7 +72,7 @@ public class YiDunUrlResultJob { | ||
| 72 | 72 | ||
| 73 | // 3.发送HTTP请求 | 73 | // 3.发送HTTP请求 |
| 74 | String s1 = HttpClientUtils.post_str(URL_RESULT, params); | 74 | String s1 = HttpClientUtils.post_str(URL_RESULT, params); |
| 75 | - logger.info("查询易盾网站检测结果:{}", s1); | 75 | + logger.info("审核云查询易盾网站检测结果:{}", s1); |
| 76 | 76 | ||
| 77 | // 4.解析接口返回值 | 77 | // 4.解析接口返回值 |
| 78 | JSONObject resultObject = JSONObject.parseObject(s1); | 78 | JSONObject resultObject = JSONObject.parseObject(s1); |
| @@ -104,8 +104,10 @@ public class YiDunUrlResultJob { | @@ -104,8 +104,10 @@ public class YiDunUrlResultJob { | ||
| 104 | shyContent.setReceive_status(2); | 104 | shyContent.setReceive_status(2); |
| 105 | shyContent.setShenhe_msg(desc); | 105 | shyContent.setShenhe_msg(desc); |
| 106 | newYiDunMsg.setDesc_msg(desc); | 106 | newYiDunMsg.setDesc_msg(desc); |
| 107 | + newYiDunMsg.setCheck_status(0); | ||
| 107 | //修改图文状态 | 108 | //修改图文状态 |
| 108 | contentServiceImpl.callback(yiDunMsg.getContent_id(), desc, CommonConst.AUDIT_SUCCESS, "", "机审通过"); | 109 | contentServiceImpl.callback(yiDunMsg.getContent_id(), desc, CommonConst.AUDIT_SUCCESS, "", "机审通过"); |
| 110 | + logger.info("审核云结果回调业务对接方:dataId={}", dataId); | ||
| 109 | } else { | 111 | } else { |
| 110 | JSONObject evidences = jsonObject.getJSONObject("evidences"); | 112 | JSONObject evidences = jsonObject.getJSONObject("evidences"); |
| 111 | JSONArray texts = evidences.getJSONArray("texts"); | 113 | JSONArray texts = evidences.getJSONArray("texts"); |
| @@ -177,6 +179,7 @@ public class YiDunUrlResultJob { | @@ -177,6 +179,7 @@ public class YiDunUrlResultJob { | ||
| 177 | shyContent.setReceive_status(3); | 179 | shyContent.setReceive_status(3); |
| 178 | shyContent.setShenhe_msg(desc); | 180 | shyContent.setShenhe_msg(desc); |
| 179 | newYiDunMsg.setDesc_msg(desc); | 181 | newYiDunMsg.setDesc_msg(desc); |
| 182 | + newYiDunMsg.setCheck_status(2); | ||
| 180 | } | 183 | } |
| 181 | } catch (NumberFormatException e) { | 184 | } catch (NumberFormatException e) { |
| 182 | e.printStackTrace(); | 185 | e.printStackTrace(); |
src/main/java/com/cnlive/shenhe/serviceImpl/AudioServiceImpl.java
| @@ -351,7 +351,7 @@ public class AudioServiceImpl { | @@ -351,7 +351,7 @@ public class AudioServiceImpl { | ||
| 351 | * 易盾点播音频过滤 | 351 | * 易盾点播音频过滤 |
| 352 | * | 352 | * |
| 353 | * @param shyAudio | 353 | * @param shyAudio |
| 354 | - * @return | 354 | + * @return 1:文本 2:图片 3.网页 4:点播音频 |
| 355 | */ | 355 | */ |
| 356 | public void audioFilter(ShyAudio shyAudio) { | 356 | public void audioFilter(ShyAudio shyAudio) { |
| 357 | //调用易盾点播音频检测接口 | 357 | //调用易盾点播音频检测接口 |
| @@ -359,11 +359,15 @@ public class AudioServiceImpl { | @@ -359,11 +359,15 @@ public class AudioServiceImpl { | ||
| 359 | if (jsonObject != null) { | 359 | if (jsonObject != null) { |
| 360 | JSONObject result = jsonObject.getJSONObject("result"); | 360 | JSONObject result = jsonObject.getJSONObject("result"); |
| 361 | String taskId = result.getString("taskId"); | 361 | String taskId = result.getString("taskId"); |
| 362 | + String dataId = result.getString("dataId"); | ||
| 362 | ShyYidun shyYidun = new ShyYidun(); | 363 | ShyYidun shyYidun = new ShyYidun(); |
| 363 | shyYidun.setId(taskId); | 364 | shyYidun.setId(taskId); |
| 364 | shyYidun.setUrl(shyAudio.getAudioUrl()); | 365 | shyYidun.setUrl(shyAudio.getAudioUrl()); |
| 365 | shyYidun.setContent_id(shyAudio.getId().toString()); | 366 | shyYidun.setContent_id(shyAudio.getId().toString()); |
| 366 | shyYidun.setCreate_time(new Date()); | 367 | shyYidun.setCreate_time(new Date()); |
| 368 | + shyYidun.setTask_id(taskId); | ||
| 369 | + shyYidun.setData_id(dataId); | ||
| 370 | + shyYidun.setCheck_type(4); | ||
| 367 | yiDunServiceImpl.addYiDunMsg(shyYidun); | 371 | yiDunServiceImpl.addYiDunMsg(shyYidun); |
| 368 | } | 372 | } |
| 369 | } | 373 | } |
src/main/java/com/cnlive/shenhe/serviceImpl/ContentServiceImpl.java
| 1 | package com.cnlive.shenhe.serviceImpl; | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 4 | import com.cnlive.shenhe.dto.ContentDTO; | 5 | import com.cnlive.shenhe.dto.ContentDTO; |
| 5 | import com.cnlive.shenhe.entity.*; | 6 | import com.cnlive.shenhe.entity.*; |
| 6 | import com.cnlive.shenhe.mapper.ShyCommentsMapper; | 7 | import com.cnlive.shenhe.mapper.ShyCommentsMapper; |
| 7 | import com.cnlive.shenhe.mapper.ShyContentMapper; | 8 | import com.cnlive.shenhe.mapper.ShyContentMapper; |
| 8 | -import com.cnlive.shenhe.mapper.ShySitesMapper; | ||
| 9 | import com.cnlive.shenhe.mapper.ShyUsersMapper; | 9 | import com.cnlive.shenhe.mapper.ShyUsersMapper; |
| 10 | import com.cnlive.shenhe.utils.AuditPass; | 10 | import com.cnlive.shenhe.utils.AuditPass; |
| 11 | import com.cnlive.shenhe.utils.CommonConst; | 11 | import com.cnlive.shenhe.utils.CommonConst; |
| @@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Value; | @@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Value; | ||
| 21 | import org.springframework.stereotype.Service; | 21 | import org.springframework.stereotype.Service; |
| 22 | import tk.mybatis.mapper.entity.Example; | 22 | import tk.mybatis.mapper.entity.Example; |
| 23 | 23 | ||
| 24 | +import java.util.ArrayList; | ||
| 24 | import java.util.Date; | 25 | import java.util.Date; |
| 25 | import java.util.List; | 26 | import java.util.List; |
| 26 | 27 | ||
| @@ -38,8 +39,6 @@ public class ContentServiceImpl { | @@ -38,8 +39,6 @@ public class ContentServiceImpl { | ||
| 38 | @Autowired | 39 | @Autowired |
| 39 | ShyContentMapper shyContentMapper; | 40 | ShyContentMapper shyContentMapper; |
| 40 | @Autowired | 41 | @Autowired |
| 41 | - ShySitesMapper shySitesMapper; | ||
| 42 | - @Autowired | ||
| 43 | ShyUsersMapper shyUsersMapper; | 42 | ShyUsersMapper shyUsersMapper; |
| 44 | @Autowired | 43 | @Autowired |
| 45 | AuditPass Pass; | 44 | AuditPass Pass; |
| @@ -48,8 +47,6 @@ public class ContentServiceImpl { | @@ -48,8 +47,6 @@ public class ContentServiceImpl { | ||
| 48 | @Autowired | 47 | @Autowired |
| 49 | VideosServiceImpl videosService; | 48 | VideosServiceImpl videosService; |
| 50 | @Autowired | 49 | @Autowired |
| 51 | - VideofilterServiceImpl videofilterServiceImpl; | ||
| 52 | - @Autowired | ||
| 53 | YiDunServiceImpl yiDunServiceImpl; | 50 | YiDunServiceImpl yiDunServiceImpl; |
| 54 | 51 | ||
| 55 | @Value("${spring.localhost.url}") | 52 | @Value("${spring.localhost.url}") |
| @@ -64,9 +61,20 @@ public class ContentServiceImpl { | @@ -64,9 +61,20 @@ public class ContentServiceImpl { | ||
| 64 | } | 61 | } |
| 65 | 62 | ||
| 66 | //************************************** | 63 | //************************************** |
| 64 | + | ||
| 67 | public List<ShyContent> findshyContent(ShyContent shyContent) { | 65 | public List<ShyContent> findshyContent(ShyContent shyContent) { |
| 66 | + return shyContentMapper.selectByRowBounds(shyContent, new RowBounds(0, 100)); | ||
| 67 | + } | ||
| 68 | 68 | ||
| 69 | - return shyContentMapper.selectByRowBounds(shyContent, new RowBounds(0, 50)); | 69 | + public List<ShyContent> findShyContentWithWebPage() { |
| 70 | + List checkParamList = new ArrayList(); | ||
| 71 | + checkParamList.add("content"); | ||
| 72 | + Example example = new Example(ShyContent.class); | ||
| 73 | + Example.Criteria criteria = example.createCriteria(); | ||
| 74 | + criteria.andNotIn("content_tag", checkParamList); | ||
| 75 | + criteria.andEqualTo("shenhe_type", CommonConst.AUDIT_TYPE_MACHANE); | ||
| 76 | + criteria.andEqualTo("receive_status", CommonConst.RECEIVE_BEFORE); | ||
| 77 | + return shyContentMapper.selectByExampleAndRowBounds(example, new RowBounds(0, 100)); | ||
| 70 | } | 78 | } |
| 71 | 79 | ||
| 72 | //*************************** | 80 | //*************************** |
| @@ -375,22 +383,26 @@ public class ContentServiceImpl { | @@ -375,22 +383,26 @@ public class ContentServiceImpl { | ||
| 375 | * 易盾网站过滤 | 383 | * 易盾网站过滤 |
| 376 | * | 384 | * |
| 377 | * @param shyContent | 385 | * @param shyContent |
| 378 | - * @return | 386 | + * @return 1:文本 2:图片 3.网页 4:点播音频 |
| 379 | */ | 387 | */ |
| 380 | public void contentFilter(ShyContent shyContent) { | 388 | public void contentFilter(ShyContent shyContent) { |
| 381 | String contentUrl = shyContent.getContent_url(); | 389 | String contentUrl = shyContent.getContent_url(); |
| 382 | - logger.info("向易盾网站检测接口提交的url:" + contentUrl); | 390 | + logger.info("审核云向易盾网站检测接口提交的url:{}", contentUrl); |
| 383 | //调用易盾网站检测接口 | 391 | //调用易盾网站检测接口 |
| 384 | JSONObject jsonObject = YiDunAntiFraudUtil.submitYiDunUrl(contentUrl); | 392 | JSONObject jsonObject = YiDunAntiFraudUtil.submitYiDunUrl(contentUrl); |
| 385 | if (jsonObject != null) { | 393 | if (jsonObject != null) { |
| 386 | JSONObject result = jsonObject.getJSONObject("result"); | 394 | JSONObject result = jsonObject.getJSONObject("result"); |
| 387 | String dataId = result.getString("dataId"); | 395 | String dataId = result.getString("dataId"); |
| 396 | + String taskId = result.getString("taskId"); | ||
| 388 | ShyYidun shyYidun = new ShyYidun(); | 397 | ShyYidun shyYidun = new ShyYidun(); |
| 389 | shyYidun.setId(dataId); | 398 | shyYidun.setId(dataId); |
| 390 | shyYidun.setUrl(contentUrl); | 399 | shyYidun.setUrl(contentUrl); |
| 391 | - | 400 | + shyYidun.setTask_id(taskId); |
| 401 | + shyYidun.setData_id(dataId); | ||
| 402 | + shyYidun.setCheck_type(3); | ||
| 392 | shyYidun.setContent_id(shyContent.getId().toString()); | 403 | shyYidun.setContent_id(shyContent.getId().toString()); |
| 393 | shyYidun.setCreate_time(new Date()); | 404 | shyYidun.setCreate_time(new Date()); |
| 405 | + logger.info("审核云保存到ShyYidun表里数据:{}", JSON.toJSONString(shyYidun)); | ||
| 394 | yiDunServiceImpl.addYiDunMsg(shyYidun); | 406 | yiDunServiceImpl.addYiDunMsg(shyYidun); |
| 395 | } | 407 | } |
| 396 | } | 408 | } |
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
| @@ -324,7 +324,6 @@ public class VideosServiceImpl { | @@ -324,7 +324,6 @@ public class VideosServiceImpl { | ||
| 324 | } | 324 | } |
| 325 | } | 325 | } |
| 326 | //默认按上传时间倒序排序 | 326 | //默认按上传时间倒序排序 |
| 327 | - //example.setOrderByClause("video_upload_time desc"); | ||
| 328 | List<ShyVideos> shyVideosList = shyVideosMapper.selectByExample(example); | 327 | List<ShyVideos> shyVideosList = shyVideosMapper.selectByExample(example); |
| 329 | return shyVideosList; | 328 | return shyVideosList; |
| 330 | } | 329 | } |
| @@ -333,7 +332,7 @@ public class VideosServiceImpl { | @@ -333,7 +332,7 @@ public class VideosServiceImpl { | ||
| 333 | * 易盾视频(图片)过滤 | 332 | * 易盾视频(图片)过滤 |
| 334 | * | 333 | * |
| 335 | * @param cid 审核云中视频的id | 334 | * @param cid 审核云中视频的id |
| 336 | - * @return | 335 | + * @return 1:文本 2:图片 3.网页 4:点播音频 |
| 337 | */ | 336 | */ |
| 338 | public int videoFilter(Integer cid) { | 337 | public int videoFilter(Integer cid) { |
| 339 | ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(cid); | 338 | ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(cid); |
| @@ -375,7 +374,6 @@ public class VideosServiceImpl { | @@ -375,7 +374,6 @@ public class VideosServiceImpl { | ||
| 375 | //拒绝原因 | 374 | //拒绝原因 |
| 376 | shyVideos.setMsg(desc); | 375 | shyVideos.setMsg(desc); |
| 377 | videosService.updateshyVideos(shyVideos); | 376 | videosService.updateshyVideos(shyVideos); |
| 378 | - //videosService.updateDianboAndShenhe(shyVideos,4); | ||
| 379 | } | 377 | } |
| 380 | try { | 378 | try { |
| 381 | ShyYidun shyYidun = new ShyYidun(); | 379 | ShyYidun shyYidun = new ShyYidun(); |
| @@ -383,8 +381,11 @@ public class VideosServiceImpl { | @@ -383,8 +381,11 @@ public class VideosServiceImpl { | ||
| 383 | shyYidun.setContent_id(cid.toString()); | 381 | shyYidun.setContent_id(cid.toString()); |
| 384 | shyYidun.setUrl(url); | 382 | shyYidun.setUrl(url); |
| 385 | shyYidun.setDesc_msg(desc); | 383 | shyYidun.setDesc_msg(desc); |
| 384 | + //校验图片类型 | ||
| 385 | + shyYidun.setCheck_type(2); | ||
| 386 | shyYidun.setDuration(shyVideos.getDuration()); | 386 | shyYidun.setDuration(shyVideos.getDuration()); |
| 387 | shyYidun.setCreate_time(new Date()); | 387 | shyYidun.setCreate_time(new Date()); |
| 388 | + | ||
| 388 | yiDunServiceImpl.addYiDunMsg(shyYidun); | 389 | yiDunServiceImpl.addYiDunMsg(shyYidun); |
| 389 | 390 | ||
| 390 | } catch (Exception e) { | 391 | } catch (Exception e) { |
src/main/java/com/cnlive/shenhe/utils/YiDunAntiFraudUtil.java
| @@ -4,11 +4,9 @@ import com.alibaba.fastjson.JSONArray; | @@ -4,11 +4,9 @@ import com.alibaba.fastjson.JSONArray; | ||
| 4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | import com.cnlive.shenhe.enums.ImageLabels; | 5 | import com.cnlive.shenhe.enums.ImageLabels; |
| 6 | import com.cnlive.shenhe.enums.TextLabels; | 6 | import com.cnlive.shenhe.enums.TextLabels; |
| 7 | -import com.cnlive.shenhe.serviceImpl.YiDunServiceImpl; | ||
| 8 | import org.apache.commons.codec.digest.DigestUtils; | 7 | import org.apache.commons.codec.digest.DigestUtils; |
| 9 | import org.slf4j.Logger; | 8 | import org.slf4j.Logger; |
| 10 | import org.slf4j.LoggerFactory; | 9 | import org.slf4j.LoggerFactory; |
| 11 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | import org.springframework.util.StringUtils; | 10 | import org.springframework.util.StringUtils; |
| 13 | 11 | ||
| 14 | import java.io.UnsupportedEncodingException; | 12 | import java.io.UnsupportedEncodingException; |
| @@ -24,9 +22,6 @@ public class YiDunAntiFraudUtil { | @@ -24,9 +22,6 @@ public class YiDunAntiFraudUtil { | ||
| 24 | 22 | ||
| 25 | private static Logger logger = LoggerFactory.getLogger(YiDunAntiFraudUtil.class); | 23 | private static Logger logger = LoggerFactory.getLogger(YiDunAntiFraudUtil.class); |
| 26 | 24 | ||
| 27 | - @Autowired | ||
| 28 | - YiDunServiceImpl yiDunServiceImpl; | ||
| 29 | - | ||
| 30 | /** | 25 | /** |
| 31 | * 网站地址URL产品密钥ID,产品标识 | 26 | * 网站地址URL产品密钥ID,产品标识 |
| 32 | */ | 27 | */ |
| @@ -35,24 +30,12 @@ public class YiDunAntiFraudUtil { | @@ -35,24 +30,12 @@ public class YiDunAntiFraudUtil { | ||
| 35 | * 网站地址URL产品私有密钥,服务端生成签名信息使用,请严格保管,避免泄露 | 30 | * 网站地址URL产品私有密钥,服务端生成签名信息使用,请严格保管,避免泄露 |
| 36 | */ | 31 | */ |
| 37 | private final static String SECRETKEY = "833222b4951a67a9bc63b5ed0c24d07d"; | 32 | private final static String SECRETKEY = "833222b4951a67a9bc63b5ed0c24d07d"; |
| 38 | - /** | ||
| 39 | - * 网站地址URL提交接口地址 | ||
| 40 | - */ | ||
| 41 | - private final static String URL_SUBMIT = "https://as.dun.163yun.com/v1/crawler/submit"; | ||
| 42 | - /** | ||
| 43 | - * 需检测的网站地址URL | ||
| 44 | - */ | ||
| 45 | - private final static String FILE_URL = "http://shen.cnlive.com/api/content/detail/135058.html"; | ||
| 46 | - /** | ||
| 47 | - * 网站地址URL检测结果获取接口地址 | ||
| 48 | - */ | ||
| 49 | - private final static String URL_RESULT = "https://as.dun.163yun.com/v1/crawler/callback/results"; | ||
| 50 | - | ||
| 51 | 33 | ||
| 52 | /** | 34 | /** |
| 53 | * 文本识别 图片识别 点播音频识别产品密钥ID,产品标识 | 35 | * 文本识别 图片识别 点播音频识别产品密钥ID,产品标识 |
| 54 | */ | 36 | */ |
| 55 | private final static String TEXTANDIMAGESECRETID = "11c62726ba11f03f3f7d87acbe2d4f03"; | 37 | private final static String TEXTANDIMAGESECRETID = "11c62726ba11f03f3f7d87acbe2d4f03"; |
| 38 | + | ||
| 56 | /** | 39 | /** |
| 57 | * 文本识别 图片识别 点播音频识别产品私有密钥,服务端生成签名信息使用,请严格保管,避免泄露 | 40 | * 文本识别 图片识别 点播音频识别产品私有密钥,服务端生成签名信息使用,请严格保管,避免泄露 |
| 58 | */ | 41 | */ |
| @@ -61,64 +44,79 @@ public class YiDunAntiFraudUtil { | @@ -61,64 +44,79 @@ public class YiDunAntiFraudUtil { | ||
| 61 | * 业务ID,易盾根据产品业务特点分配(文本) | 44 | * 业务ID,易盾根据产品业务特点分配(文本) |
| 62 | */ | 45 | */ |
| 63 | private final static String TEXTBUSINESSID = "719926f98dc5b9bb9857e1b799ea3f5f"; | 46 | private final static String TEXTBUSINESSID = "719926f98dc5b9bb9857e1b799ea3f5f"; |
| 64 | - /** | ||
| 65 | - * 易盾内容安全文本在线检测接口地址 | ||
| 66 | - */ | ||
| 67 | - private final static String TEXT_RESULT = "https://as.dun.163yun.com/v3/text/check"; | 47 | + |
| 68 | /** | 48 | /** |
| 69 | * 业务ID,易盾根据产品业务特点分配(图片) | 49 | * 业务ID,易盾根据产品业务特点分配(图片) |
| 70 | */ | 50 | */ |
| 71 | private final static String IMAGEBUSINESSID = "f84d6ee9f62274243825d3e969ca4c5a"; | 51 | private final static String IMAGEBUSINESSID = "f84d6ee9f62274243825d3e969ca4c5a"; |
| 72 | - /** | ||
| 73 | - * 易盾内容安全服务图片在线检测接口地址 | ||
| 74 | - */ | ||
| 75 | - private final static String IMAGE_RESULT = "https://as.dun.163yun.com/v4/image/check"; | 52 | + |
| 76 | /** | 53 | /** |
| 77 | * 业务ID,易盾根据产品业务特点分配(点播音频) | 54 | * 业务ID,易盾根据产品业务特点分配(点播音频) |
| 78 | */ | 55 | */ |
| 79 | private final static String AUDIOONDEMANDBUSINESSID = "1b77454593bf55607e3e7120d02c6389"; | 56 | private final static String AUDIOONDEMANDBUSINESSID = "1b77454593bf55607e3e7120d02c6389"; |
| 80 | /** | 57 | /** |
| 58 | + * 网站地址URL提交接口地址 | ||
| 59 | + * http://as.dun.163.com/v2/crawler/submit | ||
| 60 | + */ | ||
| 61 | + private final static String URL_SUBMIT = "https://as.dun.163yun.com/v1/crawler/submit"; | ||
| 62 | + | ||
| 63 | + /** | ||
| 81 | * 点播音频地址URL提交接口地址 | 64 | * 点播音频地址URL提交接口地址 |
| 82 | */ | 65 | */ |
| 83 | private final static String AUDIOONDEMAND_URL_SUBMIT = "http://as.dun.163.com/v3/audio/submit"; | 66 | private final static String AUDIOONDEMAND_URL_SUBMIT = "http://as.dun.163.com/v3/audio/submit"; |
| 84 | 67 | ||
| 85 | - public static void main(String[] args) { | ||
| 86 | - Map<String, String> params = new HashMap<String, String>(5); | ||
| 87 | - // 1.设置公共参数 | ||
| 88 | - params.put("secretId", SECRETID); | ||
| 89 | - params.put("version", "v1.0"); | ||
| 90 | - params.put("timestamp", String.valueOf(System.currentTimeMillis())); | ||
| 91 | - params.put("nonce", String.valueOf(new Random().nextInt())); | 68 | + /** |
| 69 | + * 易盾内容安全文本在线检测接口地址 | ||
| 70 | + */ | ||
| 71 | + private final static String TEXT_RESULT = "https://as.dun.163yun.com/v3/text/check"; | ||
| 92 | 72 | ||
| 93 | - // 2.生成签名信息 | ||
| 94 | - String signature1 = YiDunAntiFraudUtil.genSignature(SECRETKEY, params); | ||
| 95 | - params.put("signature", signature1); | ||
| 96 | - String s1 = HttpClientUtils.post_str(URL_RESULT, params); | ||
| 97 | - logger.info("查询易盾网站检测结果:{}", s1); | 73 | + /** |
| 74 | + * 易盾内容安全服务图片在线检测接口地址 | ||
| 75 | + */ | ||
| 76 | + private final static String IMAGE_RESULT = "https://as.dun.163yun.com/v4/image/check"; | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 网站地址URL检测结果获取接口地址 | ||
| 80 | + */ | ||
| 81 | + private final static String URL_RESULT = "https://as.dun.163yun.com/v1/crawler/callback/results"; | ||
| 82 | + | ||
| 83 | + public static void main(String[] args) { | ||
| 84 | +// Map<String, String> params = new HashMap<String, String>(5); | ||
| 85 | +// // 1.设置公共参数 | ||
| 86 | +// params.put("secretId", SECRETID); | ||
| 87 | +// params.put("version", "v1.0"); | ||
| 88 | +// params.put("timestamp", String.valueOf(System.currentTimeMillis())); | ||
| 89 | +// params.put("nonce", String.valueOf(new Random().nextInt())); | ||
| 90 | +// | ||
| 91 | +// // 2.生成签名信息 | ||
| 92 | +// String signature1 = YiDunAntiFraudUtil.genSignature(SECRETKEY, params); | ||
| 93 | +// params.put("signature", signature1); | ||
| 94 | +// String s1 = HttpClientUtils.post_str(URL_RESULT, params); | ||
| 95 | +// logger.info("查询易盾网站检测结果:{}", s1); | ||
| 98 | //智能文本识别审核测试 | 96 | //智能文本识别审核测试 |
| 99 | //getTextFilter("王八蛋"); | 97 | //getTextFilter("王八蛋"); |
| 100 | 98 | ||
| 101 | //智能图片识别审核测试 | 99 | //智能图片识别审核测试 |
| 102 | -// JSONArray jsonArray = new JSONArray(); | ||
| 103 | -// JSONObject image1 = new JSONObject(); | ||
| 104 | -// image1.put("name", UUID.randomUUID()); | ||
| 105 | -// image1.put("type", 1); | ||
| 106 | -// 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"); | ||
| 107 | -// jsonArray.add(image1); | ||
| 108 | -// JSONObject image2 = new JSONObject(); | ||
| 109 | -// image2.put("name", UUID.randomUUID()); | ||
| 110 | -// image2.put("type", 1); | ||
| 111 | -// image2.put("data", "http://test.qnvod.cnlive.com/shen/802/2020/03/01/8a8a878c6dce5cfe017096cd07940c84/000002.jpg"); | ||
| 112 | -// jsonArray.add(image2); | ||
| 113 | -// JSONObject image3 = new JSONObject(); | ||
| 114 | -// image3.put("name", UUID.randomUUID()); | ||
| 115 | -// image3.put("type", 1); | ||
| 116 | -// image3.put("data", "https://wjj.ys2.cnliveimg.com/769/img/0/2020/03/21/158474856886077030277.jpg"); | ||
| 117 | -// jsonArray.add(image3); | ||
| 118 | -// System.out.println(jsonArray); | ||
| 119 | -// JSONObject imagesFilter = getImagesFilter(jsonArray.toString()); | ||
| 120 | -//// System.out.println(image1); | ||
| 121 | -// System.out.println(imagesFilter); | 100 | + JSONArray jsonArray = new JSONArray(); |
| 101 | + JSONObject image1 = new JSONObject(); | ||
| 102 | + image1.put("name", UUID.randomUUID()); | ||
| 103 | + image1.put("type", 1); | ||
| 104 | + 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"); | ||
| 105 | + jsonArray.add(image1); | ||
| 106 | + JSONObject image2 = new JSONObject(); | ||
| 107 | + image2.put("name", UUID.randomUUID()); | ||
| 108 | + image2.put("type", 1); | ||
| 109 | + image2.put("data", "http://test.qnvod.cnlive.com/shen/802/2020/03/01/8a8a878c6dce5cfe017096cd07940c84/000002.jpg"); | ||
| 110 | + jsonArray.add(image2); | ||
| 111 | + JSONObject image3 = new JSONObject(); | ||
| 112 | + image3.put("name", UUID.randomUUID()); | ||
| 113 | + image3.put("type", 1); | ||
| 114 | + image3.put("data", "https://wjj.ys2.cnliveimg.com/769/img/0/2020/03/21/158474856886077030277.jpg"); | ||
| 115 | + jsonArray.add(image3); | ||
| 116 | + System.out.println(jsonArray); | ||
| 117 | + JSONObject imagesFilter = getImagesFilter(jsonArray.toString()); | ||
| 118 | +// System.out.println(image1); | ||
| 119 | + System.out.println(imagesFilter); | ||
| 122 | 120 | ||
| 123 | 121 | ||
| 124 | //智能网页识别审核测试 | 122 | //智能网页识别审核测试 |
| @@ -398,7 +396,6 @@ public class YiDunAntiFraudUtil { | @@ -398,7 +396,6 @@ public class YiDunAntiFraudUtil { | ||
| 398 | params.put("signature", signature); | 396 | params.put("signature", signature); |
| 399 | 397 | ||
| 400 | // 4.发送HTTP请求 | 398 | // 4.发送HTTP请求 |
| 401 | - //String response = HttpClient4Utils.sendPost(httpClient, API_URL, params, Consts.UTF_8); | ||
| 402 | String s = HttpClientUtils.post_str(URL_SUBMIT, params); | 399 | String s = HttpClientUtils.post_str(URL_SUBMIT, params); |
| 403 | System.out.println("图文检测提交url结果" + s); | 400 | System.out.println("图文检测提交url结果" + s); |
| 404 | 401 | ||
| @@ -431,7 +428,7 @@ public class YiDunAntiFraudUtil { | @@ -431,7 +428,7 @@ public class YiDunAntiFraudUtil { | ||
| 431 | */ | 428 | */ |
| 432 | public static JSONObject submitYiDunUrl(String url) { | 429 | public static JSONObject submitYiDunUrl(String url) { |
| 433 | try { | 430 | try { |
| 434 | - logger.info("向易盾网站检测接口提交的url....................."); | 431 | + logger.info("审核云向易盾网站检测接口提交的url....................."); |
| 435 | Map<String, String> params = new HashMap<String, String>(); | 432 | Map<String, String> params = new HashMap<String, String>(); |
| 436 | 433 | ||
| 437 | // 1.设置公共参数 | 434 | // 1.设置公共参数 |
| @@ -456,7 +453,7 @@ public class YiDunAntiFraudUtil { | @@ -456,7 +453,7 @@ public class YiDunAntiFraudUtil { | ||
| 456 | 453 | ||
| 457 | // 4.发送HTTP请求 | 454 | // 4.发送HTTP请求 |
| 458 | String s = HttpClientUtils.post_str(URL_SUBMIT, params); | 455 | String s = HttpClientUtils.post_str(URL_SUBMIT, params); |
| 459 | - logger.info("向易盾提交网站检测地址返回的结果:{}", s); | 456 | + logger.info("审核云向易盾提交网站检测地址返回的结果:{}", s); |
| 460 | JSONObject jsonObject = JSONObject.parseObject(s); | 457 | JSONObject jsonObject = JSONObject.parseObject(s); |
| 461 | int code = jsonObject.getIntValue("code"); | 458 | int code = jsonObject.getIntValue("code"); |
| 462 | String msg = jsonObject.getString("msg"); | 459 | String msg = jsonObject.getString("msg"); |