This commit is contained in:
王炜翔 2024-09-04 10:31:51 +08:00
parent 78ca97db24
commit 4effb66e28

View File

@ -114,7 +114,7 @@ namespace asg_form.Controllers
string userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value; string userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
var user = await userManager.FindByIdAsync(userId); var user = await userManager.FindByIdAsync(userId);
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin")) if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "nadmin"))
{ {
return Ok(new error_mb { code = 401, message = "无权访问" }); return Ok(new error_mb { code = 401, message = "无权访问" });
} }
@ -126,6 +126,7 @@ namespace asg_form.Controllers
{ {
task.status = "2"; task.status = "2";
user.Integral += task.money; user.Integral += task.money;
user.Integral = user.Integral > 200 ? 200 : user.Integral;
} }
if (isPassed == 3) if (isPassed == 3)
{ {
@ -163,7 +164,7 @@ namespace asg_form.Controllers
{ {
//string encodedChinaname = HttpUtility.UrlEncode(chinaname); //string encodedChinaname = HttpUtility.UrlEncode(chinaname);
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin")) if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "nadmin"))
{ {
return Ok(new error_mb { code = 401, message = "无权访问" }); return Ok(new error_mb { code = 401, message = "无权访问" });
} }