From f92c3624839b7f94377ee81c57090995455e0ae3 Mon Sep 17 00:00:00 2001 From: caojianbin <1910336823> Date: Fri, 29 Jul 2022 13:49:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=83=E9=99=90=E5=85=AC=E5=85=B1=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E6=94=B9=E9=80=A001?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/common/core/context/SecurityContextHolder.java | 6 ++++++ .../src/main/java/com/ruoyi/common/core/utils/JwtUtils.java | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) 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";//先写死,后面配置文件配置 /** * 从数据声明生成令牌