diff --git a/AGSS/Controllers/User/UserControllers.cs b/AGSS/Controllers/User/UserControllers.cs index 3e0891d..8e16b8e 100644 --- a/AGSS/Controllers/User/UserControllers.cs +++ b/AGSS/Controllers/User/UserControllers.cs @@ -39,21 +39,20 @@ public class UserControllers:ControllerBase [HttpGet] public async Task My() { - string userId = this.User.FindFirst(JwtRegisteredClaimNames.Sub)!.Value; - if (string.IsNullOrEmpty(userId)) - { - return Ok(new ReturnTemplate(500,"获取用户失败(JWT解析错误)",null)); - } + + + + + string userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value; try { var userProfile = await _userService.GetUserProfileAsync(userId); - return Ok(new ReturnTemplate(200,"获取成功!",userProfile)); + return Ok(new ReturnTemplate(200, "获取成功!", userProfile)); } catch (ArgumentException ex) { return NotFound(ex.Message); } - } } \ No newline at end of file diff --git a/AGSS/Models/DTOs/UserProfile.cs b/AGSS/Models/DTOs/UserProfile.cs index 063ab64..4c47f59 100644 --- a/AGSS/Models/DTOs/UserProfile.cs +++ b/AGSS/Models/DTOs/UserProfile.cs @@ -11,4 +11,6 @@ public class UserProfile public string? JobCode { get; set; } public string? JobName { get; set; } public string? Birthday { get; set; } + public string? MenuCode { get; set; } + public string? MenuName { get; set; } } diff --git a/AGSS/Services/UserService.cs b/AGSS/Services/UserService.cs index f688a12..343c590 100644 --- a/AGSS/Services/UserService.cs +++ b/AGSS/Services/UserService.cs @@ -29,7 +29,9 @@ public class UserService Config = user.Config, JobCode = user.JobCode, JobName = user.JobName, - Birthday = user.Birthday + Birthday = user.Birthday, + MenuCode = user.MenuCode, + MenuName = user.MenuName }; } }