Bläddra i källkod

[fix]
1、审核接口去掉token过滤
2、增加token信息打印

limeng 4 månader sedan
förälder
incheckning
d1156ad92b

+ 1 - 1
application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/WebsiteTourismProjectTravelNotesController.java

@@ -113,7 +113,7 @@ public class WebsiteTourismProjectTravelNotesController {
      * param type 0取消收藏 1收藏
      * @return 应答结果对象,包含查询结果集。
      */
-    @SaIgnore
+//    @SaIgnore
     @OperationLog(type = SysOperationLogType.UPDATE)
     @PostMapping("/userCollectTravelNotesUpdate")
     public ResponseResult<Void> userCollectTravelNotesUpdate(@RequestBody TourismCollectDto tourismCollectDto) {

+ 0 - 1
application-webadmin/src/main/java/com/tourism/webadmin/back/controller/TourismProjectTravelNotesWriteController.java

@@ -114,7 +114,6 @@ public class TourismProjectTravelNotesWriteController {
     }
 
 
-    @SaIgnore
     @SaCheckPermission("tourismProjectTravelNotesWrite.update")
     @OperationLog(type = SysOperationLogType.UPDATE)
     @PostMapping("/audit")

+ 13 - 0
common/common-satoken/src/main/java/com/tourism/common/satoken/util/SaTokenUtil.java

@@ -12,6 +12,8 @@ import cn.hutool.core.util.ReflectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.tourism.common.core.cache.CacheConfig;
 import com.tourism.common.core.constant.ApplicationConstant;
 import com.tourism.common.core.constant.ErrorCodeEnum;
@@ -22,6 +24,7 @@ import com.tourism.common.core.util.AopTargetUtil;
 import com.tourism.common.core.util.MyCommonUtil;
 import com.tourism.common.core.util.RedisKeyUtil;
 import com.tourism.common.satoken.annotation.SaTokenDenyAuth;
+import lombok.extern.slf4j.Slf4j;
 import org.redisson.api.RMap;
 import org.redisson.api.RSet;
 import org.redisson.api.RTopic;
@@ -48,6 +51,7 @@ import java.util.*;
  * @author 吃饭睡觉
  * @date 2024-09-06
  */
+@Slf4j
 @Component
 public class SaTokenUtil {
 
@@ -119,12 +123,21 @@ public class SaTokenUtil {
         }
         Method method = ((HandlerMethod) handler).getMethod();
         String errorMessage;
+        ObjectMapper mapper = new ObjectMapper();
         //如果没有登录则直接交给satoken注解去验证。
         if (!StpUtil.isLogin()) {
             // 如果此 Method 或其所属 Class 标注了 @SaIgnore,则忽略掉鉴权
             if (BooleanUtil.isTrue(SaStrategy.instance.isAnnotationPresent.apply(method, SaIgnore.class))) {
                 return ResponseResult.success();
             }
+            try {
+//            log.info("request::::::::{}", mapper.writeValueAsString(request));
+//            log.info("handler::::::::{}", mapper.writeValueAsString(handler));
+                log.info("StpUtil::::::::getTokenInfo:::{}", mapper.writeValueAsString(StpUtil.getTokenInfo()));
+//            log.info("StpUtil::::::::getTokenSession:::{}", mapper.writeValueAsString(StpUtil.getTokenSession()));
+            } catch (JsonProcessingException e) {
+                throw new RuntimeException(e);
+            }
             errorMessage = "非免登录接口必须包含Token信息!";
             return ResponseResult.error(HttpServletResponse.SC_UNAUTHORIZED, ErrorCodeEnum.UNAUTHORIZED_LOGIN, errorMessage);
         }