1
This commit is contained in:
parent
0f6d03d16b
commit
905c7a8bd5
@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using RestSharp.Extensions;
|
using RestSharp.Extensions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace asg_form.Controllers.Teamregistration
|
namespace asg_form.Controllers.Teamregistration
|
||||||
{
|
{
|
||||||
@ -153,9 +154,10 @@ namespace asg_form.Controllers.Teamregistration
|
|||||||
status = form.status
|
status = form.status
|
||||||
};
|
};
|
||||||
await sub.SaveChangesAsync();
|
await sub.SaveChangesAsync();
|
||||||
return Ok(result);
|
return Ok(new { code = 200, message = "成功修改", data = result });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/api/v1/admin/findRegister")]
|
[Route("/api/v1/admin/findRegister")]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
@ -213,5 +215,32 @@ namespace asg_form.Controllers.Teamregistration
|
|||||||
return Ok(new { code=200,data = result });
|
return Ok(new { code=200,data = result });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Route("api/v1/admin/refuseCom")]
|
||||||
|
[HttpGet]
|
||||||
|
[Authorize]
|
||||||
|
public async Task<ActionResult<string>> refuse_com(int userId)
|
||||||
|
{
|
||||||
|
if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
|
||||||
|
{
|
||||||
|
using (TestDbContext testDb = new TestDbContext())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var query = testDb.T_Comform.Find(userId);
|
||||||
|
var user = await userManager.Users.FirstOrDefaultAsync(u => u.Id == userId);
|
||||||
|
if (query == null || user == null) return Ok(new { code = 404, message = "用户未找到" });
|
||||||
|
query.status = "3";
|
||||||
|
_ = user.officium == null;
|
||||||
|
return Ok(new { code = 200, message = "修改成功" });
|
||||||
|
}catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Ok(new { code = 500, message = "服务器错误" });
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Ok(new error_mb { code = 401, message = "没有管理员,无法设置" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,20 +215,7 @@ namespace asg_form.Controllers
|
|||||||
public string createTime { get; set; }
|
public string createTime { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("api/v1/admin/refuseCom")]
|
|
||||||
[HttpGet]
|
|
||||||
[Authorize]
|
|
||||||
public async Task<ActionResult<string>> refuse_com(int userId)
|
|
||||||
{
|
|
||||||
if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
|
|
||||||
{
|
|
||||||
using (TestDbContext testDb = new TestDbContext())
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Ok(new error_mb { code = 401, message = "没有管理员,无法设置" });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user