| | |
| | | package com.ard.framework.security.handle; |
| | | |
| | | import com.ard.common.constant.CacheConstants; |
| | | import com.ard.common.constant.Constants; |
| | | import com.ard.common.core.redis.RedisCache; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | |
| | | public void onAuthenticationSuccess(Long userId) { |
| | | // 检查 Redis 中是否已有该用户登录 |
| | | String key = "login_userid:" + userId; |
| | | String key = CacheConstants.LOGIN_USERID_KEY + userId; |
| | | if (redisCache.hasKey(key)) { |
| | | throw new RuntimeException("用户已登录,请勿重复登录"); |
| | | } |