Browse Source

增加手机号重复注册验证;

pull/3/head
cKey 6 years ago
parent
commit
ca33be9533
  1. 20
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs
  2. 3
      aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/AbpAccountDomainModule.cs
  3. 2
      aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/IIdentityUserRepository.cs
  4. 5
      aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/Localization/Resources/en.json
  5. 5
      aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/Localization/Resources/zh-Hans.json
  6. 48
      aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/Microsoft/AspNetCore/Identity/PhoneNumberUserValidator.cs
  7. 7
      aspnet-core/modules/common/LINGYUN.Abp.DistributedLock/LINGYUN.Abp.DistributedLock.csproj
  8. 6
      aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN.Abp.IM.SignalR.csproj
  9. 6
      aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessageHub.cs
  10. 8
      aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN.Abp.IM.csproj
  11. 6
      aspnet-core/modules/common/LINGYUN.Abp.Identity.OverrideOptions/LINGYUN.Abp.Identity.OverrideOptions.csproj
  12. 6
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN.Abp.Notifications.SignalR.csproj
  13. 7
      aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN.Abp.Notifications.csproj
  14. 6
      aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN.Abp.RealTime.csproj
  15. 6
      aspnet-core/modules/common/LINGYUN.Abp.RedisLock/LINGYUN.Abp.RedisLock.csproj
  16. 33
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateSendWelcomeEventHandler.cs
  17. 7
      aspnet-core/services/account/AuthServer.Host/EntityFrameworkCore/Identity/EfCoreIdentityUserExtensionRepository.cs
  18. 7
      aspnet-core/services/cleanup-logs.bat
  19. 7
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EntityFrameworkCore/Identity/EfCoreIdentityUserExtensionRepository.cs
  20. 35
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EntityFrameworkCore/PlatformHttpApiHostMigrationsDbContext.cs
  21. 29
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EntityFrameworkCore/PlatformHttpApiHostMigrationsDbContextFactory.cs
  22. 11
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EventBus/Handlers/TenantConnectionStringCreateEventHandler.cs
  23. 2
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EventBus/Handlers/TenantCreateEventHandler.cs
  24. 2
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EventBus/Handlers/TenantDeleteEventHandler.cs

20
aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs

@ -18,18 +18,21 @@ namespace LINGYUN.Abp.Account
{
protected ISmsSender SmsSender { get; }
protected IdentityUserManager UserManager { get; }
protected IdentityUserStore UserStore { get; }
protected IIdentityUserRepository UserRepository { get; }
protected IDistributedCache<AccountRegisterVerifyCacheItem> Cache { get; }
protected PhoneNumberTokenProvider<IdentityUser> PhoneNumberTokenProvider { get; }
public AccountAppService(
ISmsSender smsSender,
IdentityUserManager userManager,
IdentityUserStore userStore,
IIdentityUserRepository userRepository,
IDistributedCache<AccountRegisterVerifyCacheItem> cache,
PhoneNumberTokenProvider<IdentityUser> phoneNumberTokenProvider)
{
Cache = cache;
SmsSender = smsSender;
UserStore = userStore;
UserManager = userManager;
UserRepository = userRepository;
PhoneNumberTokenProvider = phoneNumberTokenProvider;
@ -57,16 +60,27 @@ namespace LINGYUN.Abp.Account
await CheckSelfRegistrationAsync();
var userEmail = input.EmailAddress ?? input.PhoneNumber + "@abp.io";
// 需要用户输入邮箱?
//if (UserManager.Options.User.RequireUniqueEmail)
//{
// if (input.EmailAddress.IsNullOrWhiteSpace())
// {
// throw new UserFriendlyException(L["RequiredEmailAddress"]);
// }
//}
var userEmail = input.EmailAddress ?? $"{input.PhoneNumber}@{new Random().Next(1000, 99999)}.com";//如果邮件地址不验证,随意写入一个
var userName = input.UserName ?? input.PhoneNumber;
var user = new IdentityUser(GuidGenerator.Create(), userName, userEmail, CurrentTenant.Id)
{
Name = input.Name ?? input.PhoneNumber
};
// 写入手机号要在创建用户之前,因为有一个自定义的手机号验证
await UserStore.SetPhoneNumberAsync(user, input.PhoneNumber);
await UserStore.SetPhoneNumberConfirmedAsync(user, true);
(await UserManager.CreateAsync(user, input.Password)).CheckErrors();
(await UserManager.SetPhoneNumberAsync(user, input.PhoneNumber)).CheckErrors();
(await UserManager.SetEmailAsync(user, userEmail)).CheckErrors();
(await UserManager.AddDefaultRolesAsync(user)).CheckErrors();
await Cache.RemoveAsync(phoneVerifyCacheKey);

3
aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/AbpAccountDomainModule.cs

@ -1,4 +1,5 @@
using Volo.Abp.Localization;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.VirtualFileSystem;

2
aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/IIdentityUserRepository.cs

@ -7,6 +7,8 @@ namespace LINGYUN.Abp.Account
{
public interface IIdentityUserRepository : IReadOnlyRepository<IdentityUser, Guid>
{
Task<bool> PhoneNumberHasRegistedAsync(string phoneNumber);
Task<IdentityUser> FindByPhoneNumberAsync(string phoneNumber);
}
}

5
aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/Localization/Resources/en.json

@ -9,6 +9,9 @@
"DisplayName:SmsSigninTemplateCode": "Signin sms template",
"Description:SmsSigninTemplateCode": "When the user logs in, he/she should send the template number of the SMS verification code and fill in the template number of the corresponding cloud platform registration",
"DisplayName:PhoneVerifyCodeExpiration": "SMS verification code validity",
"Description:PhoneVerifyCodeExpiration": "The valid time for the user to send SMS verification code, unit m, default 3m"
"Description:PhoneVerifyCodeExpiration": "The valid time for the user to send SMS verification code, unit m, default 3m",
"RequiredEmailAddress": "Email address required",
"InvalidPhoneNumber": "Invalid phone number",
"DuplicatePhoneNumber": "The phone number {0} has been registered!"
}
}

