CloudGamingAdmin/admin-server/CloudGaming.Api.Admin/Controllers/Systems/SysUserController.cs
2024-11-15 02:58:48 +08:00

27 lines
906 B
C#

namespace CloudGaming.Api.Admin.Controllers.Systems;
/// <summary>
/// 系统账号管理
/// </summary>
[ControllerDescriptor(MenuId = "15", DisplayName = "系统账号")]
public class SysUserController(IServiceProvider serviceProvider)
: AdminControllerBase<SysUserService, SysUser, Guid, SysUser, SysUserFormDto>(serviceProvider)
{
/// <summary>
/// 获取用户信息
/// </summary>
/// <returns></returns>
[ActionDescriptor(DisplayName = "获取当前用户信息")]
[ApiResourceCacheFilter(20)]
[HttpGet(Name = "info")]
public async Task<AccountContext> GetUserInfoAsync()
{
var accountContext = await Service.GetUserInfoAsync();
if (accountContext == null)
{
throw MessageBox.CreateMessage(R.ResultMessage(HttpStatusCode.Unauthorized, "未授权,请先授权访问!"));
}
return accountContext;
}
}