我这里用的是阿里云的同步文本检测、同步图片检测、异步视频检测(回调的形式)
内容有点多可以根据目录去查看会比较清晰
引入SDK 和需要的包
引入SDK 和需要的包
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-green</artifactId>
<version>3.6.5</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.51</version>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>2.8.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
枚举父类的定义
枚举父类的定义
public interface IEnum extends Serializable {
int getValue();
@JsonValue
String getName();
@JsonCreator
String getInfo();
IEnum getDefault();
default IEnum getObject(int value) {
try {
return IEnumUtils.getIEnumByValue(this.getClass(), value);
} catch (Exception var3) {
return null;
}
}
}
检测类型枚举
检测类型枚举
public enum CheckTypeEnum implements IEnum {
/**
* porn:图片智能鉴黄
* terrorism:图片暴恐涉政
* ad:图文违规
* qrcode:图片二维码
* live:图片不良场景
* logo:图片logo
*/
PORN(0,"porn","图片智能鉴黄"),
TERRORISM(1, "terrorism", "图片暴恐涉政"),
AD(2, "ad", "图文违规"),
QRCODE(3, "qrcode", "图片二维码"),//视频是没有这个的
LIVE(4, "live", "图片不良场景"),
LOGO(5, "logo", "图片logo");
private final int value;
private final String name;
private final String info;
CheckTypeEnum(int value, String name, String info) {
this.value = value;
this.name = name;
this.info = info;
}
@Override
public int getValue() {
return value;
}
@Override
public String getName() {
return name;
}
@Override
public String getInfo() {
return info;
}
@Override
public IEnum getDefault() {
return null;
}
public static CheckTypeEnum getEnumByValue(Integer value){
if (value != null) {
for (CheckTypeEnum v : CheckTypeEnum.values()) {
if (v.getValue() == value) {
return v;
}
}
}
return null;
}
public static CheckTypeEnum getEnumByValue(String name){
if (name != null) {
for (CheckTypeEnum v : CheckTypeEnum.values()) {
if (v.getName().equals(name)) {
return v;
}
}
}
return null;
}
}
检测结果抛出来的异常 (可以自行捕获做处理)
检测结果抛出来的异常 (可以自行捕获做处理)
public enum CheckExpEnum implements IEnum {
/**
* porn:图片智能鉴黄
* terrorism:图片暴恐涉政
* ad:图文违规
* qrcode:图片二维码
* live:图片不良场景
* logo:图片logo
*/
PORN_SEXY(0,"porn_sexy","性感"),
PORN_PORN(1, "porn_porn", "色情"),
TERRORISM_EXPLOSION(2, "terrorism_explosion", "爆炸烟光"),
TERRORISM_OUTFIT(3, "terrorism_outfit", "特殊装束"),
TERRORISM_LOGO(4, "terrorism_logo", "特殊标识"),
TERRORISM_WEAPON(5, "terrorism_weapon", "武器"),
TERRORISM_POLITICS(6, "terrorism_politics", "涉政"),
TERRORISM_VIOLENCE(7, "terrorism_violence", "打斗"),
TERRORISM_CROWD(8, "terrorism_crowd", "聚众"),
TERRORISM_PARADE(9, "terrorism_parade", "游行"),
TERRORISM_CARCRASH(10, "carcrash", "车祸现场"),
TERRORISM_FLAG(11, "flag", "旗帜"),
TERRORISM_LOCATION(12, "location", "地标"),
TERRORISM_OTHERS(13, "others", "其他"),
AD_AD(14, "ad_ad", "其他广告"),
AD_POLITICS(15, "ad_politics", "文字含涉政内容"),
AD_PORN(16, "ad_porn", "文字含涉黄内容"),
AD_ABUSE(17, "ad_abuse", "文字含辱骂内容"),
AD_TERRORISM(18, "ad_terrorism", "文字含暴恐内容"),
AD_CONTRABAND(19, "ad_contraband", "文字含违禁内容"),
AD_SPAM(20, "ad_spam", "文字含其他垃圾内容"),
AD_NPX(21, "ad_npx", "牛皮癣广告"),
AD_QRCODE(22, "ad_qrcode", "含二维码"),
AD_PROGRAMCODE(23, "ad_programCode", "含小程序码"),
QRCODE_PARADE(24, "qrcode_qrcode", "含二维码"),
QRCODE_QRCODE(25, "qrcode_programCode", "含小程序码"),
LIVE_MEANINGLESS(26, "live_meaningless", "图片中无内容(例如,黑屏、白屏)"),
LIVE_PIP(27, "live_PIP", "画中画"),
LIVE_SMOKING(28, "live_smoking", "吸烟"),
LIVE_DRIVELIVE(29, "live_drivelive", "车内直播"),
LOGO_TV(30, "logo_TV", "含受管控的logo"),
LOGO_TRADEMARK(31, "logo_trademark", "含商标"),
TERRORISM_TERRORISM(32, "terrorism_terrorism", "暴恐涉政"),
LIVE_LIVE(33, "live_live", "包含不良场景"),
LOGO_LOGO(34, "logo_logo", "包含广告或文字违规信息"),
TEXT_SPAM(35, "text_spam", "含垃圾信息"),
TEXT_AD(36, "text_ad", "广告"),
TEXT_POLITICS(37, "text_politics", "涉政"),
TEXT_TERRORISM(38, "text_terrorism", "暴恐"),
TEXT_ABUSE(39, "text_abuse", "辱骂"),
TEXT_PORN(40, "text_porn", "色情"),
TEXT_FLOOD(41, "text_flood", "灌水"),
TEXT_CONTRABAND(42, "text_contraband", "违禁"),
TEXT_MEANINGLESS(43, "text_meaningless", "无意义");
private final int value;
private final String name;
private final String info;
CheckExpEnum(int value, String name, String info) {
this.value = value;
this.name = name;
this.info = info;
}
@Override
public int getValue() {
return value;
}
@Override
public String getName() {
return name;
}
@Override
public String getInfo() {
return info;
}
@Override
public IEnum getDefault() {
return null;
}
public static CheckExpEnum getEnumByValue(Integer value){
if (value != null) {
for (CheckExpEnum v : CheckExpEnum.values()) {
if (v.getValue() == value) {
return v;
}
}
}
return null;
}
public static CheckExpEnum getEnumByValue(String name){
if (name != null) {
for (CheckExpEnum v : CheckExpEnum.values()) {
if (v.getName().equals(name)) {
return v;
}
}
}
return null;
}
}
传入的实体类
传入的实体类
@Data
@Builder
public class CheckDto {
/**
* 视频回调的时候会用到
*/
private String id;
/**
* 要检测图片或视频的地址
*/
private String url;
}
返回结果的实体类
检测结果实体类
@Data
@Builder
public class CheckVo {
/**
* 传入的数据id
*/
private String dataId;
/**
* 是否通过 状态 1通过 2不通过 -1(视频有疑似违规,待人工审核) 9删除
*/
int isPass;
/**
* 查看具体返回结果 违规详情
* https://help.aliyun.com/document_detail/70292.html?spm=a2c4g.11186623.6.628.422faba5Ezu38M#title-8u9-wle-kv0
*/
private String label;
/**
* 视频和图片的类别
* 视频检测场景,和调用请求中的场景对应。取值:
* porn:视频智能鉴黄。
* terrorism:视频暴恐涉政。
* live:视频不良场景。
* logo:视频logo。
* ad:视频图文违规。
*/
private String scene;
}
AccessKey
AccessKey
/**
* ALIYUN_ACCESS_KEY_ID和ALIYUN_ACCESS_KEY_SECRET中传入您自己的AccessKey信息。
* REGION_ID可选值:cn-shanghai、cn-beijing、ap-southeast-1、us-west-1。其他地域暂不支持,请勿使用。
* 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM子用户进行API访问或日常运维。
*/
private final static String ALIYUN_ACCESS_KEY_ID = "";
private final static String ALIYUN_ACCESS_KEY_SECRET = "";
private final static String REGION_ID = "cn-beijing";
图片违规检测
图片违规检测
/**
* 图片违规检测
*
* @param imageCheckDto 需要传递检测的 图片地址和信息
* @param scenes 要检测的场景
* @return 检测结果
*/
@SneakyThrows
public static List<ArrayList<CheckVo>> imageCheck(List<CheckDto> imageCheckDto, List<CheckTypeEnum> scenes) {
// DefaultProfile.addEndpoint("cn-beijing", "cn-beijing", "Green", "green.cn-beijing.aliyuncs.com");
IAcsClient client = new DefaultAcsClient(DefaultProfile.getProfile(REGION_ID, ALIYUN_ACCESS_KEY_ID, ALIYUN_ACCESS_KEY_SECRET));
ImageSyncScanRequest imageSyncScanRequest = new ImageSyncScanRequest();
imageSyncScanRequest.setAcceptFormat(FormatType.JSON);// 指定API返回格式。
imageSyncScanRequest.setMethod(MethodType.POST);// 指定请求方法。
imageSyncScanRequest.setEncoding("utf-8");
imageSyncScanRequest.setProtocol(ProtocolType.HTTP);// 支持HTTP和HTTPS。
JSONObject httpBody = new JSONObject();//请求体
//设置要检测的风险场景。和图片的一些信息
List<JSONObject> taskList = imageCheckDto.stream().map(o -> {
JSONObject task = new JSONObject();
// task.put("dataId", o.getId());
task.put("url", o.getUrl());
task.put("time", new Date());
return task;
}).collect(Collectors.toList());
//设置要检测的风险场景。计费依据此处传递的场景计算。
httpBody.put("scenes", scenes.stream().map(CheckTypeEnum::getName).collect(Collectors.toList()));
// 设置待检测图片。一张图片对应一个task。多张图片同时检测时,处理的时间由最后一个处理完的图片决定。
httpBody.put("tasks", taskList);
imageSyncScanRequest.setHttpContent(org.apache.commons.codec.binary.StringUtils.getBytesUtf8(httpBody.toJSONString()),
"UTF-8", FormatType.JSON);
imageSyncScanRequest.setConnectTimeout(3000);
imageSyncScanRequest.setReadTimeout(10000);
HttpResponse httpResponse = client.doAction(imageSyncScanRequest);
if (httpResponse.isSuccess()) {
return resultHandler(JSON.parseObject(new String(httpResponse.getHttpContent(), StandardCharsets.UTF_8)));
} else {
throw new RuntimeException("响应不成功 状态码" + httpResponse.getStatus());
}
}
文本违规检测
文本违规检测
/**
* 文本违规检测
*
* @param checkStr 要检测的文本
*/
@SneakyThrows
private static List<ArrayList<CheckVo>> textCheck(List<String> checkStr) {
IClientProfile profile = DefaultProfile.getProfile(REGION_ID, ALIYUN_ACCESS_KEY_ID, ALIYUN_ACCESS_KEY_SECRET);
// DefaultProfile.addEndpoint("cn-beijing", "cn-beijing", "Green", "green.cn-beijing.aliyuncs.com");
IAcsClient client = new DefaultAcsClient(profile);
TextScanRequest textScanRequest = new TextScanRequest();
textScanRequest.setAcceptFormat(FormatType.JSON); // 指定API返回格式。
textScanRequest.setHttpContentType(FormatType.JSON);
textScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法。
textScanRequest.setEncoding("UTF-8");
textScanRequest.setRegionId(REGION_ID);
//待检测的文本,长度不超过10000个字符。
List<Map<String, Object>> tasksList = checkStr.stream().map(str -> {
Map<String, Object> task = new LinkedHashMap<>();
task.put("content", str);
return task;
}).collect(Collectors.toList());
JSONObject data = new JSONObject();
//检测场景。文本垃圾检测请传递antispam。
data.put("scenes", Collections.singletonList("antispam"));
data.put("tasks", tasksList);
textScanRequest.setHttpContent(data.toJSONString().getBytes(StandardCharsets.UTF_8), "UTF-8", FormatType.JSON);
// 请务必设置超时时间。
textScanRequest.setConnectTimeout(3000);
textScanRequest.setReadTimeout(6000);
HttpResponse httpResponse = client.doAction(textScanRequest);
if (httpResponse.isSuccess()) {
return resultHandler(JSON.parseObject(new String(httpResponse.getHttpContent(), StandardCharsets.UTF_8)));
} else {
log.error("response not success. status:" + httpResponse.getStatus());
throw new RuntimeException("响应不成功 状态码" + httpResponse.getStatus());
}
}
文本图片返回结果的处理方法
文本图片返回结果的处理方法
/**
* 处理检测的结果
* return List<>检测对象 ArrayList<检测对象里面的每个场景>
*/
public static List<ArrayList<CheckVo>> resultHandler(JSONObject jsonObject) {
if (200 == jsonObject.getInteger("code")) {
return jsonObject.getJSONArray("data").stream().map(taskResult -> {
JSONObject taskResultJson = (JSONObject) taskResult;
return (ArrayList<CheckVo>) taskResultJson.getJSONArray("results").stream().map(results -> {
JSONObject o = JSONObject.parseObject(results.toString());
CheckVo checkVo = CheckVo.builder()
.dataId(o.getString("dataId"))
.label(o.getString("label"))
.build();
if (Objects.nonNull(o.getString("scene"))) {
checkVo.setScene(o.getString("scene"));
}
//是否通过
switch ((o).getString("suggestion")) {
case "review":
checkVo.setIsPass(-1);
break;
case "block":
checkVo.setIsPass(2);
break;
default:
checkVo.setIsPass(1);
break;
}
return checkVo;
}).collect(Collectors.toList());
}).collect(Collectors.toList());
} else {
throw new RuntimeException("detect not success. code:" + jsonObject.getInteger("code"));
}
}
视频检测(异步)
视频检测 这里要注意两个参数 (回调地址:callback,用于配合解密的字符:seed )
/**
* 视频的违规检测
*
* @param videoCheck 需要传递检测的 视频地址和信息
*/
@SneakyThrows
private static Boolean videoCheck(List<CheckDto> videoCheck, List<CheckTypeEnum> scenes) {
ArrayList<String> resultList = new ArrayList<>();
IClientProfile profile = DefaultProfile.getProfile(REGION_ID, ALIYUN_ACCESS_KEY_ID, ALIYUN_ACCESS_KEY_SECRET);
// DefaultProfile.addEndpoint("cn-shanghai", "cn-shanghai", "Green", "green.cn-shanghai.aliyuncs.com");
IAcsClient client = new DefaultAcsClient(profile);
VideoAsyncScanRequest videoAsyncScanRequest = new VideoAsyncScanRequest();
videoAsyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定API返回格式。
videoAsyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法。
/*
* 设置请求的参数
* 设置要检测的场景。视频默认1秒截取一帧.
* 1分钟的视频截帧60张,检测色情(对应场景参数porn)和暴恐涉政(对应场景参数terrorism)2个场景,收费按照60张色情+60张暴恐涉政进行计费。
*/
//检测场景
List<String> scenesList = scenes.stream()
.filter(checkTypeEnum -> checkTypeEnum.getValue() != 3)
.map(CheckTypeEnum::getName)
.collect(Collectors.toList());
//视频信息
List<Map<String, Object>> tasksList = videoCheck.stream().map(o -> {
Map<String, Object> task = new LinkedHashMap<String, Object>();
task.put("dataId", o.getId());
task.put("url", o.getUrl());
// task.put("interval", 5);//视频截帧间隔,单位为秒,取值范围:1~600。默认值为1秒。
return task;
}).collect(Collectors.toList());
JSONObject data = new JSONObject();
data.put("scenes", scenesList);
data.put("tasks", tasksList);
data.put("callback", "");//回调地址
data.put("seed", "");
videoAsyncScanRequest.setHttpContent(data.toJSONString().getBytes(StandardCharsets.UTF_8), "UTF-8", FormatType.JSON);
//请务必设置超时时间。
videoAsyncScanRequest.setConnectTimeout(3000);
videoAsyncScanRequest.setReadTimeout(6000);
HttpResponse httpResponse = client.doAction(videoAsyncScanRequest);
if (httpResponse.isSuccess()) {
JSONObject jsonObject = JSON.parseObject(new String(httpResponse.getHttpContent(), StandardCharsets.UTF_8));
if (200 == jsonObject.getInteger("code")) {
JSONArray taskResults = jsonObject.getJSONArray("data");
for (Object taskResult : taskResults) {
if (200 == ((JSONObject) taskResult).getInteger("code")) {
return true;
}
}
}
//请求的信息
log.info(JSON.toJSONString(jsonObject, true));
} else {
log.error("response not success. status:" + httpResponse.getStatus());
}
return false;
}
视频检测结果处理
视频检测结果处理(需要在回调接口的逻辑里面调用)
public static Map<String,List<CheckVo>> videoResultHandler(JSONObject jsonObject) {
if (200 == jsonObject.getInteger("code")) {
List<CheckVo> collect = jsonObject.getJSONArray("results").stream().map(results -> {
JSONObject o = JSONObject.parseObject(results.toString());
CheckVo checkVo = CheckVo.builder()
.dataId(jsonObject.getString("dataId"))
.label(o.getString("label"))
.build();
if (Objects.nonNull(o.getString("scene"))) {
checkVo.setScene(o.getString("scene"));
}
//是否通过
switch ((o).getString("suggestion")) {
case "review":
checkVo.setIsPass(-1);
break;
case "block":
checkVo.setIsPass(2);
break;
default:
checkVo.setIsPass(1);
break;
}
return checkVo;
}).collect(Collectors.toList());
return collect.stream().collect(Collectors.groupingBy(CheckVo::getDataId));
} else {
throw new RuntimeException("detect not success. code:" + jsonObject.getInteger("code"));
}
}
阿里云视频回调解密(回调接口使用)
阿里云视频回调解密 解密规则:用户uid + seed + content
public void updateAiLiIsPass(String checksum, String content) {
try {
//跟回调传进来的字符串进行验证
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
String token = "用户uid" + "seed" + content;
messageDigest.update(token.getBytes(StandardCharsets.UTF_8));
byte[] digest = messageDigest.digest();
//处理字节数组
StringBuilder stringBuffer = new StringBuilder();
for (byte b : digest) {
if (Integer.toHexString(0xFF & b).length() == 1) {
stringBuffer.append("0").append(Integer.toHexString(0xFF & b));
} else {
stringBuffer.append(Integer.toHexString(0xFF & b));
}
}
if (stringBuffer.toString().equals(checksum)) {
//业务处理逻辑
//
//
//
//
//
}
} catch (Exception e) {
e.printStackTrace();
}
}
封装使用
封装使用
文本
public static void textCheck(String checkStr) {
for (ArrayList<CheckVo> checkVos : textCheck(Collections.singletonList(checkStr))) {
checkVos.forEach(checkVo -> {
CheckExpEnum enumByValue = CheckExpEnum.getEnumByValue("text_" + checkVo.getLabel());
if (Objects.nonNull(enumByValue) && checkVo.getIsPass() == 2) {
throw BasisException.newInstance(BaseResultCode.AUDIT_ERROR, enumByValue.getInfo());
} else if (Objects.nonNull(enumByValue) && checkVo.getIsPass() == -1) {
throw BasisException.newInstance(BaseResultCode.AUDIT_ERROR, "疑似" + enumByValue.getInfo());
}
});
}
}
public static void textCheck(ArrayList<String> checkStr) {
for (ArrayList<CheckVo> checkVos : textCheck((List<String>) checkStr)) {
checkVos.forEach(checkVo -> {
CheckExpEnum enumByValue = CheckExpEnum.getEnumByValue("text_" + checkVo.getLabel());
if (Objects.nonNull(enumByValue) && checkVo.getIsPass() == 2) {
throw BasisException.newInstance(BaseResultCode.AUDIT_ERROR, enumByValue.getInfo());
} else if (Objects.nonNull(enumByValue) && checkVo.getIsPass() == -1) {
throw BasisException.newInstance(BaseResultCode.AUDIT_ERROR, "疑似" + enumByValue.getInfo());
}
});
}
}
图片
public static void imageCheck(String checkImg) {
List<CheckTypeEnum> checkTypeEnums = Arrays.asList(
CheckTypeEnum.PORN,
CheckTypeEnum.TERRORISM,
CheckTypeEnum.QRCODE,
CheckTypeEnum.AD,
CheckTypeEnum.LIVE,
CheckTypeEnum.LOGO);
for (ArrayList<CheckVo> checkVos : imageCheck(Collections.singletonList(CheckDto.builder().url(checkImg).build()), checkTypeEnums)) {
checkVos.forEach(checkVo -> {
CheckExpEnum enumByValue = CheckExpEnum.getEnumByValue(checkVo.getScene() + "_" + checkVo.getLabel());
if (checkVo.getIsPass() == 2 && Objects.nonNull(enumByValue)) {
throw BasisException.newInstance(BaseResultCode.AUDIT_ERROR, enumByValue.getInfo());
} else if (checkVo.getIsPass() == -1 && Objects.nonNull(enumByValue)) {
throw BasisException.newInstance(BaseResultCode.AUDIT_ERROR, "疑似" + enumByValue.getInfo());
}
});
}
}
public static void imageCheck(List<String> checkImg) {
List<CheckTypeEnum> checkTypeEnums = Arrays.asList(
CheckTypeEnum.PORN,
CheckTypeEnum.TERRORISM,
CheckTypeEnum.QRCODE,
CheckTypeEnum.AD,
CheckTypeEnum.LIVE,
CheckTypeEnum.LOGO);
for (ArrayList<CheckVo> checkVos : imageCheck(checkImg.stream().map(str -> CheckDto.builder().url(str).build()).collect(Collectors.toList()), checkTypeEnums)) {
checkVos.forEach(checkVo -> {
CheckExpEnum enumByValue = CheckExpEnum.getEnumByValue(checkVo.getScene() + "_" + checkVo.getLabel());
if (checkVo.getIsPass() == 2 && Objects.nonNull(enumByValue)) {
throw BasisException.newInstance(BaseResultCode.AUDIT_ERROR, enumByValue.getInfo());
} else if (checkVo.getIsPass() == -1 && Objects.nonNull(enumByValue)) {
throw BasisException.newInstance(BaseResultCode.AUDIT_ERROR, "疑似" + enumByValue.getInfo());
}
});
}
}
public static void imageCheck(String checkImg, List<CheckTypeEnum> checkTypeEnums) {
for (ArrayList<CheckVo> checkVos : imageCheck(Collections.singletonList(CheckDto.builder().url(checkImg).build()), checkTypeEnums)) {
checkVos.forEach(checkVo -> {
CheckExpEnum enumByValue = CheckExpEnum.getEnumByValue(checkVo.getScene() + "_" + checkVo.getLabel());
if (checkVo.getIsPass() == 2 && Objects.nonNull(enumByValue)) {
throw BasisException.newInstance(BaseResultCode.AUDIT_ERROR, enumByValue.getInfo());
} else if (checkVo.getIsPass() == -1 && Objects.nonNull(enumByValue)) {
throw BasisException.newInstance(BaseResultCode.AUDIT_ERROR, "疑似" + enumByValue.getInfo());
}
});
}
}
public static void imageCheck(ArrayList<String> checkImg, List<CheckTypeEnum> checkTypeEnums) {
for (ArrayList<CheckVo> checkVos : imageCheck(checkImg.stream().map(str -> CheckDto.builder().url(str).build()).collect(Collectors.toList()), checkTypeEnums)) {
checkVos.forEach(checkVo -> {
CheckExpEnum enumByValue = CheckExpEnum.getEnumByValue(checkVo.getScene() + "_" + checkVo.getLabel());
if (checkVo.getIsPass() == 2 && Objects.nonNull(enumByValue)) {
throw BasisException.newInstance(BaseResultCode.AUDIT_ERROR, enumByValue.getInfo());
} else if (checkVo.getIsPass() == -1 && Objects.nonNull(enumByValue)) {
throw BasisException.newInstance(BaseResultCode.AUDIT_ERROR, "疑似" + enumByValue.getInfo());
}
});
}
}
视频
视频目前只搞了单个的,多个的可以自己搞搞
public static Boolean videoCheck(String dataId,String videoUrl, List<CheckTypeEnum> checkTypeEnums) {
return videoCheck(Collections.singletonList(CheckDto.builder().id(dataId).url(videoUrl).build()), checkTypeEnums);
}
public static Boolean videoCheck(String dataId,String videoUrl) {
List<CheckTypeEnum> checkTypeEnums = Arrays.asList(
CheckTypeEnum.PORN,
CheckTypeEnum.TERRORISM,
CheckTypeEnum.AD,
CheckTypeEnum.LIVE,
CheckTypeEnum.LOGO);
return videoCheck(Collections.singletonList(CheckDto.builder().id(dataId).url(videoUrl).build()), checkTypeEnums);
}