Explorar el Código

解决喜欢字段没有变的问题

zc hace 3 meses
padre
commit
02199114d2

+ 5 - 3
alien-store/src/main/java/shop/alien/store/controller/StoreStaffConfigController.java

@@ -5,6 +5,8 @@ import io.swagger.annotations.*;
 import springfox.documentation.annotations.ApiIgnore;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.*;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.StoreStaffConfig;
@@ -282,9 +284,9 @@ public class StoreStaffConfigController {
             }
 
             // 获取用户ID(可能为null,如果用户未登录)
-            Integer userId = null;
-            if (userLoginInfo != null) {
-                userId = userLoginInfo.getUserId();
+            String userId = "";
+            if (userLoginInfo != null && StringUtils.isNoneBlank(userLoginInfo.getType()) && StringUtils.isNoneBlank(userLoginInfo.getUserPhone())) {
+                userId = userLoginInfo.getType()+ "_" + userLoginInfo.getUserPhone();
             }
 
             // 调用服务层查询

+ 1 - 1
alien-store/src/main/java/shop/alien/store/service/StoreStaffConfigService.java

@@ -135,7 +135,7 @@ public interface StoreStaffConfigService {
      * @param userId 当前登录用户ID,可为null(未登录时)
      * @return 员工详情(包含演出列表),如果员工不存在则返回null
      */
-    shop.alien.entity.store.vo.StoreStaffDetailWithPerformanceVo queryStaffDetailWithPerformance(Integer id, Integer userId);
+    shop.alien.entity.store.vo.StoreStaffDetailWithPerformanceVo queryStaffDetailWithPerformance(Integer id, String userId);
 
     /**
      * 获取美食员工列表

+ 4 - 4
alien-store/src/main/java/shop/alien/store/service/impl/StoreStaffConfigServiceImpl.java

@@ -943,7 +943,7 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
      * @return 员工详情(包含演出列表),如果员工不存在则返回null
      */
     @Override
-    public StoreStaffDetailWithPerformanceVo queryStaffDetailWithPerformance(Integer id, Integer userId) {
+    public StoreStaffDetailWithPerformanceVo queryStaffDetailWithPerformance(Integer id, String userId) {
         log.info("查询员工详情(包含演出列表),id={},userId={}", id, userId);
 
         // 参数校验
@@ -1828,16 +1828,16 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
      * @param userId 用户ID,可为null(未登录时返回false)
      * @return true-已喜欢,false-未喜欢
      */
-    private Boolean checkIsLiked(Integer staffId, Integer userId) {
+    private Boolean checkIsLiked(Integer staffId, String userId) {
         // 如果用户未登录,返回false
-        if (userId == null || userId <= 0) {
+        if (StringUtils.isEmpty(userId)) {
             return false;
         }
 
         try {
             LambdaQueryWrapper<LifeLikeRecord> queryWrapper = new LambdaQueryWrapper<>();
             queryWrapper.eq(LifeLikeRecord::getType, "8") // 8-点赞员工
-                    .eq(LifeLikeRecord::getDianzanId, String.valueOf(userId))
+                    .eq(LifeLikeRecord::getDianzanId, userId)
                     .eq(LifeLikeRecord::getHuifuId, String.valueOf(staffId))
                     .eq(LifeLikeRecord::getDeleteFlag, 0);
             long count = lifeLikeRecordMapper.selectCount(queryWrapper);