Merge branch 'abp' of https://gitee.com/ccnetcore/Yi into abp

This commit is contained in:
Xwen
2023-12-20 23:30:05 +08:00
4 changed files with 5868 additions and 6 deletions

View File

@@ -20,7 +20,6 @@ namespace Yi.Framework.SqlSugarCore.Uow
public void Dispose()
{
Console.WriteLine("Dispose");
}
public async Task RollbackAsync(CancellationToken cancellationToken = default)

View File

@@ -54,7 +54,9 @@ namespace Yi.Framework.Rbac.Application.Services
ICaptcha captcha,
IGuidGenerator guidGenerator,
IOptions<RbacOptions> options,
IAliyunManger aliyunManger)
IAliyunManger aliyunManger,
ISqlSugarRepository<RoleEntity> roleRepository,
UserManager userManager)
{
_userRepository = userRepository;
_currentUser = currentUser;
@@ -68,6 +70,8 @@ namespace Yi.Framework.Rbac.Application.Services
_guidGenerator = guidGenerator;
_rbacOptions = options.Value;
_aliyunManger = aliyunManger;
_roleRepository = roleRepository;
_userManager = userManager;
}
@@ -234,8 +238,8 @@ namespace Yi.Framework.Rbac.Application.Services
/// </summary>
private async Task ValidationPhoneCaptchaAsync(RegisterDto input)
{
var value = await _phoneCache.GetAsync(new CaptchaPhoneCacheKey(input.Phone.ToString()));
if (value is not null && value.Equals($"{input.Code}"))
var item = await _phoneCache.GetAsync(new CaptchaPhoneCacheKey(input.Phone.ToString()));
if (item is not null && item.Code.Equals($"{input.Code}"))
{
//成功,需要清空
await _phoneCache.RemoveAsync(new CaptchaPhoneCacheKey(input.Phone.ToString()));
@@ -289,8 +293,7 @@ namespace Yi.Framework.Rbac.Application.Services
var entity = await _userRepository.InsertReturnEntityAsync(newUser);
//赋上一个初始角色
var roleRepository = _roleRepository;
var role = await roleRepository.GetFirstAsync(x => x.RoleCode == UserConst.GuestRoleCode);
var role = await _roleRepository.GetFirstAsync(x => x.RoleCode == UserConst.GuestRoleCode);
if (role is not null)
{
await _userManager.GiveUserSetRoleAsync(new List<Guid> { entity.Id }, new List<Guid> { role.Id });

View File

@@ -7,6 +7,7 @@ using Yi.Framework.Mapster;
using Yi.Framework.Rbac.Domain.Authorization;
using Yi.Framework.Rbac.Domain.Operlog;
using Yi.Framework.Rbac.Domain.Shared;
using Yi.Framework.Rbac.Domain.Shared.Options;
namespace Yi.Framework.Rbac.Domain
{
@@ -22,11 +23,15 @@ namespace Yi.Framework.Rbac.Domain
public override void ConfigureServices(ServiceConfigurationContext context)
{
var service = context.Services;
var configuration = context.Services.GetConfiguration();
service.AddControllers(options =>
{
options.Filters.Add<PermissionGlobalAttribute>();
options.Filters.Add<OperLogGlobalAttribute>();
});
//配置阿里云短信
Configure<AliyunOptions>(configuration.GetSection(nameof(AliyunOptions)));
}
}
}

File diff suppressed because it is too large Load Diff