schedule
This commit is contained in:
parent
8fcfd3708e
commit
798668d94f
@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using NPOI.OpenXmlFormats.Spreadsheet;
|
||||
using Castle.Components.DictionaryAdapter;
|
||||
using Flandre.Core.Messaging;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
|
||||
|
||||
namespace asg_form.Controllers
|
||||
{
|
||||
@ -25,7 +26,7 @@ namespace asg_form.Controllers
|
||||
[Authorize]
|
||||
[Route("api/v1/admin/game")]
|
||||
[HttpPut]
|
||||
public async Task<ActionResult<string>> gameput(long gameid,[FromBody] req_team_game req)
|
||||
public async Task<ActionResult<object>> gameput(long gameid,[FromBody] req_team_game req)
|
||||
{
|
||||
|
||||
string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
|
||||
@ -85,7 +86,7 @@ namespace asg_form.Controllers
|
||||
[Authorize]
|
||||
[Route("api/v1/admin/game")]
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<string>> gamepost([FromBody] req_team_game req)
|
||||
public async Task<ActionResult<object>> gamepost([FromBody] req_team_game req)
|
||||
{
|
||||
|
||||
string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
|
||||
@ -117,10 +118,10 @@ namespace asg_form.Controllers
|
||||
};
|
||||
|
||||
wp = 1;
|
||||
testDb.team_Games.Add(ins);
|
||||
await testDb.SaveChangesAsync();
|
||||
return Ok(new { code = 200, message = "加入成功" });
|
||||
await testDb.team_Games.AddAsync(ins);
|
||||
await testDb.SaveChangesAsync();
|
||||
}
|
||||
return Ok(new { code = 200, message = "加入成功" });
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -327,8 +328,29 @@ namespace asg_form.Controllers
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Authorize]
|
||||
[Route("api/v1/game/final")]
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<object>> finSc(long gameid,FinalScore msg)
|
||||
{
|
||||
using(var db = new TestDbContext())
|
||||
{
|
||||
try
|
||||
{
|
||||
var query = db.team_Games.FirstOrDefault(n => n.id == gameid);
|
||||
if (query == null) return Ok(new { code = 404, message = "未找到比赛" });
|
||||
query.final_score = msg.finalScore;
|
||||
await db.SaveChangesAsync();
|
||||
return Ok(new { code = 200, message = "结果已存入" });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var innerException = ex.InnerException ?? ex; // 如果没有 InnerException,使用 ex 本身
|
||||
// 记录错误信息
|
||||
return Ok(new { code = 500, message = "服务器错误", details = innerException.Message});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class schedule_log
|
||||
@ -370,6 +392,7 @@ namespace asg_form.Controllers
|
||||
public string? judge { get; set; }
|
||||
public int com_limit { get; set; } = 2;
|
||||
public string? person_type { get; set; }
|
||||
public string? final_score { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@ -397,11 +420,15 @@ namespace asg_form.Controllers
|
||||
public string? personType { get; set; }
|
||||
}
|
||||
|
||||
public class FinalScore
|
||||
{
|
||||
public string finalScore { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user