You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

78 lines
2.1 KiB

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Znyc.CloudCar.IServices.User;
using Znyc.CloudCar.Model.Dtos.User;
using Znyc.CloudCar.Model.ViewModels.ReportsCallBack;
namespace Znyc.CloudCar.Controller
{
/// <summary>
/// 用户管理
/// </summary>
public class UserController : ControllerBase
{
private readonly IUserService _userService;
private readonly ILogger<UserController> _logger;
public UserController(IUserService userService,
ILogger<UserController> logger
)
{
_userService = userService;
_logger = logger;
}
/// <summary>
/// 根据Id获取用户信息
/// </summary>
/// <returns></returns>
[HttpGet]
[Authorize]
[Route("api/v1/user")]
public async Task<UserOutput> GetUserAsync()
{
return await _userService.GetUserAsync();
}
///// <summary>
///// 根据Id获取用户信息
///// </summary>
///// <param name="id"></param>
///// <returns></returns>
//[HttpGet]
//[Authorize]
//[Route("api/v1/getuser/{id}")]
//public async Task<UserOutput> GetUserByIdAsync(long id)
//{
// return await _userService.GetUserByIdAsync(id);
//}
///// <summary>
/// 修改用户信息
/// </summary>
/// <param name="userUpdateInput"></param>
/// <returns></returns>
[HttpPut]
[Authorize]
[Route("api/v1/user")]
public async Task<ResponseOutput> UpdateAsync([FromBody] UserUpdateInput userUpdateInput)
{
return await _userService.UpdateAsync(userUpdateInput);
}
///// <summary>
///// 获取当前用户信息
///// </summary>
///// <returns></returns>
[HttpGet]
[Authorize]
[Route("api/v1/userinfo")]
public async Task<ResponseOutput> GetUserInfoAsync()
{
return await _userService.GetUserInfoAsync();
}
}
}