diff --git a/asg_form/Controllers/auditAndFilingController.cs b/asg_form/Controllers/auditAndFilingController.cs index f875091..2161980 100644 --- a/asg_form/Controllers/auditAndFilingController.cs +++ b/asg_form/Controllers/auditAndFilingController.cs @@ -4,6 +4,9 @@ using Microsoft.AspNetCore.Mvc; using System.Security.Claims; using Manganese.Array; using Microsoft.EntityFrameworkCore; +using AsmResolver.DotNet.Resources; +using SharpCompress.Archives; +using System.Management; namespace asg_form.Controllers { public class FileDB @@ -107,7 +110,7 @@ namespace asg_form.Controllers { proj_no = auditinfo.projNo, proj_name = auditinfo.projName, budget_use = auditinfo.budgetUse, - status = "4", + status = auditinfo.status, budget_name = auditinfo.budgetName, biz_type = auditinfo.bizType, budget_id = auditinfo.budgetId, @@ -188,5 +191,37 @@ namespace asg_form.Controllers { } } + + /// + /// Id改status为4 + /// + [Route("api/v1/admin/statusChange4")] + [HttpGet] + [Authorize] + public async Task> statusChange4([FromQuery] string 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 = "无权访问" }); + + } + using (TestDbContext sub = new TestDbContext()) + { + var query = sub.T_Audit.FirstOrDefault(n => n.id == Id); + try + { + if(query == null) return Ok(new error_mb { code = 404, message = "没有对应记录" }); + query.status = "4"; + await sub.SaveChangesAsync(); + return Ok(new error_mb { code = 200, message = "对应的status已经更改" }); + } + catch (Exception ex) + { + return Ok(new { code = 500, message = "服务器错误", ex }); + } + } + } } }