This commit is contained in:
王炜翔 2025-01-22 11:40:30 +08:00
parent 72b7ef4d7b
commit 6f4a8bb894
5 changed files with 48 additions and 33 deletions

View File

@ -54,7 +54,7 @@ namespace asg_form.Controllers
[Route("api/v1/com/")]
[HttpPost]
[Authorize]
public async Task<ActionResult<string>> com_post(long gameid)
public async Task<ActionResult<object>> com_post(long gameid)
{
string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
var user = await userManager.FindByIdAsync(id);
@ -68,6 +68,7 @@ namespace asg_form.Controllers
TestDbContext testDb = new TestDbContext();
string chinaname = user.chinaname;
var teamgame = await testDb.team_Games.FirstAsync(a => a.id == gameid);
if (teamgame.isAllowChoose == 0) return Ok(new error_mb { code = 401, message = "无法选择该比赛" });
var com = JsonConvert.DeserializeObject<List<com_json>>(teamgame.commentary);
com.Add(new com_json { id = id.ToInt32(), chinaname = chinaname });
teamgame.commentary = JsonConvert.SerializeObject(com);
@ -133,6 +134,7 @@ namespace asg_form.Controllers
foreach (var gameId in gameIdArray)
{
var teamgame = await testDb.team_Games.FirstOrDefaultAsync(a => a.id == gameId);
if (teamgame.isAllowChoose == 0) return Ok(new error_mb { code = 401, message = "存在无法选择的比赛" });
if (teamgame != null)
{
teamgame.referee = chinaname;

View File

@ -220,7 +220,11 @@ namespace asg_form.Controllers.Teamregistration
var TotalRecords = await query.CountAsync();
var Tasks = await query
.OrderBy(a => a.status)
.OrderByDescending(t => t.status == "1" ? 3 :
t.status == "5" ? 2 :
t.status == "3" ? 1 :
t.status == "2" ? 0 :
10)
.Skip((page - 1) * limit)
.Take(limit)
.ToListAsync();

View File

@ -7,6 +7,10 @@ using Microsoft.EntityFrameworkCore;
using AsmResolver.DotNet.Resources;
using SharpCompress.Archives;
using System.Management;
using Flandre.Core.Common;
using Flandre.Core.Messaging.Segments;
using Flandre.Core.Messaging;
using System.Threading.Tasks;
namespace asg_form.Controllers {
public class FileDB
@ -116,7 +120,7 @@ namespace asg_form.Controllers {
try
{
var query2 = await sub.T_Comform.FirstOrDefaultAsync(n => n.id == auditinfo.relativeId);
if (query2 != null) query2.status = "5";
if (query2 != null && auditinfo.nowAuthPerson != "archive") query2.status = "5";
}
catch (Exception ex)
{
@ -124,6 +128,12 @@ namespace asg_form.Controllers {
}
}
sub.SaveChanges();
string mesg = $"ASG管理系统您有新的业务待办需要处理请及时上后台系统推进流程。";
string qqgroup = "925510646";
var atuserqq = auditinfo.nowAuthPersonId.ToString();
if (atuserqq == null) return Ok(new { code = 500, message = "服务器错误" });
var message = new MessageBuilder().Add(new AtSegment(atuserqq)).Text(mesg).Build();
await runbot.runbotr.SendMessageAsync(MessageEnvironment.Channel, qqgroup, null, message, qqgroup);
return Ok(new { code = 200, message = "成功修改" });
}
else
@ -156,7 +166,7 @@ namespace asg_form.Controllers {
try
{
var query2 = await sub.T_Comform.FirstOrDefaultAsync(n => n.id == auditinfo.relativeId);
if (query2 != null) query2.status = "5";
if (query2 != null && auditinfo.nowAuthPerson != "archive") query2.status = "5";
}
catch (Exception ex)
{
@ -165,6 +175,12 @@ namespace asg_form.Controllers {
}
sub.T_Audit.Add(newAudit);
sub.SaveChanges();
string mesg = $"ASG管理系统您有新的业务待办需要处理请及时上后台系统推进流程。";
string qqgroup = "925510646";
var atuserqq = auditinfo.nowAuthPersonId.ToString();
if (atuserqq == null) return Ok(new { code = 500, message = "服务器错误" });
var message = new MessageBuilder().Add(new AtSegment(atuserqq)).Text(mesg).Build();
await runbot.runbotr.SendMessageAsync(MessageEnvironment.Channel, qqgroup, null, message, qqgroup);
return Ok(new { code = 200, message = "成功新增" });
}
}

View File

@ -1,11 +0,0 @@
namespace asg_form.Controllers
{
public class game
{
}
}

View File

@ -55,6 +55,7 @@ namespace asg_form.Controllers
game.belong = req.belong;
game.tag=req.tag;
game.judge = req.judge;
game.isAllowChoose = 1;
wp = 1;
game.commentary = req.commentary;
if(req.comLimit != null)
@ -124,6 +125,7 @@ namespace asg_form.Controllers
Remarks = req.Remarks,
com_limit = req.comLimit,
person_type = req.personType,
isAllowChoose = 1,
};
wp = 1;
@ -168,6 +170,7 @@ namespace asg_form.Controllers
TestDbContext testDb = new TestDbContext();
team_game game=testDb.team_Games.Include(a=>a.logs).First(a=>a.id==teamid);
game.winteam = winteam;
game.isAllowChoose = 0;
foreach(var log in game.logs)
{
if (log.chickteam == winteam)
@ -488,6 +491,7 @@ namespace asg_form.Controllers
public string? person_type { get; set; }
public string? final_score { get; set; }
public string? Remarks { get; set; }
public int isAllowChoose { get; set; }
}