5
aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/Localization/Resources/zh-Hans.json

@ -9,6 +9,9 @@
"DisplayName:SmsSigninTemplateCode": "用户登录短信模板",
"Description:SmsSigninTemplateCode": "用户登录时发送短信验证码的模板号,填写对应云平台注册的模板号",
"DisplayName:PhoneVerifyCodeExpiration": "短信验证码有效期",
"Description:PhoneVerifyCodeExpiration": "用户发送短信验证码的有效时长,单位m,默认3m"
"Description:PhoneVerifyCodeExpiration": "用户发送短信验证码的有效时长,单位m,默认3m",
"RequiredEmailAddress": "邮件地址必须输入",
"InvalidPhoneNumber": "手机号无效",
"DuplicatePhoneNumber": "手机号已经注册过!"
}
}

48
aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/Microsoft/AspNetCore/Identity/PhoneNumberUserValidator.cs

@ -0,0 +1,48 @@
using LINGYUN.Abp.Account.Localization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using System;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Identity;
using IIdentityUserRepository = LINGYUN.Abp.Account.IIdentityUserRepository;
namespace Microsoft.AspNetCore.Identity
{
[Dependency(ServiceLifetime.Scoped, ReplaceServices = true)]
[ExposeServices(typeof(IUserValidator<IdentityUser>))]
public class PhoneNumberUserValidator : UserValidator<IdentityUser>
{
private readonly IStringLocalizer<AccountResource> _stringLocalizer;
private readonly IIdentityUserRepository _identityUserRepository;
public PhoneNumberUserValidator(
IStringLocalizer<AccountResource> stringLocalizer,
IIdentityUserRepository identityUserRepository)
{
_stringLocalizer = stringLocalizer;
_identityUserRepository = identityUserRepository;
}
public override async Task<IdentityResult> ValidateAsync(UserManager<IdentityUser> manager, IdentityUser user)
{
await ValidatePhoneNumberAsync(manager, user);
return await base.ValidateAsync(manager, user);
}
protected virtual async Task ValidatePhoneNumberAsync(UserManager<IdentityUser> manager, IdentityUser user)
{
var phoneNumber = await manager.GetPhoneNumberAsync(user);
if (phoneNumber.IsNullOrWhiteSpace())
{
throw new UserFriendlyException(_stringLocalizer["InvalidPhoneNumber"].Value, "InvalidPhoneNumber");
}
var phoneNumberHasRegisted = await _identityUserRepository.PhoneNumberHasRegistedAsync(phoneNumber);
if (phoneNumberHasRegisted)
{
throw new UserFriendlyException(_stringLocalizer["DuplicatePhoneNumber", phoneNumber].Value, "DuplicatePhoneNumber");
}
}
}
}

7
aspnet-core/modules/common/LINGYUN.Abp.DistributedLock/LINGYUN.Abp.DistributedLock.csproj

@ -3,6 +3,13 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>2.8.0</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>D:\LocalNuget</OutputPath>
</PropertyGroup>
</Project>

6
aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN.Abp.IM.SignalR.csproj

