Merge branch 'master' of https://dev.azure.com/luolan/ASG%E7%B3%BB%E7%BB%9F/_git/asg_backend
This commit is contained in:
commit
1ed7f45ae7
@ -36,7 +36,7 @@ namespace asg_form.Controllers
|
||||
{
|
||||
TestDbContext testDb = new TestDbContext();
|
||||
string chinaname = user.chinaname;
|
||||
var teamgame = testDb.team_Games.Where(a => a.commentary.IndexOf(chinaname) >= 0).Select(a => new { a.id, a.team1_name, a.team2_name, a.bilibiliuri, a.commentary, a.referee ,a.opentime,a.team1_piaoshu,a.team2_piaoshu}).OrderByDescending(a => a.opentime).ToList();
|
||||
var teamgame = testDb.team_Games.Where(a => a.commentary.IndexOf(chinaname) >= 0).Select(a => new { a.id, a.team1_name, a.team2_name,a.belong,a.tag, a.bilibiliuri, a.commentary, a.referee,a.judge,a.person_type ,a.opentime,a.team1_piaoshu,a.team2_piaoshu}).OrderByDescending(a => a.opentime).ToList();
|
||||
|
||||
return JsonConvert.SerializeObject(teamgame);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ namespace asg_form.Controllers
|
||||
string Invitorid = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
|
||||
var user = await userManager.FindByIdAsync(Invitorid);
|
||||
long userId = user.Id;
|
||||
if (user.officium != "Commentator" || !this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "nbadmin")) return Ok(new error_mb { code = 401, message = "您不是解说无法完成邀请" });
|
||||
if (user.officium != "Commentator" ) return Ok(new error_mb { code = 401, message = "您不是解说无法完成邀请" });
|
||||
using (TestDbContext sb = new TestDbContext())
|
||||
{
|
||||
try
|
||||
|
@ -231,8 +231,8 @@ namespace asg_form.Controllers.Teamregistration
|
||||
var user = await userManager.Users.FirstOrDefaultAsync(u => u.Id == userId);
|
||||
if (query == null ) return Ok(new { code = 404, message = "用户1未找到" });
|
||||
if (user == null) return Ok(new { code = 404, message = "用户2未找到" });
|
||||
query.status = "4";
|
||||
_ = user.officium == null;
|
||||
query.status = "4";
|
||||
user.officium = null;
|
||||
await testDb.SaveChangesAsync();
|
||||
await userManager.UpdateAsync(user);
|
||||
return Ok(new { code = 200, message = "修改成功" });
|
||||
|
@ -42,13 +42,15 @@ namespace asg_form.Controllers
|
||||
game.team1_name = req.team1_name;
|
||||
game.team2_name = req.team2_name;
|
||||
game.opentime = req.opentime;
|
||||
game.commentary = req.commentary;
|
||||
game.bilibiliuri = req.bilibiliuri;
|
||||
game.referee = req.referee;
|
||||
game.belong = req.belong;
|
||||
game.tag=req.tag;
|
||||
game.judge = req.judge;
|
||||
game.commentary = req.commentary;
|
||||
if(req.comLimit != null)
|
||||
game.com_limit = req.comLimit;
|
||||
else game.com_limit = 2;
|
||||
game.person_type = req.personType;
|
||||
await testDb.SaveChangesAsync();
|
||||
return Ok(new { code = 200, message = "加入成功" });
|
||||
@ -85,10 +87,12 @@ namespace asg_form.Controllers
|
||||
bool a = await userManager.IsInRoleAsync(user, "admin");
|
||||
if (a)
|
||||
{
|
||||
int wp = -1;
|
||||
try
|
||||
{
|
||||
|
||||
using (TestDbContext testDb = new TestDbContext())
|
||||
{
|
||||
{ wp = 0;
|
||||
testDb.team_Games.Add(new team_game
|
||||
{
|
||||
team1_name = req.team1_name,
|
||||
@ -104,13 +108,14 @@ namespace asg_form.Controllers
|
||||
com_limit = req.comLimit,
|
||||
person_type = req.personType,
|
||||
});
|
||||
wp = 1;
|
||||
await testDb.SaveChangesAsync();
|
||||
return Ok(new { code = 200, message = "加入成功" });
|
||||
}
|
||||
|
||||
}catch (Exception ex)
|
||||
{
|
||||
return Ok(new { code = 500, message = "服务器错误", details = ex.Message });
|
||||
return Ok(new { code = 500, message = "服务器错误", details = ex.Message,wp });
|
||||
}
|
||||
|
||||
}
|
||||
@ -181,12 +186,17 @@ namespace asg_form.Controllers
|
||||
TestDbContext testDb = new TestDbContext();
|
||||
team_game game = testDb.team_Games.Include(a => a.logs).First(a => a.id == gameid);
|
||||
testDb.team_Games.Remove(game);
|
||||
var query = testDb.T_Invitation.Where(n => n.match_id == gameid).ToList();
|
||||
if (query.Any())
|
||||
{
|
||||
testDb.T_Invitation.RemoveRange(query);
|
||||
}
|
||||
await testDb.SaveChangesAsync();
|
||||
return "ok";
|
||||
return Ok(new error_mb { code = 200, message = "成功删除" });
|
||||
}
|
||||
else
|
||||
{
|
||||
return BadRequest(new error_mb { code = 400, message = "无权访问" });
|
||||
return Ok(new error_mb { code = 401, message = "无权访问" });
|
||||
|
||||
}
|
||||
|
||||
@ -357,7 +367,7 @@ namespace asg_form.Controllers
|
||||
public Uri? bilibiliuri { get; set;}
|
||||
public string tag { get; set; }
|
||||
public string? judge { get; set; }
|
||||
public int comLimit { get; set; }
|
||||
public int comLimit { get; set; } = 2;
|
||||
public string? personType { get; set; }
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user