From 23df6caccabdbae222f9c3ec642f62e7b4ba3c8f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E7=82=9C=E7=BF=94?= <2307953404@qq.com>
Date: Wed, 9 Apr 2025 23:04:55 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E8=AF=B4=E5=8A=A0=E5=85=A5=E6=97=B6?=
=?UTF-8?q?=E9=97=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
asg_form/Controllers/user_form.cs | 29 +++++++++++++++++++++++++++--
asg_form/User.cs | 1 +
2 files changed, 28 insertions(+), 2 deletions(-)
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