diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/Users/Dtos/MyProfileOutput.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/Users/Dtos/MyProfileOutput.cs new file mode 100644 index 00000000..3660bdcc --- /dev/null +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/Users/Dtos/MyProfileOutput.cs @@ -0,0 +1,20 @@ +namespace Lion.AbpPro.BasicManagement.Users.Dtos; + +public class MyProfileOutput +{ + public Guid? TenantId { get; set; } + + public string UserName { get; set; } + + public string Name { get; set; } + + public string Surname { get; set; } + + public string Email { get; set; } + + public string PhoneNumber { get; set; } + + public bool IsActive { get; set; } + + public bool TwoFactorEnabled { get; set; } +} \ No newline at end of file diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/Users/IUserAppService.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/Users/IUserAppService.cs index 549ca61c..3954d7a2 100644 --- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/Users/IUserAppService.cs +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/Users/IUserAppService.cs @@ -57,5 +57,10 @@ namespace Lion.AbpPro.BasicManagement.Users /// 通过username获取用户信息 /// Task FindByUserNameAsync(FindByUserNameInput input); + + /// + /// 获取个人信息 + /// + Task MyProfileAsync(); } } \ No newline at end of file diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/BasicManagementApplicationAutoMapperProfile.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/BasicManagementApplicationAutoMapperProfile.cs index 2b24bda8..7a50105b 100644 --- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/BasicManagementApplicationAutoMapperProfile.cs +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/BasicManagementApplicationAutoMapperProfile.cs @@ -35,5 +35,6 @@ public class BasicManagementApplicationAutoMapperProfile : Profile CreateMap(); CreateMap(); CreateMap(); + CreateMap(); } } \ No newline at end of file diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Users/UserAppService.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Users/UserAppService.cs index e0cda457..a40daa93 100644 --- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Users/UserAppService.cs +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Users/UserAppService.cs @@ -179,5 +179,15 @@ namespace Lion.AbpPro.BasicManagement.Users } return ObjectMapper.Map(user); } + + public virtual async Task MyProfileAsync() + { + var user = await _userManager.FindByIdAsync(CurrentUser.GetId().ToString()); + if (user == null) + { + throw new BusinessException(BasicManagementErrorCodes.UserNotExist); + } + return ObjectMapper.Map(user); + } } } \ No newline at end of file diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.HttpApi/Systems/UserController.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.HttpApi/Systems/UserController.cs index 25b29255..e52c98a2 100644 --- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.HttpApi/Systems/UserController.cs +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.HttpApi/Systems/UserController.cs @@ -84,5 +84,12 @@ namespace Lion.AbpPro.BasicManagement.Systems { return _userAppService.FindByUserNameAsync(input); } + + [HttpPost("myProfile")] + [SwaggerOperation(summary: "获取个人信息", Tags = new[] { "Users" })] + public Task MyProfileAsync() + { + return _userAppService.MyProfileAsync(); + } } } \ No newline at end of file