From c67f82dbe219ef214d5ab010c1fa648f98ce2b06 Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期四, 18 七月 2024 17:06:27 +0800 Subject: [PATCH] 代码提交 --- server/service/src/main/java/com/doumee/config/Jwt/WebMvcConfig.java | 13 +++++++++++++ 1 files changed, 13 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..f856bca 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 @@ -2,6 +2,7 @@ import com.alibaba.fastjson.JSONObject; import com.doumee.biz.system.SystemDictDataBiz; +import com.doumee.biz.zbom.model.zhongtai.ZTConstants; import com.doumee.config.annotation.UserLoginRequired; import com.doumee.config.annotation.LoginRequired; import com.doumee.core.constants.ResponseStatus; @@ -13,6 +14,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 +42,12 @@ @Autowired private RedisTemplate<String,Object> redisTemplate; + + /** + * 鏄惁寮�鍙戣�� + */ + @Value("${debug_model}") + private Boolean isDebug; /** * 娣诲姞鎷︽埅鍣� @@ -111,6 +119,7 @@ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐢ㄦ埛宸茬鐢�,璇疯仈绯荤鐞嗗憳"); } request.setAttribute(JwtTokenUtil.UserId_Name, memberId); + request.setAttribute(JwtTokenUtil.UserType, ZTConstants.CUSTOMER); return true; } catch (IllegalArgumentException | JwtException e) { throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"鏈櫥褰�"); @@ -120,6 +129,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 +154,7 @@ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐢ㄦ埛宸茬鐢�,璇疯仈绯荤鐞嗗憳"); } request.setAttribute(JwtTokenUtil.UserId_Name, userId); + request.setAttribute(JwtTokenUtil.UserType, ZTConstants.BUSINESS); return true; } catch (IllegalArgumentException | JwtException e) { throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"鏈櫥褰�"); -- Gitblit v1.9.3