diff --git a/asg_form/Controllers/user_form.cs b/asg_form/Controllers/user_form.cs
index 78aafad..41d5bc7 100644
--- a/asg_form/Controllers/user_form.cs
+++ b/asg_form/Controllers/user_form.cs
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
+using System.Data;
using System.Security.Claims;
using static asg_form.blog;
@@ -183,10 +184,34 @@ namespace asg_form.Controllers
}
-
-
+ public class timeSet
+ {
+ public string joinTime { get; set; }
}
+ ///
+ /// 职位时间设置接口
+ ///
+ ///
+ [Authorize]
+ [Route("api/v1/user/settime")]
+ [HttpPost]
+ public async Task> settime([FromBody] timeSet msg)
+ {
+
+ string userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
+ var user = await userManager.FindByIdAsync(userId);
+ if(user.officium != "Commentator")
+ {
+ return Ok(new { code = 200, message = "你不是解说,不参与排名!" });
+ }
+ user.joinTime = msg.joinTime;
+ await userManager.UpdateAsync(user);
+ return Ok(new { code = 200, message = "你成功修改了自己加入ASG的时间!" });
+ }
+ }
+
+
}
diff --git a/asg_form/User.cs b/asg_form/User.cs
index 00dcfe1..27d09da 100644
--- a/asg_form/User.cs
+++ b/asg_form/User.cs
@@ -29,6 +29,7 @@ namespace asg_form
//public List? Roles { get; set; }
public string? roleListName { get; set; }
public string? roleListCode { get; set; }
+ public string? joinTime { get; set; }
}
public class Role : IdentityRole