feat:完成内部核心模块替换改造成furion

This commit is contained in:
橙子
2023-04-15 12:25:47 +08:00
parent 543c13d94b
commit ef5b628b31
10 changed files with 60 additions and 136 deletions

View File

@@ -7,7 +7,6 @@ using Yi.Framework.Infrastructure.CurrentUsers;
using Yi.Framework.Infrastructure.Ddd.Repositories;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Framework.Infrastructure.Exceptions;
using Yi.Framework.Infrastructure.Uow;
using Yi.Framework.Module.ImageSharp.HeiCaptcha;
using Yi.Framework.Module.Sms.Aliyun;
using Yi.Furion.Rbac.Application.System.Domain;
@@ -53,7 +52,6 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
private UserManager _userManager { get; set; }
private IUnitOfWorkManager _unitOfWorkManager { get; set; }
private IRepository<RoleEntity> _roleRepository { get; set; }
@@ -222,6 +220,7 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
/// <param name="input"></param>
/// <returns></returns>
[AllowAnonymous]
[UnitOfWork]
public async Task<object> PostRegisterAsync(RegisterDto input)
{
if (input.UserName == UserConst.Admin)
@@ -251,8 +250,7 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
{
throw new UserFriendlyException("用户已存在,注册失败");
}
using (var uow = _unitOfWorkManager.CreateContext())
{
var newUser = new UserEntity(input.UserName, input.Password, input.Phone);
var entity = await _userRepository.InsertReturnEntityAsync(newUser);
@@ -263,9 +261,6 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
{
await _userManager.GiveUserSetRoleAsync(new List<long> { entity.Id }, new List<long> { role.Id });
}
uow.Commit();
}
return true;
}

View File

@@ -1,7 +1,6 @@
using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Framework.Infrastructure.Uow;
using Yi.Furion.Rbac.Application.System.Domain;
using Yi.Furion.Rbac.Application.System.Dtos.Role;
using Yi.Furion.Rbac.Core.Entities;
@@ -40,6 +39,7 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[UnitOfWork]
public override async Task<RoleGetOutputDto> CreateAsync(RoleCreateInputVo input)
{
RoleGetOutputDto outputDto;
@@ -61,6 +61,7 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
[UnitOfWork]
public override async Task<RoleGetOutputDto> UpdateAsync(long id, RoleUpdateInputVo input)
{
var dto = new RoleGetOutputDto();

View File

@@ -3,7 +3,6 @@ using Yi.Framework.Infrastructure.CurrentUsers;
using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Framework.Infrastructure.Exceptions;
using Yi.Framework.Infrastructure.Uow;
using Yi.Framework.Module.OperLogManager;
using Yi.Furion.Rbac.Application.System.Domain;
using Yi.Furion.Rbac.Application.System.Dtos.User;
@@ -73,6 +72,7 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[OperLog("添加用户", OperEnum.Insert)]
[UnitOfWork]
public async override Task<UserGetOutputDto> CreateAsync(UserCreateInputVo input)
{
if (string.IsNullOrEmpty(input.Password))
@@ -118,6 +118,7 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
/// <param name="input"></param>
/// <returns></returns>
[OperLog("更新用户", OperEnum.Update)]
[UnitOfWork]
public async override Task<UserGetOutputDto> UpdateAsync(long id, UserUpdateInputVo input)
{
if (await _repository.IsAnyAsync(u => input.UserName!.Equals(u.UserName) && !id.Equals(u.Id)))