From d8def7dd6750fb69ae3daecc2be86c6548324c29 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E7=82=9C=E7=BF=94?= <2307953404@qq.com>
Date: Tue, 12 Nov 2024 21:57:32 +0800
Subject: [PATCH] 1
---
.../Controllers/auditAndFilingController.cs | 37 ++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
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 });
+ }
+ }
+ }
}
}