@ -3,6 +3,12 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace />
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>2.8.0</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>D:\LocalNuget</OutputPath>
</PropertyGroup>
<ItemGroup>

6
aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessageHub.cs

@ -65,6 +65,12 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs
{
var onlineClientContext = new OnlineClientContext(chatMessage.TenantId, chatMessage.ToUserId.GetValueOrDefault());
var onlineClients = OnlineClientManager.GetAllByContext(onlineClientContext);
// 需要捕捉每一个发送任务的异常吗?
// var onlineClientConnections = onlineClients.Select(c => c.ConnectionId).ToImmutableList();
// var signalRClient = Clients.Clients(onlineClientConnections);
// await signalRClient.SendAsync("getChatMessage", chatMessage);
foreach (var onlineClient in onlineClients)
{
try

8
aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN.Abp.IM.csproj

@ -1,8 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>2.8.0</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>D:\LocalNuget</OutputPath>
</PropertyGroup>
<ItemGroup>

6
aspnet-core/modules/common/LINGYUN.Abp.Identity.OverrideOptions/LINGYUN.Abp.Identity.OverrideOptions.csproj

@ -3,6 +3,12 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>2.8.0</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>D:\LocalNuget</OutputPath>
</PropertyGroup>
<ItemGroup>

6
aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN.Abp.Notifications.SignalR.csproj

@ -3,6 +3,12 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace />
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>2.8.0</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>D:\LocalNuget</OutputPath>
</PropertyGroup>
<ItemGroup>

7
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN.Abp.Notifications.csproj

@ -3,6 +3,13 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>2.8.0</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>D:\LocalNuget</OutputPath>
</PropertyGroup>
<ItemGroup>

6
aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN.Abp.RealTime.csproj

@ -3,6 +3,12 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
<Version>2.8.0</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>D:\LocalNuget</OutputPath>
</PropertyGroup>
<ItemGroup>

6
aspnet-core/modules/common/LINGYUN.Abp.RedisLock/LINGYUN.Abp.RedisLock.csproj

@ -3,6 +3,12 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>2.8.0</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>D:\LocalNuget</OutputPath>
</PropertyGroup>
<ItemGroup>

33
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateSendWelcomeEventHandler.cs

@ -44,26 +44,29 @@ namespace LINGYUN.Abp.MessageService.EventBus
{
// 获取默认语言
var userDefaultCultureName = await _settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage);
if (!userDefaultCultureName.IsNullOrWhiteSpace())
if (userDefaultCultureName.IsNullOrWhiteSpace())
{
CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo(userDefaultCultureName);
userDefaultCultureName = CultureInfo.CurrentUICulture.Name;
// CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo(userDefaultCultureName);
}
// 订阅用户欢迎消息
await _notificationStore.InsertUserSubscriptionAsync(eventData.Entity.TenantId,
eventData.Entity.Id, UserNotificationNames.WelcomeToApplication);
var userWelcomeNotifiction = new NotificationInfo
using (CultureHelper.Use(userDefaultCultureName, userDefaultCultureName))
{
CreationTime = DateTime.Now,
Name = UserNotificationNames.WelcomeToApplication,
NotificationSeverity = NotificationSeverity.Info,
NotificationType = NotificationType.System,
TenantId = eventData.Entity.TenantId
};
userWelcomeNotifiction.Data.Properties["message"] = L("WelcomeToApplicationFormUser", eventData.Entity.UserName);
// 订阅用户欢迎消息
await _notificationStore.InsertUserSubscriptionAsync(eventData.Entity.TenantId,
eventData.Entity.Id, UserNotificationNames.WelcomeToApplication);
var userWelcomeNotifiction = new NotificationInfo
{
CreationTime = DateTime.Now,
Name = UserNotificationNames.WelcomeToApplication,
NotificationSeverity = NotificationSeverity.Info,
NotificationType = NotificationType.System,
TenantId = eventData.Entity.TenantId
};
userWelcomeNotifiction.Data.Properties["message"] = L("WelcomeToApplicationFormUser", eventData.Entity.UserName);
await _notificationDispatcher.DispatcheAsync(userWelcomeNotifiction);
await _notificationDispatcher.DispatcheAsync(userWelcomeNotifiction);
}
}
//public async Task HandleEventAsync(EntityCreatedEventData<UserEto> eventData)

7
aspnet-core/services/account/AuthServer.Host/EntityFrameworkCore/Identity/EfCoreIdentityUserExtensionRepository.cs

