Commit 35d2e2a4 authored by 刘基明's avatar 刘基明

图片审核不通过

parent 942511e9
......@@ -8,7 +8,7 @@ public enum FileChechStatusEnum {
INIT(0,"初始化"),
PASS(1,"审核通过"),
FAILED(2,"审核不通过"),
BLOCK(2,"审核不通过"),
REVIEW(3,"建议人工审核");
......
......@@ -31,7 +31,7 @@ public class CallBackController {
* 阿里云图片审核回调接口
* 回调时间:6秒以内
* 文档地址:https://help.aliyun.com/document_detail/129946.html?spm=a2c4g.11186623.6.562.19a05f3aNkd2Oo#table-s9e-grd-408
*
* https://help.aliyun.com/document_detail/70292.htm?spm=a2c4g.11186623.2.12.26573ac7EEunMN#reference-fzy-ztm-v2b
* @param checksum
* @param content
* @return
......@@ -44,12 +44,19 @@ public class CallBackController {
Map<String, Object> response = JsonUtil.toMap(content);
String fileKey = (String) response.get("object");
boolean freezed = (boolean) response.get("freezed");
FileChechStatusEnum type = freezed ? FileChechStatusEnum.FAILED : FileChechStatusEnum.PASS;
FileChechStatusEnum type = freezed ? FileChechStatusEnum.BLOCK : FileChechStatusEnum.PASS;
HashMap<String, Object> scanResult = (HashMap<String, Object>) response.get("scanResult");
String taskId = (String) scanResult.get("taskId");
List<HashMap<String, Object>> scenes = (List<HashMap<String, Object>>) scanResult.get("results");
for (HashMap<String, Object> scene : scenes) {
if (!"pass".equals(scene.get("suggestion"))) {
// pass:结果正常,无需进行其余操作。
// review:结果不确定,需要进行人工审核。
// block:结果违规,建议直接删除或者限制公开。
if ("block".equals(scene.get("suggestion"))) {
type=FileChechStatusEnum.BLOCK;
break;
}
if ("review".equals(scene.get("suggestion"))) {
type=FileChechStatusEnum.REVIEW;
}
}
......
......@@ -441,7 +441,7 @@ public class BatchFeignCallService {
.resizeUrl(imgEntity.getUrl() + CommunityConstant.OSS_RESIZE_RATIO)
.build();
// 图片审核屏蔽
if (FileChechStatusEnum.FAILED.getCode().equals(imgEntity.getCheckStatus())){
if (FileChechStatusEnum.BLOCK.getCode().equals(imgEntity.getCheckStatus())){
imagesDTO.setRemark(CommunityConstant.OSS_CHECK_FAIL_DEFAULT);
imagesDTO.setResizeUrl(CommunityConstant.OSS_CHECK_FAIL_DEFAULT+ CommunityConstant.OSS_RESIZE_RATIO);
imagesDTO.setImgWidth(CommunityConstant.OSS_CHECK_FAIL_DEFAULT_WIDTH);
......@@ -458,7 +458,7 @@ public class BatchFeignCallService {
if (imgUrlMap.containsKey(imagesDTO.getRelId())) {
FileRecordEntity imgEntity = imgUrlMap.get(imagesDTO.getRelId());
// 图片审核不通过,替换为默认图片 todo 配置移除
if (FileChechStatusEnum.FAILED.getCode().equals(imgEntity.getCheckStatus())){
if (FileChechStatusEnum.BLOCK.getCode().equals(imgEntity.getCheckStatus())){
imagesDTO.setRemark(CommunityConstant.OSS_CHECK_FAIL_DEFAULT);
imagesDTO.setResizeUrl(CommunityConstant.OSS_CHECK_FAIL_DEFAULT+ CommunityConstant.OSS_RESIZE_RATIO);
imagesDTO.setImgWidth(CommunityConstant.OSS_CHECK_FAIL_DEFAULT_WIDTH);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment