diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/context/SecurityContextHolder.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/context/SecurityContextHolder.java index 0a66f38..ef20081 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/context/SecurityContextHolder.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/context/SecurityContextHolder.java @@ -56,6 +56,12 @@ public class SecurityContextHolder return Convert.toLong(get(SecurityConstants.DETAILS_USER_ID), 0L); } + public static String getStringUserId() + { + return Convert.toStr(get(SecurityConstants.DETAILS_USER_ID),""); + } + + public static void setUserId(String account) { set(SecurityConstants.DETAILS_USER_ID, account); diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/JwtUtils.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/JwtUtils.java index abe93c0..8fa6713 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/JwtUtils.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/JwtUtils.java @@ -15,7 +15,8 @@ import io.jsonwebtoken.SignatureAlgorithm; */ public class JwtUtils { - public static String secret = TokenConstants.SECRET; + // public static String secret = TokenConstants.SECRET; + public final static String secret ="yisaichangsha";//先写死,后面配置文件配置 /** * 从数据声明生成令牌