解说加入时间
This commit is contained in:
parent
c48ff0418e
commit
23df6cacca
@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Authorization;
|
|||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.Data;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using static asg_form.blog;
|
using static asg_form.blog;
|
||||||
|
|
||||||
@ -183,8 +184,32 @@ namespace asg_form.Controllers
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class timeSet
|
||||||
|
{
|
||||||
|
public string joinTime { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 职位时间设置接口
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Authorize]
|
||||||
|
[Route("api/v1/user/settime")]
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<ActionResult<object>> 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的时间!" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ namespace asg_form
|
|||||||
//public List<string>? Roles { get; set; }
|
//public List<string>? Roles { get; set; }
|
||||||
public string? roleListName { get; set; }
|
public string? roleListName { get; set; }
|
||||||
public string? roleListCode { get; set; }
|
public string? roleListCode { get; set; }
|
||||||
|
public string? joinTime { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Role : IdentityRole<long>
|
public class Role : IdentityRole<long>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user