feat:让程序能够跑起来
This commit is contained in:
@@ -10,7 +10,5 @@ namespace Yi.Furion.Rbac.Application.System.Dtos.Dept
|
||||
public string DeptCode { get; set; }
|
||||
public string Leader { get; set; }
|
||||
|
||||
public DateTime? StartTime { get; set; }
|
||||
public DateTime? EndTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,16 +9,17 @@ using Yi.Furion.Rbac.Core.Etos;
|
||||
|
||||
namespace Yi.Furion.Rbac.Application.System.Event
|
||||
{
|
||||
public class LoginEventHandler : IEventSubscriber, ISingleton
|
||||
public class LoginEventHandler : IEventSubscriber,ISingleton
|
||||
{
|
||||
private readonly IRepository<LoginLogEntity> _loginLogRepository;
|
||||
private readonly HttpContext _httpContext;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private HttpContext _httpContext=> _httpContextAccessor.HttpContext;
|
||||
public LoginEventHandler(IRepository<LoginLogEntity> loginLogRepository, IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_loginLogRepository = loginLogRepository;
|
||||
_httpContext = httpContextAccessor.HttpContext;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
[EventSubscribe(nameof(LoginEventSource))]
|
||||
//[EventSubscribe(nameof(LoginEventSource))]
|
||||
public Task HandlerAsync(EventHandlerExecutingContext context)
|
||||
{
|
||||
var eventData=(LoginEventArgs)context.Source.Payload;
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
|
||||
(_userRepository, _currentUser, _accountManager, _menuRepository, _smsAliyunManager, _smsAliyunManagerOptions, _securityCode, _memoryCache, _eventPublisher) =
|
||||
(userRepository, currentUser, accountManager, menuRepository, smsAliyunManager, smsAliyunManagerOptions, securityCode, memoryCache, eventPublisher);
|
||||
|
||||
private JwtTokenManager _jwtTokenManager { get; set; }
|
||||
|
||||
private IUserRepository _userRepository { get; set; }
|
||||
|
||||
@@ -140,8 +139,8 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
|
||||
#pragma warning restore CS4014 // 由于此调用不会等待,因此在调用完成前将继续执行当前方法
|
||||
|
||||
//创建token
|
||||
var token = _jwtTokenManager.CreateToken(_accountManager.UserInfoToClaim(userInfo));
|
||||
return new { Token = token };
|
||||
var accessToken = JWTEncryption.Encrypt(_accountManager.UserInfoToClaim(userInfo));
|
||||
return new { Token = accessToken };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -14,13 +14,12 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
|
||||
public class RoleService : CrudAppService<RoleEntity, RoleGetOutputDto, RoleGetListOutputDto, long, RoleGetListInputVo, RoleCreateInputVo, RoleUpdateInputVo>,
|
||||
IRoleService, ITransient, IDynamicApiController
|
||||
{
|
||||
public RoleService(RoleManager roleManager, IUnitOfWorkManager unitOfWorkManager) =>
|
||||
(_roleManager, _unitOfWorkManager) =
|
||||
(roleManager, unitOfWorkManager);
|
||||
public RoleService(RoleManager roleManager) =>
|
||||
(_roleManager) =
|
||||
(roleManager);
|
||||
private RoleManager _roleManager { get; set; }
|
||||
|
||||
|
||||
private IUnitOfWorkManager _unitOfWorkManager { get; set; }
|
||||
|
||||
|
||||
|
||||
public override async Task<PagedResultDto<RoleGetListOutputDto>> GetListAsync(RoleGetListInputVo input)
|
||||
@@ -44,14 +43,14 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
|
||||
public override async Task<RoleGetOutputDto> CreateAsync(RoleCreateInputVo input)
|
||||
{
|
||||
RoleGetOutputDto outputDto;
|
||||
using (var uow = _unitOfWorkManager.CreateContext())
|
||||
{
|
||||
//using (var uow = _unitOfWorkManager.CreateContext())
|
||||
//{
|
||||
var entity = await MapToEntityAsync(input);
|
||||
await _repository.InsertAsync(entity);
|
||||
outputDto = await MapToGetOutputDtoAsync(entity);
|
||||
await _roleManager.GiveRoleSetMenuAsync(new List<long> { entity.Id }, input.MenuIds);
|
||||
uow.Commit();
|
||||
}
|
||||
// uow.Commit();
|
||||
//}
|
||||
|
||||
return outputDto;
|
||||
}
|
||||
@@ -65,8 +64,8 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
|
||||
public override async Task<RoleGetOutputDto> UpdateAsync(long id, RoleUpdateInputVo input)
|
||||
{
|
||||
var dto = new RoleGetOutputDto();
|
||||
using (var uow = _unitOfWorkManager.CreateContext())
|
||||
{
|
||||
//using (var uow = _unitOfWorkManager.CreateContext())
|
||||
//{
|
||||
var entity = await _repository.GetByIdAsync(id);
|
||||
await MapToEntityAsync(input, entity);
|
||||
await _repository.UpdateAsync(entity);
|
||||
@@ -74,8 +73,8 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
|
||||
await _roleManager.GiveRoleSetMenuAsync(new List<long> { id }, input.MenuIds);
|
||||
|
||||
dto = await MapToGetOutputDtoAsync(entity);
|
||||
uow.Commit();
|
||||
}
|
||||
// uow.Commit();
|
||||
//}
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,15 +21,11 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
|
||||
{
|
||||
|
||||
|
||||
public UserService(UserManager userManager, IUserRepository userRepository, ICurrentUser currentUser, IUnitOfWorkManager unitOfWorkManager) =>
|
||||
(_userManager, _userRepository, _currentUser, _unitOfWorkManager) =
|
||||
(userManager, userRepository, currentUser, unitOfWorkManager);
|
||||
public UserService(UserManager userManager, IUserRepository userRepository, ICurrentUser currentUser) =>
|
||||
(_userManager, _userRepository, _currentUser) =
|
||||
(userManager, userRepository, currentUser);
|
||||
private UserManager _userManager { get; set; }
|
||||
|
||||
|
||||
private IUnitOfWorkManager _unitOfWorkManager { get; set; }
|
||||
|
||||
|
||||
private IUserRepository _userRepository { get; set; }
|
||||
|
||||
|
||||
@@ -91,16 +87,16 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
|
||||
|
||||
entities.BuildPassword();
|
||||
|
||||
using (var uow = _unitOfWorkManager.CreateContext())
|
||||
{
|
||||
//using (var uow = _unitOfWorkManager.CreateContext())
|
||||
//{
|
||||
var returnEntity = await _repository.InsertReturnEntityAsync(entities);
|
||||
await _userManager.GiveUserSetRoleAsync(new List<long> { returnEntity.Id }, input.RoleIds);
|
||||
await _userManager.GiveUserSetPostAsync(new List<long> { returnEntity.Id }, input.PostIds);
|
||||
uow.Commit();
|
||||
//uow.Commit();
|
||||
|
||||
var result = await MapToGetOutputDtoAsync(returnEntity);
|
||||
return result;
|
||||
}
|
||||
//}
|
||||
}
|
||||
/// <summary>
|
||||
/// 单查
|
||||
@@ -136,13 +132,13 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
|
||||
entity.BuildPassword();
|
||||
}
|
||||
await MapToEntityAsync(input, entity);
|
||||
using (var uow = _unitOfWorkManager.CreateContext())
|
||||
{
|
||||
//using (var uow = _unitOfWorkManager.CreateContext())
|
||||
//{
|
||||
var res1 = await _repository.UpdateAsync(entity);
|
||||
await _userManager.GiveUserSetRoleAsync(new List<long> { id }, input.RoleIds);
|
||||
await _userManager.GiveUserSetPostAsync(new List<long> { id }, input.PostIds);
|
||||
uow.Commit();
|
||||
}
|
||||
// uow.Commit();
|
||||
//}
|
||||
return await MapToGetOutputDtoAsync(entity);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user