1
This commit is contained in:
parent
8b8a0010db
commit
b1fe6994f1
@ -344,18 +344,30 @@ namespace asg_form.Controllers
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<ActionResult<post_user>> getuser(bool showbase64=true)
|
public async Task<ActionResult<post_user>> getuser(bool showbase64=true)
|
||||||
{
|
{
|
||||||
string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
|
int wp = 0;
|
||||||
var user = await userManager.FindByIdAsync(id);
|
try
|
||||||
var isadmin = await userManager.IsInRoleAsync(user, "admin");
|
|
||||||
List<string> roles = (List<string>)await userManager.GetRolesAsync(user);
|
|
||||||
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};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
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 };
|
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};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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