11.24的更新,主要是审核业务相关和申请表相关

This commit is contained in:
王炜翔 2024-11-24 21:54:00 +08:00
parent ea4715a8bb
commit a3f4bffcc5

View File

@ -283,22 +283,32 @@ namespace asg_form.Controllers.Teamregistration
} }
return Ok(new error_mb { code = 401, message = "没有管理员,无法设置" }); return Ok(new error_mb { code = 401, message = "没有管理员,无法设置" });
} }
} /// <summary>
/// <summary> /// 根据主键id找申请表所有内容T_Comform
/// 根据主键id找申请表所有内容T_Comform /// </summary>
/// </summary> [Route("api/v1/admin/findFormById")]
[Route("api/v1/admin/findFormById")] [HttpGet]
[HttpGet] [Authorize]
[Authorize] public async Task<ActionResult<object>> find_by_id(int Id)
public async Task<ActionResult<object>> 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"))
{ {
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 });
}
} }
} }
} }