zhaowenxuan
17 小时以前 dedacd79c93f8ef95e0cb986f5e7fbd27ddbd907
ltkj-framework/src/main/java/com/ltkj/framework/web/service/TokenService.java
@@ -47,7 +47,7 @@
    private static final Long MILLIS_MINUTE_TEN = 20 * 60 * 1000L;
    private static final Long MILLIS_DAY = 60 * MILLIS_SECOND * 60 * 24;
    private static final long MILLIS_DAY = 60 * MILLIS_SECOND * 60 * 24;
    @Autowired
    private RedisCache redisCache;
@@ -71,6 +71,13 @@
            }
        }
        return null;
    }
    public LoginUser getLoginUser(Claims claims){
        // 解析对应的权限以及用户信息
        String uuid = (String) claims.get(Constants.LOGIN_USER_KEY);
        String userKey = getTokenKey(uuid);
        return redisCache.getCacheObject(userKey);
    }
    /**
@@ -141,11 +148,11 @@
        loginUser.setExpireTime(loginUser.getLoginTime() + MILLIS_DAY);
        // 根据uuid将loginUser缓存
        String userKey = getTokenKey(loginUser.getToken());
        redisCache.setCacheObject(userKey, loginUser, Math.toIntExact(MILLIS_DAY), TimeUnit.MINUTES);
        redisCache.setCacheObject(userKey, loginUser,1, TimeUnit.DAYS);
        if (!soloLogin) {
            // 缓存用户唯一标识,防止同一帐号,同时登录
            String userIdKey = getUserIdKey(loginUser.getUser().getUserId());
            redisCache.setCacheObject(userIdKey, userKey, Math.toIntExact(MILLIS_DAY), TimeUnit.MINUTES);
            redisCache.setCacheObject(userIdKey, userKey, 1, TimeUnit.DAYS);
        }
    }
@@ -186,7 +193,7 @@
     * @param token 令牌
     * @return 数据声明
     */
    private Claims parseToken(String token) {
    public Claims parseToken(String token) {
        return Jwts.parser()
                .setSigningKey(secret)
                .parseClaimsJws(token)