diff --git a/asg_form/Controllers/AssignmentController.cs b/asg_form/Controllers/AssignmentController.cs index 30e7ca4..316cc77 100644 --- a/asg_form/Controllers/AssignmentController.cs +++ b/asg_form/Controllers/AssignmentController.cs @@ -219,12 +219,16 @@ namespace asg_form.Controllers query = query.Where(n => n.status == status); } - var customOrder = new[] { '1','0','3','2' }; + // var customOrder = new[] { "1","0","3","2" }; var TotalRecords = await query.CountAsync(); var Tasks = await query - .OrderByDescending(a => System.Array.IndexOf(customOrder, a.status)) + .OrderByDescending(t => t.status == "1" ? 0 : + t.status == "0" ? 1 : + t.status == "3" ? 2 : + t.status == "2" ? 3 : + int.MaxValue) .Skip((page - 1) * limit) .Take(limit) .ToListAsync(); diff --git a/asg_form/Controllers/Budget/BgCountController.cs b/asg_form/Controllers/Budget/BgCountController.cs index 698d273..65c6398 100644 --- a/asg_form/Controllers/Budget/BgCountController.cs +++ b/asg_form/Controllers/Budget/BgCountController.cs @@ -20,8 +20,8 @@ namespace asg_form.Controllers.Budget public long source_event_id { get; set; } public string used_event_name { get; set; } public long used_event_id { get; set; } - //public string use_person { get; set; } - //public long use_person_id { get; set; } + public string? use_person { get; set; } + public long? use_person_id { get; set; } public string change_time { get; set; } public string use_status { get; set; } public string? update_person { get; set; }//设置默认 @@ -83,7 +83,7 @@ namespace asg_form.Controllers.Budget used_event_name = msg.usedEventName, used_event_id = msg.usedEventId, use_status = "0", - update_person = null,///// + update_person = msg.updatePerson, update_time = dateString, }; sub.budgetDetails.Add(budget); @@ -176,8 +176,8 @@ namespace asg_form.Controllers.Budget return NotFound(new { code = 404, message = "预算记录未找到" }); } budget.use_status = "1"; - //budget.use_person = request.UsePerson; - //budget.use_personId = request.UsePersonId; + budget.use_person = request.UsePerson; + budget.use_person_id = request.UsePersonId; budget.change_time = DateTime.Now.ToString(); await db.SaveChangesAsync(); return Ok(new { code = 200, message = "更新使用情况成功" }); diff --git a/asg_form/Controllers/Champion.cs b/asg_form/Controllers/Champion.cs index 9142275..cb8e8b8 100644 --- a/asg_form/Controllers/Champion.cs +++ b/asg_form/Controllers/Champion.cs @@ -1,4 +1,5 @@ using Manganese.Array; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -47,16 +48,28 @@ namespace asg_form.Controllers - [Route("api/v1/admin/Champion/")] + [Route("api/v1/admin/Champion/")] [HttpPost] + [Authorize] public async Task> Postchampion([FromBody]req_Champion req) { if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin")) { TestDbContext testDb = new TestDbContext(); - var form = testDb.Forms.First(x => x.Id == req.formId); - var events = testDb.events.First(x => x.name == req.eventname); - testDb.Champions.Add(new T_Champion { events = events, form = form ,msg=req.msg}); + int err = 0; + try + { + var form = testDb.Forms.First(x => x.Id == req.formId); + err = 1; + var events = testDb.events.First(x => x.name == req.eventname); + err = 2; + testDb.Champions.Add(new T_Champion { events = events, form = form ,msg=req.msg}); + err = 3; + } + catch (Exception ex) + { + return Ok(new { code = 500, message = "服务器错误",detailcode=err, details = ex.Message }); + } await testDb.SaveChangesAsync(); return Ok(); } diff --git a/asg_form/Controllers/Events.cs b/asg_form/Controllers/Events.cs index e08f358..df36191 100644 --- a/asg_form/Controllers/Events.cs +++ b/asg_form/Controllers/Events.cs @@ -71,7 +71,7 @@ namespace asg_form.Controllers [Authorize] [Route("api/v1/admin/Events")] [HttpPut] - public async Task>> putevent(string event_name, [FromBody] T_events events) + public async Task>> putevent(string event_name, [FromBody] T_events_debug events) { if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin")) @@ -186,4 +186,16 @@ namespace asg_form.Controllers public string? promChart { get; set; } } + + public class T_events_debug + { + public string? name { get; set; } + public bool? is_over { get; set; } + public DateTime? opentime { get; set; } + public List Teams { get; set; } = new List(); + public List
? forms { get; set; } + public Uri? events_rule_uri { get; set; } + public string? promChart { get; set; } + + } }