zjh
2025-01-24 2b39b654975aa9cb40254f20e545b9f389a82de7
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;
@@ -141,11 +141,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);
        }
    }