修复bug
This commit is contained in:
parent
92e79fbe38
commit
91bd820134
@ -99,7 +99,7 @@ namespace asg_form.Controllers.Team
|
|||||||
if (imageFile == null || imageFile.Length == 0)
|
if (imageFile == null || imageFile.Length == 0)
|
||||||
return BadRequest("Invalid image file.");
|
return BadRequest("Invalid image file.");
|
||||||
// 将文件保存到磁盘
|
// 将文件保存到磁盘
|
||||||
var filePath = Path.Combine(Directory.GetCurrentDirectory(), $"loge/", $"{imageFile.FileName}");
|
var filePath = Path.Combine(Directory.GetCurrentDirectory(), $"loge/", $"{for1.team_name}.png");
|
||||||
using (var stream = new FileStream(filePath, FileMode.Create))
|
using (var stream = new FileStream(filePath, FileMode.Create))
|
||||||
{
|
{
|
||||||
await imageFile.CopyToAsync(stream);
|
await imageFile.CopyToAsync(stream);
|
||||||
|
@ -110,20 +110,26 @@ namespace asg_form.Controllers
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<ActionResult<object>> getmyform()
|
public async Task<ActionResult<object>> getmyform()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
|
string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
|
||||||
var ouser = userManager.Users.Include(a=>a.myteam.role).FirstOrDefault(a => a.Id == id.ToInt64());
|
var ouser = userManager.Users.Include(a => a.myteam.role).FirstOrDefault(a => a.Id == id.ToInt64());
|
||||||
if (ouser.myteam == null)
|
foreach (var role in ouser.myteam.role)
|
||||||
{
|
{
|
||||||
return BadRequest(new error_mb { code = 400, message = "你没有绑定表单" });
|
role.Team = null;
|
||||||
|
}
|
||||||
}
|
|
||||||
foreach (var role in ouser.myteam.role)
|
|
||||||
{
|
|
||||||
role.Team = null;
|
|
||||||
}
|
|
||||||
return Ok(ouser.myteam);
|
return Ok(ouser.myteam);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
|
return BadRequest(new error_mb { code = 400, message = "你没有绑定表单" });
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user