52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
|
|
using Microsoft.AspNetCore.Mvc;
|
||
|
|
using QYZH.InteractiveMagazine.IService;
|
||
|
|
using QYZH.InteractiveMagazine.IService.Dto;
|
||
|
|
using QYZH.InteractiveMagazine.Models.Common;
|
||
|
|
using QYZH.InteractiveMagazine.Models.Dto;
|
||
|
|
|
||
|
|
namespace QYZH.InteractiveMagazine.WebApi.Controllers;
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 用户控制器
|
||
|
|
/// </summary>
|
||
|
|
[Route("api/[controller]")]
|
||
|
|
[ApiController]
|
||
|
|
public class UsersController : BaseController
|
||
|
|
{
|
||
|
|
private readonly IUsersService _usersService;
|
||
|
|
private readonly ILogger<UsersController> _logger;
|
||
|
|
|
||
|
|
public UsersController(IUsersService usersService, ILogger<UsersController> logger)
|
||
|
|
{
|
||
|
|
_usersService = usersService;
|
||
|
|
_logger = logger;
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 获取用户列表(分页)
|
||
|
|
/// </summary>
|
||
|
|
[HttpGet]
|
||
|
|
public async Task<BaseResponse<PageListModel<UsersOutput>>> GetList([FromQuery] UsersQueryInput input)
|
||
|
|
{
|
||
|
|
return await _usersService.GetListAsync(input);
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 获取用户详情
|
||
|
|
/// </summary>
|
||
|
|
[HttpGet("{id}")]
|
||
|
|
public async Task<BaseResponse<UsersOutput>> GetDetail(long id)
|
||
|
|
{
|
||
|
|
return await _usersService.GetDetailAsync(id);
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 更新用户状态
|
||
|
|
/// </summary>
|
||
|
|
[HttpPut("{id}/status")]
|
||
|
|
public async Task<BaseResponse> UpdateStatus(long id, [FromBody] UpdateUserStatusInput input)
|
||
|
|
{
|
||
|
|
return await _usersService.UpdateStatusAsync(id, input);
|
||
|
|
}
|
||
|
|
}
|