This commit is contained in:
2026-02-08 18:43:20 +08:00
parent ed95bdddac
commit eff83a9f68
11 changed files with 132 additions and 39 deletions
+12 -2
View File
@@ -5,6 +5,7 @@ using IM_API.Tools;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
@@ -45,7 +46,7 @@ namespace IM_API.Controllers
{
var userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
int userId = int.Parse(userIdStr);
var userinfo = await _userService.UpdateUserAsync(userId,dto);
var userinfo = await _userService.UpdateUserAsync(userId, dto);
var res = new BaseResponse<UserInfoDto>(userinfo);
return Ok(res);
@@ -84,7 +85,7 @@ namespace IM_API.Controllers
{
var userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
int userId = int.Parse(userIdStr);
await _userService.ResetPasswordAsync(userId,dto.OldPassword,dto.Password);
await _userService.ResetPasswordAsync(userId, dto.OldPassword, dto.Password);
return Ok(new BaseResponse<object?>());
}
/// <summary>
@@ -100,5 +101,14 @@ namespace IM_API.Controllers
await _userService.UpdateOlineStatusAsync(userId, dto.OnlineStatus);
return Ok(new BaseResponse<object?>());
}
[HttpPost]
[ProducesResponseType(typeof(BaseResponse<List<UserInfoDto>>), StatusCodes.Status200OK)]
public async Task<IActionResult> GetUserList([FromBody][Required]List<int> ids)
{
var users = await _userService.GetUserInfoListAsync(ids);
var res = new BaseResponse<List<UserInfoDto>>(users);
return Ok(res);
}
}
}