From 20b11236b4364034f52df294b9240776f539ede1 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 16 七月 2024 14:49:01 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/zbomyoujia

---
 server/service/src/main/java/com/doumee/config/Jwt/WebMvcConfig.java |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/config/Jwt/WebMvcConfig.java b/server/service/src/main/java/com/doumee/config/Jwt/WebMvcConfig.java
index a5b106c..8fd806c 100644
--- a/server/service/src/main/java/com/doumee/config/Jwt/WebMvcConfig.java
+++ b/server/service/src/main/java/com/doumee/config/Jwt/WebMvcConfig.java
@@ -13,6 +13,7 @@
 import io.jsonwebtoken.JwtException;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.data.redis.core.RedisTemplate;
@@ -40,6 +41,12 @@
 
     @Autowired
     private RedisTemplate<String,Object> redisTemplate;
+
+    /**
+     * 鏄惁寮�鍙戣��
+     */
+    @Value("${debug_model}")
+    private Boolean isDebug;
 
     /**
      * 娣诲姞鎷︽埅鍣�
@@ -111,6 +118,7 @@
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐢ㄦ埛宸茬鐢�,璇疯仈绯荤鐞嗗憳");
             }
             request.setAttribute(JwtTokenUtil.UserId_Name, memberId);
+            request.setAttribute(JwtTokenUtil.UserType, Constants.CUSTOMER);
             return true;
         } catch (IllegalArgumentException | JwtException e) {
             throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"鏈櫥褰�");
@@ -120,6 +128,9 @@
     public Boolean checkPersonnelLogin(HttpServletRequest request, HttpServletResponse response){
         String token = request.getHeader(JwtTokenUtil.HEADER_KEY);
         try {
+            if(isDebug){
+                return  true;
+            }
             //鍒ゆ柇Token鏄惁瓒呮椂
             boolean expiration = JwtTokenUtil.isTokenExpired(token);
             if (expiration) {
@@ -142,6 +153,7 @@
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐢ㄦ埛宸茬鐢�,璇疯仈绯荤鐞嗗憳");
             }
             request.setAttribute(JwtTokenUtil.UserId_Name, userId);
+            request.setAttribute(JwtTokenUtil.UserType, Constants.BUSINESS);
             return true;
         } catch (IllegalArgumentException | JwtException e) {
             throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"鏈櫥褰�");

--
Gitblit v1.9.3