From a3f4bffcc53e3186a2568e2be1c91b3327aa5e89 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E7=82=9C=E7=BF=94?= <2307953404@qq.com>
Date: Sun, 24 Nov 2024 21:54:00 +0800
Subject: [PATCH] =?UTF-8?q?11.24=E7=9A=84=E6=9B=B4=E6=96=B0=EF=BC=8C?=
=?UTF-8?q?=E4=B8=BB=E8=A6=81=E6=98=AF=E5=AE=A1=E6=A0=B8=E4=B8=9A=E5=8A=A1?=
=?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=92=8C=E7=94=B3=E8=AF=B7=E8=A1=A8=E7=9B=B8?=
=?UTF-8?q?=E5=85=B3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Teamregistration/RegisterController.cs | 38 ++++++++++++-------
1 file changed, 24 insertions(+), 14 deletions(-)
diff --git a/asg_form/Controllers/Teamregistration/RegisterController.cs b/asg_form/Controllers/Teamregistration/RegisterController.cs
index c0344ab..2f991c2 100644
--- a/asg_form/Controllers/Teamregistration/RegisterController.cs
+++ b/asg_form/Controllers/Teamregistration/RegisterController.cs
@@ -283,22 +283,32 @@ namespace asg_form.Controllers.Teamregistration
}
return Ok(new error_mb { code = 401, message = "没有管理员,无法设置" });
}
- }
- ///
- /// 根据主键id找申请表所有内容T_Comform
- ///
- [Route("api/v1/admin/findFormById")]
- [HttpGet]
- [Authorize]
- public async Task> find_by_id(int Id)
- {
- string userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
- var user = await userManager.FindByIdAsync(userId);
- if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
+ ///
+ /// 根据主键id找申请表所有内容T_Comform
+ ///
+ [Route("api/v1/admin/findFormById")]
+ [HttpGet]
+ [Authorize]
+ public async Task> find_by_id(int Id)
{
- return Ok(new error_mb { code = 401, message = "无权访问" });
+ string userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
+ var user = await userManager.FindByIdAsync(userId);
+ if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
+ {
+ return Ok(new error_mb { code = 401, message = "无权访问" });
+ }
+ using (TestDbContext sub = new TestDbContext())
+ {
+ var query = sub.T_Comform.AsQueryable()
+ .Where(n => n.id == Id)
+ .OrderByDescending(a => a.user_id);
+
+ var result = await query.ToListAsync();
+
+ return Ok(new { code = 200, data = result });
+ }
}
-
}
+
}