Ver código fonte

fix:酒吧演出(图文审核文字和图片分开审核)

panzhilin 3 meses atrás
pai
commit
669644e9e2

+ 17 - 6
alien-store/src/main/java/shop/alien/store/service/impl/BarPerformanceServiceImpl.java

@@ -197,14 +197,15 @@ public class BarPerformanceServiceImpl implements BarPerformanceService {
         }
 
         // 8. 图文内容审核(调用AI内容审核接口)- 新增或更新时都必须进行
-        // - 文本:名称 + 详情 + 须知 + 风格(如果有
+        // - 文本:名称 + 风格 + 演出详情文字 + 演出须知(文本字段,不包含图片URL
         // - 图片:海报URL(如果有) + 图文详情图片URL(如果有)
         String moderationText = buildModerationText(barPerformance);
         List<String> imageUrls = new ArrayList<>();
+        // 添加演出海报到图片审核列表
         if (StringUtils.isNotEmpty(barPerformance.getPerformancePoster())) {
             imageUrls.add(barPerformance.getPerformancePoster());
         }
-        // 添加图文详情图片到审核列表
+        // 添加图文详情图片到图片审核列表(performanceDetail是图片URL列表,只做图片审核)
         if (StringUtils.isNotEmpty(barPerformance.getPerformanceDetail())) {
             String[] detailImages = barPerformance.getPerformanceDetail().split(",");
             for (String imageUrl : detailImages) {
@@ -213,7 +214,8 @@ public class BarPerformanceServiceImpl implements BarPerformanceService {
                 }
             }
         }
-        // 调用AI内容审核接口,如果检测到违规内容会抛出异常
+        // 调用AI内容审核接口,文本和图片分开审核
+        // 如果检测到违规内容会抛出异常
         AiContentModerationUtil.AuditResult auditResult = aiContentModerationUtil.auditContent(moderationText, imageUrls);
         if (auditResult == null || !auditResult.isPassed()) {
             // AI审核失败,设置审核状态为2(审核拒绝)并记录拒绝原因
@@ -560,26 +562,35 @@ public class BarPerformanceServiceImpl implements BarPerformanceService {
         return second1 < second2;
     }
 
+    /**
+     * 构建AI审核文本内容
+     * 只包含文本字段,不包含图片URL
+     * 
+     * @param barPerformance 演出信息
+     * @return 审核文本内容
+     */
     private String buildModerationText(BarPerformance barPerformance) {
         StringBuilder sb = new StringBuilder();
         if (barPerformance == null) {
             return "";
         }
+        // 演出名称(文本)
         if (StringUtils.isNotEmpty(barPerformance.getPerformanceName())) {
             sb.append("演出名称:").append(barPerformance.getPerformanceName()).append("\n");
         }
+        // 演出风格(文本)
         if (StringUtils.isNotEmpty(barPerformance.getPerformanceStyle())) {
             sb.append("演出风格:").append(barPerformance.getPerformanceStyle()).append("\n");
         }
+        // 演出详情文字(文本,performanceContent字段)
         if (StringUtils.isNotEmpty(barPerformance.getPerformanceContent())) {
             sb.append("演出详情:").append(barPerformance.getPerformanceContent()).append("\n");
         }
+        // 演出须知(文本)
         if (StringUtils.isNotEmpty(barPerformance.getPerformanceNotice())) {
             sb.append("演出须知:").append(barPerformance.getPerformanceNotice()).append("\n");
         }
-        if (StringUtils.isNotEmpty(barPerformance.getPerformanceDetail())) {
-            sb.append("图文详情:").append(barPerformance.getPerformanceDetail()).append("\n");
-        }
+        // 注意:performanceDetail是图片URL列表,不作为文本审核,只作为图片审核
         return sb.toString();
     }
 }