@ -19,7 +19,12 @@ namespace AuthServer.Host.EntityFrameworkCore.Identity
{
}
public async Task<IdentityUser> FindByPhoneNumberAsync(string phoneNumber)
public virtual async Task<bool> PhoneNumberHasRegistedAsync(string phoneNumber)
{
return await DbSet.AnyAsync(x => x.PhoneNumberConfirmed && x.PhoneNumber.Equals(phoneNumber));
}
public virtual async Task<IdentityUser> FindByPhoneNumberAsync(string phoneNumber)
{
return await WithDetails()
.Where(usr => usr.PhoneNumber.Equals(phoneNumber))

7
aspnet-core/services/cleanup-logs.bat

@ -2,7 +2,10 @@
cls
chcp 65001
echo. 启动平台管理服务
echo. 清理所有服务日志
cd .\platform\LINGYUN.Platform.HttpApi.Host
del .\platform\LINGYUN.Platform.HttpApi.Host\Logs /y
del .\apigateway\LINGYUN.ApiGateway.Host\Logs /y
del .\apigateway\LINGYUN.ApiGateway.HttpApi.Host\Logs /y
del .\account\AuthServer.Host\Logs /y

7
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EntityFrameworkCore/Identity/EfCoreIdentityUserExtensionRepository.cs

@ -19,7 +19,12 @@ namespace LINGYUN.Platform.EntityFrameworkCore.Identity
{
}
public async Task<IdentityUser> FindByPhoneNumberAsync(string phoneNumber)
public virtual async Task<bool> PhoneNumberHasRegistedAsync(string phoneNumber)
{
return await DbSet.AnyAsync(x => x.PhoneNumberConfirmed && x.PhoneNumber.Equals(phoneNumber));
}
public virtual async Task<IdentityUser> FindByPhoneNumberAsync(string phoneNumber)
{
return await DbSet.Where(usr => usr.PhoneNumber.Equals(phoneNumber)).FirstOrDefaultAsync();
}

35
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EntityFrameworkCore/PlatformHttpApiHostMigrationsDbContext.cs

@ -0,0 +1,35 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.IdentityServer.EntityFrameworkCore;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.TenantManagement.EntityFrameworkCore;
namespace LINGYUN.Platform.EntityFrameworkCore
{
public class PlatformHttpApiHostMigrationsDbContext : AbpDbContext<PlatformHttpApiHostMigrationsDbContext>
{
public PlatformHttpApiHostMigrationsDbContext(DbContextOptions<PlatformHttpApiHostMigrationsDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ConfigureIdentity();
modelBuilder.ConfigureIdentityServer(options =>
{
options.TablePrefix = "IdentityServer";
options.Schema = null;
options.DatabaseProvider = EfCoreDatabaseProvider.MySql;
});
modelBuilder.ConfigureTenantManagement();
modelBuilder.ConfigureSettingManagement();
modelBuilder.ConfigurePermissionManagement();
}
}
}

29
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EntityFrameworkCore/PlatformHttpApiHostMigrationsDbContextFactory.cs

@ -0,0 +1,29 @@
using System.IO;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
namespace LINGYUN.Platform.EntityFrameworkCore
{
public class PlatformHttpApiHostMigrationsDbContextFactory : IDesignTimeDbContextFactory<PlatformHttpApiHostMigrationsDbContext>
{
public PlatformHttpApiHostMigrationsDbContext CreateDbContext(string[] args)
{
var configuration = BuildConfiguration();
var builder = new DbContextOptionsBuilder<PlatformHttpApiHostMigrationsDbContext>()
.UseMySql(configuration.GetConnectionString("Default"));
return new PlatformHttpApiHostMigrationsDbContext(builder.Options);
}
private static IConfigurationRoot BuildConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.Development.json", optional: false);
return builder.Build();
}
}
}

11
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EventBus/Handlers/TenantConnectionStringCreateEventHandler.cs

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LINGYUN.Platform.EventBus.Handlers
{
public class TenantConnectionStringCreateEventHandler
{
}
}

2
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EventBus/Handlers/TenantCreateEventHandler.cs

@ -70,7 +70,7 @@ namespace LINGYUN.Platform.EventBus.Handlers
}
await PermissionGrantRepository.GetDbContext().Database.ExecuteSqlRawAsync(batchInsertPermissionSql);
await unitOfWork.CompleteAsync();
await unitOfWork.SaveChangesAsync();
}
}
}

2
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EventBus/Handlers/TenantDeleteEventHandler.cs

@ -57,7 +57,7 @@ namespace LINGYUN.Platform.EventBus.Handlers
await PermissionGrantRepository.GetDbContext().Database
.ExecuteSqlRawAsync(batchRmovePermissionSql);
await unitOfWork.CompleteAsync();
await unitOfWork.SaveChangesAsync();
}
}

Loading…
Cancel
Save