1
This commit is contained in:
parent
8b8a0010db
commit
b1fe6994f1
@ -343,11 +343,18 @@ namespace asg_form.Controllers
|
||||
[Route("api/v1/user/")]
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<post_user>> getuser(bool showbase64=true)
|
||||
{
|
||||
int wp = 0;
|
||||
try
|
||||
{
|
||||
string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
|
||||
wp = 1;
|
||||
var user = await userManager.FindByIdAsync(id);
|
||||
wp = 2;
|
||||
var isadmin = await userManager.IsInRoleAsync(user, "admin");
|
||||
wp = 3;
|
||||
List<string> roles = (List<string>)await userManager.GetRolesAsync(user);
|
||||
wp = 4;
|
||||
if (showbase64) {
|
||||
return new post_user { id = id.ToInt64(), money = user.Integral, Base64 = user.UserBase64, name = user.UserName, chinaname = user.chinaname, email = user.Email, isadmin = isadmin, Roles = roles, officium = user.officium ,qqnumber=user.qqnumber};
|
||||
}
|
||||
@ -356,6 +363,11 @@ namespace asg_form.Controllers
|
||||
return new post_user { id = id.ToInt64(), money = user.Integral, name = user.UserName, chinaname = user.chinaname, email = user.Email, isadmin = isadmin, Roles = roles, officium = user.officium, qqnumber = user.qqnumber };
|
||||
|
||||
}
|
||||
}catch (Exception ex)
|
||||
{
|
||||
return Ok(new { code = 500, message = "服务器错误", ex,wp });
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user