mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-21 18:57:12 +08:00
chore: 忽略获取在线用户信息异常
This commit is contained in:
@@ -23,8 +23,6 @@ import cn.hutool.extra.spring.SpringUtil;
|
||||
import top.continew.starter.core.util.ExceptionUtils;
|
||||
import top.continew.starter.extension.crud.service.CommonUserService;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 用户上下文 Holder
|
||||
*
|
||||
@@ -142,7 +140,7 @@ public class UserContextHolder {
|
||||
* @return 用户 ID
|
||||
*/
|
||||
public static Long getUserId() {
|
||||
return Optional.ofNullable(getContext()).map(UserContext::getId).orElse(null);
|
||||
return ExceptionUtils.exToNull(() -> getContext().getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,7 +149,7 @@ public class UserContextHolder {
|
||||
* @return 用户名
|
||||
*/
|
||||
public static String getUsername() {
|
||||
return Optional.ofNullable(getContext()).map(UserContext::getUsername).orElse(null);
|
||||
return ExceptionUtils.exToNull(() -> getContext().getUsername());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user