优化登录账号获取方法,优化定时器文案
This commit is contained in:
+15
-2
@@ -153,9 +153,22 @@ public class AuthUtils implements BaseParams {
|
||||
* @return LoginUser
|
||||
*/
|
||||
public static LoginUserDto get() {
|
||||
LoginUserDto dto = getDefNull();
|
||||
if (Objects.isNull(dto)) {
|
||||
throw new UnauthorizedError();
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 LoginUser
|
||||
*
|
||||
* @return LoginUser
|
||||
*/
|
||||
public static LoginUserDto getDefNull() {
|
||||
Map<String, Object> map = CommonHolder.get();
|
||||
if (CollectionUtils.isEmpty(map)) {
|
||||
throw new UnauthorizedError();
|
||||
return null;
|
||||
}
|
||||
if (map.get(BootCommonConstant.AUTH) instanceof LoginUserDto loginUserDto) {
|
||||
return loginUserDto;
|
||||
@@ -163,7 +176,7 @@ public class AuthUtils implements BaseParams {
|
||||
if (map.get(BootCommonConstant.AUTHORIZATION) instanceof String accessToken) {
|
||||
return get(accessToken);
|
||||
}
|
||||
throw new UnauthorizedError();
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user