|
|
@@ -14,6 +14,7 @@ import shop.alien.store.service.StoreImgService;
|
|
|
import shop.alien.store.service.StoreInfoService;
|
|
|
import shop.alien.store.service.StoreOfficialAlbumService;
|
|
|
import shop.alien.store.util.GroupConstant;
|
|
|
+import shop.alien.store.util.ai.AiContentModerationUtil;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -35,6 +36,8 @@ public class StoreImgController {
|
|
|
private final StoreImgService storeImgService;
|
|
|
private final StoreInfoService storeInfoService;
|
|
|
private final StoreOfficialAlbumService storeOfficialAlbumService;
|
|
|
+ private final AiContentModerationUtil aiContentModerationUtil;
|
|
|
+
|
|
|
@ApiOperation("获取图片")
|
|
|
@ApiOperationSupport(order = 1)
|
|
|
@ApiImplicitParams({@ApiImplicitParam(name = "storeId", value = "门店id", dataType = "Integer", paramType = "query", required = true),
|
|
|
@@ -81,6 +84,14 @@ public class StoreImgController {
|
|
|
if(storeImgInfoVo.getStoreImgList().isEmpty()){
|
|
|
return R.fail("图片列表为空,请重新上传图片");
|
|
|
}
|
|
|
+ // TODO 审核图片是否违规
|
|
|
+ List<String> imageUrls = storeImgList.stream()
|
|
|
+ .map(StoreImg::getImgUrl)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ AiContentModerationUtil.AuditResult auditResult = aiContentModerationUtil.auditContent(null, imageUrls);
|
|
|
+ if (!auditResult.isPassed()) {
|
|
|
+ return R.fail(auditResult.getFailureReason()); // 文本内容异常(包含敏感词)
|
|
|
+ }
|
|
|
// 判断是否是头图(20:单图模式, 21:多图模式)
|
|
|
Integer imgType = storeImgInfoVo.getImgType();
|
|
|
boolean isHeadImage = (imgType == 20 || imgType == 21);
|