소스 검색

Merge remote-tracking branch 'origin/sit' into sit

wuchen 2 달 전
부모
커밋
82173d8344
1개의 변경된 파일28개의 추가작업 그리고 24개의 파일을 삭제
  1. 28 24
      alien-store/src/main/java/shop/alien/store/service/impl/StoreCommentAppealServiceImpl.java

+ 28 - 24
alien-store/src/main/java/shop/alien/store/service/impl/StoreCommentAppealServiceImpl.java

@@ -761,35 +761,39 @@ public class StoreCommentAppealServiceImpl extends ServiceImpl<StoreCommentAppea
         // 商家图片:暂时传空数组,先测试文本分析流程
         // TODO: 后续需要将图片转换为Base64
         List<String> merchantImages = new ArrayList<>();
-        // if (org.springframework.util.StringUtils.hasText(storeCommentAppeal.getImgId())) {
-        //     String[] imgIds = storeCommentAppeal.getImgId().split(",");
-        //     for (String imgId : imgIds) {
-        //         StoreImg storeImg = storeImgMapper.selectById(imgId.trim());
-        //         if (storeImg != null && org.springframework.util.StringUtils.hasText(storeImg.getImgUrl())) {
-        //             String base64 = convertImageToBase64(storeImg.getImgUrl());
-        //             if (org.springframework.util.StringUtils.hasText(base64)) {
-        //                 merchantImages.add(base64);
-        //             }
-        //         }
-        //     }
-        // }
+         if (org.springframework.util.StringUtils.hasText(storeCommentAppeal.getImgId())) {
+             String[] imgIds = storeCommentAppeal.getImgId().split(",");
+             for (String imgId : imgIds) {
+                 StoreImg storeImg = storeImgMapper.selectById(imgId.trim());
+//                 if (storeImg != null && org.springframework.util.StringUtils.hasText(storeImg.getImgUrl())) {
+//                     String base64 = convertImageToBase64(storeImg.getImgUrl());
+//                     if (org.springframework.util.StringUtils.hasText(base64)) {
+//                         merchantImages.add(base64);
+//                     }
+//                 }
+                 if (storeImg.getImgUrl() != null) {
+                     merchantImages.add(storeImg.getImgUrl());
+                 }
+             }
+         }
         analyzeRequest.put("merchant_images", merchantImages);
         
         // 用户图片:暂时传空数组,先测试文本分析流程
         // TODO: 后续需要将图片转换为Base64
         List<String> userImages = new ArrayList<>();
-        // if (org.springframework.util.StringUtils.hasText(rating.getImageUrls())) {
-        //     String[] imageUrls = rating.getImageUrls().split(",");
-        //     for (String imageUrl : imageUrls) {
-        //         String trimmedUrl = imageUrl.trim();
-        //         if (org.springframework.util.StringUtils.hasText(trimmedUrl)) {
-        //             String base64 = convertImageToBase64(trimmedUrl);
-        //             if (org.springframework.util.StringUtils.hasText(base64)) {
-        //                 userImages.add(base64);
-        //             }
-        //         }
-        //     }
-        // }
+         if (org.springframework.util.StringUtils.hasText(rating.getImageUrls())) {
+             String[] imageUrls = rating.getImageUrls().split(",");
+             for (String imageUrl : imageUrls) {
+                 String trimmedUrl = imageUrl.trim();
+//                 if (org.springframework.util.StringUtils.hasText(trimmedUrl)) {
+//                     String base64 = convertImageToBase64(trimmedUrl);
+//                     if (org.springframework.util.StringUtils.hasText(base64)) {
+//                         userImages.add(base64);
+//                     }
+//                 }
+                 userImages.add(trimmedUrl);
+             }
+         }
         analyzeRequest.put("user_images", userImages);
         
         // 其他字段(可选)