Ver a proveniência

修改视频创建逻辑、新增图片检查接口、新增百度API接口、修改上传阿里云检查、新增回调接口

private_deployment
lrh há 1 ano
ascendente
cometimento
d841342d20
2 ficheiros alterados com 8 adições e 17 eliminações
  1. +1
    -2
      suimangCApi/src/main/java/com/iformall/controller/PersonPhotoController.java
  2. +7
    -15
      suimangCApi/src/main/java/com/iformall/utils/BaiduImageCheckUtil.java

+ 1
- 2
suimangCApi/src/main/java/com/iformall/controller/PersonPhotoController.java Ver ficheiro

@@ -109,8 +109,7 @@ public class PersonPhotoController extends BaseController {
if (size > length) {
return new ResultData(ErrorCode.PICTURE_FOUR_SIZE_EXCEED);
}
AiBaiduCheckResult checkResult = BaiduImageCheckUtil.photoCheck(file);
return new ResultData(checkResult);
return BaiduImageCheckUtil.photoCheck(file);
}




+ 7
- 15
suimangCApi/src/main/java/com/iformall/utils/BaiduImageCheckUtil.java Ver ficheiro

@@ -3,6 +3,7 @@ package com.iformall.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.sm.AiBaiduCheckResult;
import okhttp3.*;
import org.springframework.web.multipart.MultipartFile;
@@ -31,7 +32,7 @@ public class BaiduImageCheckUtil {

public static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().build();

public static AiBaiduCheckResult photoCheck(MultipartFile file) {
public static ResultData photoCheck(MultipartFile file) {
try {
byte[] fileBytes = file.getBytes();
String imgStr = Base64Util.encode(fileBytes);
@@ -46,27 +47,18 @@ public class BaiduImageCheckUtil {
JSONObject jsonObject = JSON.parseObject(result);
//1:合规,2:不合规,3:疑似,4:审核失败
Integer type = jsonObject.getInteger("conclusionType");
AiBaiduCheckResult checkResult = new AiBaiduCheckResult();
if (type == 1) {
checkResult.setMsg("图片合规");
checkResult.setCode(200);
return new ResultData();
} else if (type == 2 || type == 3) {
checkResult.setMsg("图片不合规");
checkResult.setCode(ErrorCode.SYS_SERVER_ERROR.getCode());
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"图片不合规");
} else if (type == 4) {
checkResult.setMsg("图片审核失败");
checkResult.setCode(ErrorCode.SYS_SERVER_ERROR.getCode());
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"图片审核失败");
} else {
checkResult.setMsg("图片审核失败");
checkResult.setCode(ErrorCode.SYS_SERVER_ERROR.getCode());
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"图片审核失败");
}
return checkResult;
} catch (Exception e) {
e.printStackTrace();
AiBaiduCheckResult checkResult = new AiBaiduCheckResult();
checkResult.setMsg("图片审核失败");
checkResult.setCode(ErrorCode.SYS_SERVER_ERROR.getCode());
return checkResult;
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"图片审核失败");
}
}



Carregando…
Cancelar
Guardar