修复bug

This commit is contained in:
杨毅 2024-09-16 14:06:46 +08:00
parent 92e79fbe38
commit 91bd820134
2 changed files with 19 additions and 13 deletions

View File

@ -99,7 +99,7 @@ namespace asg_form.Controllers.Team
if (imageFile == null || imageFile.Length == 0)
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))
{
await imageFile.CopyToAsync(stream);

View File

@ -110,19 +110,25 @@ namespace asg_form.Controllers
[HttpGet]
public async Task<ActionResult<object>> getmyform()
{
try {
string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
var ouser = userManager.Users.Include(a => a.myteam.role).FirstOrDefault(a => a.Id == id.ToInt64());
foreach (var role in ouser.myteam.role)
{
role.Team = null;
}
return Ok(ouser.myteam);
string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
var ouser = userManager.Users.Include(a=>a.myteam.role).FirstOrDefault(a => a.Id == id.ToInt64());
if (ouser.myteam == null)
}
catch
{
return BadRequest(new error_mb { code = 400, message = "你没有绑定表单" });
}
foreach (var role in ouser.myteam.role)
{
role.Team = null;
}
return Ok(ouser.myteam);