Преглед на файлове

打卡广场 @GetMapping("/getStoreClockInList") 报500bug

lutong преди 2 месеца
родител
ревизия
feb2914ce5
променени са 1 файла, в които са добавени 8 реда и са изтрити 0 реда
  1. 8 0
      alien-store/src/main/java/shop/alien/store/controller/StoreClockInController.java

+ 8 - 0
alien-store/src/main/java/shop/alien/store/controller/StoreClockInController.java

@@ -1,5 +1,6 @@
 package shop.alien.store.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import io.swagger.annotations.*;
 import lombok.RequiredArgsConstructor;
@@ -11,6 +12,7 @@ import shop.alien.entity.store.UserLoginInfo;
 import shop.alien.entity.store.vo.StoreClockInVo;
 import shop.alien.store.annotation.TrackEvent;
 import shop.alien.store.service.StoreClockInService;
+import shop.alien.util.common.JwtUtil;
 import shop.alien.util.common.TokenInfo;
 import springfox.documentation.annotations.ApiIgnore;
 
@@ -51,6 +53,12 @@ public class StoreClockInController {
     @GetMapping("/getStoreClockInList")
     public R<IPage<StoreClockInVo>> getStoreClockInList(Integer userId, int page, int size, String phoneId, int mySelf, @RequestParam(required = false) Integer storeId) {
         log.info("StoreClockInController.getStoreClockInList?userId={},page={},size={},phoneId={},mySelf={},storeId={}", userId, page, size, phoneId, mySelf,storeId);
+        if (userId==null){
+            JSONObject data = JwtUtil.getCurrentUserInfo();
+            if (null != data) {
+                userId = data.getInteger("userId");
+            }
+        }
         return R.data(storeClockInService.getStoreClockInList(userId, page, size, phoneId, mySelf,storeId));
     }