using Admin.NET.Core;
using Furion;
using Furion.FriendlyException;
namespace Admin.NET.Application
{
///
/// 当前用户
///
public static class CurrentUserInfo
{
///
/// 用户id
///
public static long UserId => App.User.FindFirst(ClaimConst.CLAINM_USERID) == null ? throw Oops.Oh(SysConst.SYS_SESSION_OUT) : long.Parse(App.User.FindFirst(ClaimConst.CLAINM_USERID)?.Value);
///
/// 账号
///
public static string Account => App.User.FindFirst(ClaimConst.CLAINM_ACCOUNT) == null ? throw Oops.Oh(SysConst.SYS_SESSION_OUT) : App.User.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
///
/// 昵称
///
public static string Name => App.User.FindFirst(ClaimConst.CLAINM_NAME) == null ? throw Oops.Oh(SysConst.SYS_SESSION_OUT) : App.User.FindFirst(ClaimConst.CLAINM_NAME)?.Value;
///
/// 是否超级管理员
///
public static bool IsSuperAdmin => App.User.FindFirst(ClaimConst.CLAINM_SUPERADMIN)?.Value == ((int)AdminType.SuperAdmin).ToString();
}
}