登录捕获RedisSystemException异常

This commit is contained in:
liyawei
2022-06-10 18:10:35 +08:00
parent 820006fe18
commit 66acf744a8
@@ -24,6 +24,7 @@ import com.jero.common.util.SpringContextUtils;
import com.jero.common.util.oConvertUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.redis.RedisSystemException;
import org.springframework.data.redis.serializer.SerializationException;
import org.springframework.stereotype.Component;
@@ -152,13 +153,12 @@ public class ShiroRealm extends AuthorizingRealm {
// 查询用户信息
log.debug("———校验token是否有效————checkUserTokenIsEffect——————— "+ token);
LoginUser loginUser = null;
loginUser = commonAPI.getUserByName(username);
/*try {
try {
loginUser = commonAPI.getUserByName(username);
}catch (SerializationException e){
LoginException.loginException(401,"用户不存在!");
}catch (RedisSystemException e){
LoginException.loginException(401,"Token失效,请重新登录!");
return null;
}*/
}
if (loginUser == null) {
LoginException.loginException(401,"用户不存在!");
return null;