Ver Fonte

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

dujian há 1 semana atrás
pai
commit
04e2bb60d4

+ 6 - 0
alien-entity/src/main/java/shop/alien/entity/store/LifeUser.java

@@ -180,4 +180,10 @@ public class LifeUser implements Serializable {
     @ApiModelProperty(value = "获赞数")
     @TableField(exist = false)
     private Integer likeCount;
+
+
+    @ApiModelProperty(value = "是否弹窗(0默认允许弹窗  1拒绝弹窗 )")
+    @TableField("is_popup")
+    private Integer isPopup;
+
 }

+ 33 - 0
alien-store/src/main/java/shop/alien/store/controller/LifeUserController.java

@@ -197,4 +197,37 @@ public class LifeUserController {
         log.info("LifeUserController.getUserByPhone?phone={}", phone);
         return R.data(service.getUserByPhone(phone));
     }
+
+    //查询用户弹窗状态
+    @GetMapping("/getUserByIsPopup")
+    public R<Boolean> getUserByIsPopup(@RequestParam("id") String id) {
+        log.info("LifeUserController.getUserByIsPopup?userId={}", id);
+        LifeUser user = lifeUserMapper.selectById(id);
+        if (user == null){
+            return R.fail("用户不存在");
+        }
+        if (user.getIsPopup() == 1){
+            return R.data(false);
+        }
+        return R.data(true);
+    }
+
+    //保存用户弹窗状态
+    @GetMapping("/saveUserByIsPopup")
+    public R<Boolean> saveUserByIsPopup(@RequestParam("id") String id, @RequestParam("isPopup") int isPopup) {
+        log.info("LifeUserController.getUserByIsPopup?userId={}", id);
+        LifeUser user = lifeUserMapper.selectById(id);
+        if (user == null){
+            return R.fail("用户不存在");
+        }
+        user.setIsPopup(isPopup);
+        // 更新用户弹窗状态
+        int a =lifeUserMapper.updateById(user);
+        if (a <= 0){
+            return R.fail("更新用户弹窗状态失败");
+        }
+        return R.data(true);
+    }
+
+
 }

+ 32 - 0
alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

@@ -6007,6 +6007,12 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
             List<String> storeAlbumUrlList = storeAlbumList.stream().map(StoreImg::getImgUrl)  // 假设 StoreImg 有 getStoreUrl() 方法
                     .filter(url -> url != null && !url.trim().isEmpty())  // 过滤空值
                     .collect(Collectors.toList());
+            // 相册首项为视频时,在列表首位插入商家入口图,供客户端展示封面
+            String firstAlbumUrl = storeAlbumUrlList.get(0);
+            if (isVideoUrl(firstAlbumUrl)) {
+                String image = firstAlbumUrl + "?x-oss-process=video/snapshot,t_0,f_jpg,w_800,h_600,m_fast,ar_auto";
+                storeAlbumUrlList.add(image);
+            }
             result.setStoreAlbumUrlList(storeAlbumUrlList);
         } else {
             result.setStoreAlbumUrlList(new ArrayList<>());
@@ -7962,6 +7968,32 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         }
     }
 
+    /**
+     * 判断 URL 是否为视频(按常见视频后缀,忽略查询参数)
+     *
+     * @param url 资源地址
+     * @return 是否为视频
+     */
+    private boolean isVideoUrl(String url) {
+        if (StringUtils.isEmpty(url)) {
+            return false;
+        }
+        String path = url;
+        int queryIndex = path.indexOf('?');
+        if (queryIndex > 0) {
+            path = path.substring(0, queryIndex);
+        }
+        String lowerPath = path.toLowerCase();
+        return lowerPath.endsWith(".mp4")
+                || lowerPath.endsWith(".avi")
+                || lowerPath.endsWith(".flv")
+                || lowerPath.endsWith(".mkv")
+                || lowerPath.endsWith(".rmvb")
+                || lowerPath.endsWith(".wmv")
+                || lowerPath.endsWith(".3gp")
+                || lowerPath.endsWith(".mov");
+    }
+
 }