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.

76 lines
2.2 KiB

using BaseService.Controllers;
using BaseService.Systems.UserManagement;
using BaseService.Systems.UserManagement.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Identity;
namespace BaseService.HttpApi.Systems
{
[Area("base")]
[Route("api/base/user")]
public class UserController: BaseServiceController,IUserAppService
{
private readonly IUserAppService _userAppService;
public UserController(IUserAppService userAppService)
{
_userAppService = userAppService;
}
/// <summary>
/// 获取当前登录用户信息
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("current")]
public async Task<IdentityUserDto> GetCurrentUserAsync()
{
return await _userAppService.GetCurrentUserAsync();
}
/// <summary>
/// 重置密码功能
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
[HttpPut]
[Route("{userId}/reset-password")]
public async Task<IdentityUserDto> ResetPasswordAsync(Guid userId)
{
return await _userAppService.ResetPasswordAsync(userId);
}
[HttpPost]
public Task<IdentityUserDto> Create(BaseIdentityUserCreateDto input)
{
return _userAppService.Create(input);
}
[HttpGet]
[Route("{id}")]
public Task<BaseIdentityUserDto> Get(Guid id)
{
return _userAppService.Get(id);
}
[HttpGet]
public Task<PagedResultDto<BaseIdentityUserDto>> GetAll(GetBaseIdentityUsersInput input)
{
return _userAppService.GetAll(input);
}
[HttpPut]
[Route("{id}")]
public Task<IdentityUserDto> UpdateAsync(Guid id, BaseIdentityUserUpdateDto input)
{
return _userAppService.UpdateAsync(id, input);
}
}
}