From 33caf2bb79bb3c561916c91ae386ec772411e2e8 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期一, 11 五月 2026 18:21:50 +0800
Subject: [PATCH] 代码生成

---
 server/services/src/main/java/com/doumee/config/jwt/JwtTokenUtil.java |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/server/services/src/main/java/com/doumee/config/jwt/JwtTokenUtil.java b/server/services/src/main/java/com/doumee/config/jwt/JwtTokenUtil.java
index 508a36a..e988f6c 100644
--- a/server/services/src/main/java/com/doumee/config/jwt/JwtTokenUtil.java
+++ b/server/services/src/main/java/com/doumee/config/jwt/JwtTokenUtil.java
@@ -27,6 +27,10 @@
 
     public static final String HEADER_KEY = "token";
 
+    public static final String SHOP_HEADER_KEY = "shopToken";
+
+
+
     public static final String MEMBER_ID = "MEMBER_ID";
 
     public static final String SHOP_ID = "SHOP_ID";
@@ -81,6 +85,7 @@
     public static String generateTokenForRedis(Integer userId, Integer userType, String userInfo, RedisTemplate<String,Object> redisTemplate) {
         // 鍒犻櫎璇ョ敤鎴蜂箣鍓嶇櫥褰曠殑token
         String userTokenMappingKey = Constants.REDIS_TOKEN_KEY + "user_" + userType + "_" + userId;
+
         String oldToken = (String) redisTemplate.opsForValue().get(userTokenMappingKey);
         if (StringUtils.isNotBlank(oldToken)) {
             redisTemplate.delete(Constants.REDIS_TOKEN_KEY + oldToken);
@@ -94,6 +99,22 @@
     }
 
 
+    public static String generateShopTokenForRedis(Integer userId, String userInfo, RedisTemplate<String,Object> redisTemplate) {
+        // 鍒犻櫎璇ョ敤鎴蜂箣鍓嶇櫥褰曠殑token
+        String userTokenMappingKey = Constants.REDIS_TOKEN_KEY + "user_" + Constants.TWO + "_" + userId;
+        String oldToken = (String) redisTemplate.opsForValue().get(userTokenMappingKey);
+        if (StringUtils.isNotBlank(oldToken)) {
+            redisTemplate.delete(Constants.REDIS_TOKEN_KEY + oldToken);
+        }
+        // 鐢熸垚鏂皌oken
+        String tokenKey = Constants.TWO +""+ UUID.randomUUID() + "_" + userId;
+        redisTemplate.opsForValue().set(Constants.REDIS_TOKEN_KEY + tokenKey, userInfo, redisExpire, TimeUnit.DAYS);
+        // 璁板綍鐢ㄦ埛涓巘oken鐨勬槧灏勫叧绯�
+        redisTemplate.opsForValue().set(userTokenMappingKey, tokenKey, redisExpire, TimeUnit.DAYS);
+        return tokenKey;
+    }
+
+
     /**
      * 鍒锋柊浠ょ墝
      *

--
Gitblit v1.9.3