diff --git a/asg_form/Controllers/InviteReferee.cs b/asg_form/Controllers/InviteReferee.cs index f7ba24a..50af14a 100644 --- a/asg_form/Controllers/InviteReferee.cs +++ b/asg_form/Controllers/InviteReferee.cs @@ -216,7 +216,7 @@ namespace asg_form.Controllers var invitor = await userManager.Users.FirstOrDefaultAsync(u => u.Id == record.user_id); var theGame = sub.team_Games.FirstOrDefault(i => i.id == record.match_id); if (invitor == null) return Ok(new { code = 200, message = "被邀请者不存在了" }); - if (theGame.belong == null) return Ok(new { code = 200, message = "没有比赛资料" }); + if (theGame==null || theGame.belong == null) return Ok(new { code = 500, message = "没有比赛资料" }); var addData = new BeInviteForUsers { id = record.id, diff --git a/asg_form/Controllers/Store/Storehttp.cs b/asg_form/Controllers/Store/Storehttp.cs index c27ce0a..605a38e 100644 --- a/asg_form/Controllers/Store/Storehttp.cs +++ b/asg_form/Controllers/Store/Storehttp.cs @@ -42,17 +42,21 @@ namespace asg_form.Controllers.Store [Route("api/v1/admin/Store")] [HttpDelete] [Authorize] - public async Task> DelStore(long id) + public async Task> DelStore(string id) { if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin")) { return BadRequest(new error_mb { code = 400, message = "无权访问" }); } - using (TestDbContext sb = new TestDbContext()) - { - sb.T_Store.Remove(sb.T_Store.Find(id)); + using (TestDbContext sb = new TestDbContext()) { + var commondity = sb.T_Store.FirstOrDefault(n => n.id.ToString() == id); + if (commondity == null) + { + return Ok(new error_mb { code = 500, message = "商品不存在" }); + } + sb.T_Store.Remove(commondity); await sb.SaveChangesAsync(); - return Ok("ok"); + return Ok(new error_mb { code = 200, message = "商品已移除" }); } } [Route("api/v1/admin/Store")] diff --git a/asg_form/Controllers/auditAndFilingController.cs b/asg_form/Controllers/auditAndFilingController.cs index 123391a..3aaff4f 100644 --- a/asg_form/Controllers/auditAndFilingController.cs +++ b/asg_form/Controllers/auditAndFilingController.cs @@ -143,7 +143,7 @@ namespace asg_form.Controllers { catch { - return Ok(new error_mb { code = 200, message = "机器人错误" }); + return Ok(new error_mb { code = 500, message = "机器人错误" }); } } else @@ -198,7 +198,7 @@ namespace asg_form.Controllers { catch { - return Ok(new error_mb { code = 200, message = "机器人错误" }); + return Ok(new error_mb { code = 500, message = "机器人错误" }); } } }