using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using System.Security.Claims; namespace asg_form.Controllers { [Route("api/[controller]/[action]")] public class qqbotr : ControllerBase { private readonly RoleManager roleManager; private readonly UserManager userManager; public qqbotr( RoleManager roleManager, UserManager userManager) { this.roleManager = roleManager; this.userManager = userManager; } /// /// 设置qq号 /// /// /// [HttpPost] [Authorize] public async Task> qqnumber(string qqnumber) { string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value; var user = await userManager.FindByIdAsync(id); user.qqnumber= qqnumber; var r = await userManager.UpdateAsync(user); return Ok("修改成功"); } } }