2.16的三个问题
This commit is contained in:
parent
5a66aa6af8
commit
6be74d6921
@ -216,7 +216,7 @@ namespace asg_form.Controllers
|
|||||||
var invitor = await userManager.Users.FirstOrDefaultAsync(u => u.Id == record.user_id);
|
var invitor = await userManager.Users.FirstOrDefaultAsync(u => u.Id == record.user_id);
|
||||||
var theGame = sub.team_Games.FirstOrDefault(i => i.id == record.match_id);
|
var theGame = sub.team_Games.FirstOrDefault(i => i.id == record.match_id);
|
||||||
if (invitor == null) return Ok(new { code = 200, message = "被邀请者不存在了" });
|
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
|
var addData = new BeInviteForUsers
|
||||||
{
|
{
|
||||||
id = record.id,
|
id = record.id,
|
||||||
|
@ -42,17 +42,21 @@ namespace asg_form.Controllers.Store
|
|||||||
[Route("api/v1/admin/Store")]
|
[Route("api/v1/admin/Store")]
|
||||||
[HttpDelete]
|
[HttpDelete]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public async Task<ActionResult<object>> DelStore(long id)
|
public async Task<ActionResult<object>> DelStore(string id)
|
||||||
{
|
{
|
||||||
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
|
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
|
||||||
{
|
{
|
||||||
return BadRequest(new error_mb { code = 400, message = "无权访问" });
|
return BadRequest(new error_mb { code = 400, message = "无权访问" });
|
||||||
}
|
}
|
||||||
using (TestDbContext sb = new TestDbContext())
|
using (TestDbContext sb = new TestDbContext()) {
|
||||||
|
var commondity = sb.T_Store.FirstOrDefault(n => n.id.ToString() == id);
|
||||||
|
if (commondity == null)
|
||||||
{
|
{
|
||||||
sb.T_Store.Remove(sb.T_Store.Find(id));
|
return Ok(new error_mb { code = 500, message = "商品不存在" });
|
||||||
|
}
|
||||||
|
sb.T_Store.Remove(commondity);
|
||||||
await sb.SaveChangesAsync();
|
await sb.SaveChangesAsync();
|
||||||
return Ok("ok");
|
return Ok(new error_mb { code = 200, message = "商品已移除" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[Route("api/v1/admin/Store")]
|
[Route("api/v1/admin/Store")]
|
||||||
|
@ -143,7 +143,7 @@ namespace asg_form.Controllers {
|
|||||||
|
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return Ok(new error_mb { code = 200, message = "机器人错误" });
|
return Ok(new error_mb { code = 500, message = "机器人错误" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -198,7 +198,7 @@ namespace asg_form.Controllers {
|
|||||||
|
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return Ok(new error_mb { code = 200, message = "机器人错误" });
|
return Ok(new error_mb { code = 500, message = "机器人错误" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user