添加数据库模板 修缮环境变量

This commit is contained in:
niyyzf 2024-07-02 14:37:11 +08:00
parent 2a3a46ca9c
commit a480e4b0ca
3 changed files with 6 additions and 2 deletions

View File

@ -16,6 +16,9 @@ public class UserController(UserManager<ApplicationUser> userManager) : Controll
var userId = HttpContext.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier)!.Value; var userId = HttpContext.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier)!.Value;
// 获取用户的信息 // 获取用户的信息
var user = await userManager.FindByIdAsync(userId); var user = await userManager.FindByIdAsync(userId);
if (user == null) return BadRequest("用户不存在");
//获取role
var roles = await userManager.GetRolesAsync(user);
// 创建一个匿名对象,只包含您想要公开的信息 // 创建一个匿名对象,只包含您想要公开的信息
var userInfo = new var userInfo = new
@ -33,6 +36,7 @@ public class UserController(UserManager<ApplicationUser> userManager) : Controll
user.Avatar, user.Avatar,
user.Desc, user.Desc,
user.Posts, user.Posts,
Role = roles[0],
}; };
// 返回用户信息 // 返回用户信息

BIN
LoongPanel-Asp/apptemp.db Normal file

Binary file not shown.

View File

@ -1 +1 @@
NUXT_API_URL="http://192.168.0.13:5253" NUXT_API_URL="http://127.0.0.1:5253"