|
|
@ -21,11 +21,13 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed |
|
|
protected ISettingProvider SettingProvider { get; } |
|
|
protected ISettingProvider SettingProvider { get; } |
|
|
protected IStringLocalizer StringLocalizer { get; } |
|
|
protected IStringLocalizer StringLocalizer { get; } |
|
|
protected INotificationSender NotificationSender { get; } |
|
|
protected INotificationSender NotificationSender { get; } |
|
|
|
|
|
protected INotificationSubscriptionManager NotificationSubscriptionManager { get; } |
|
|
|
|
|
|
|
|
public TenantCreateEventHandler( |
|
|
public TenantCreateEventHandler( |
|
|
ICurrentTenant currentTenant, |
|
|
ICurrentTenant currentTenant, |
|
|
ISettingProvider settingProvider, |
|
|
ISettingProvider settingProvider, |
|
|
INotificationSender notificationSender, |
|
|
INotificationSender notificationSender, |
|
|
|
|
|
INotificationSubscriptionManager notificationSubscriptionManager, |
|
|
IStringLocalizer<MessageServiceResource> stringLocalizer, |
|
|
IStringLocalizer<MessageServiceResource> stringLocalizer, |
|
|
ILogger<TenantCreateEventHandler> logger) |
|
|
ILogger<TenantCreateEventHandler> logger) |
|
|
{ |
|
|
{ |
|
|
@ -34,10 +36,20 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed |
|
|
SettingProvider = settingProvider; |
|
|
SettingProvider = settingProvider; |
|
|
StringLocalizer = stringLocalizer; |
|
|
StringLocalizer = stringLocalizer; |
|
|
NotificationSender = notificationSender; |
|
|
NotificationSender = notificationSender; |
|
|
|
|
|
NotificationSubscriptionManager = notificationSubscriptionManager; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task HandleEventAsync(CreateEventData eventData) |
|
|
public async Task HandleEventAsync(CreateEventData eventData) |
|
|
{ |
|
|
{ |
|
|
|
|
|
var tenantAdminUserIdentifier = new UserIdentifier(eventData.AdminUserId, eventData.AdminEmailAddress); |
|
|
|
|
|
|
|
|
|
|
|
// 租户管理员订阅事件
|
|
|
|
|
|
await NotificationSubscriptionManager |
|
|
|
|
|
.SubscribeAsync( |
|
|
|
|
|
eventData.Id, |
|
|
|
|
|
tenantAdminUserIdentifier, |
|
|
|
|
|
TenantNotificationNames.NewTenantRegistered); |
|
|
|
|
|
|
|
|
var userDefaultCultureName = await SettingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage); |
|
|
var userDefaultCultureName = await SettingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage); |
|
|
if (userDefaultCultureName.IsNullOrWhiteSpace()) |
|
|
if (userDefaultCultureName.IsNullOrWhiteSpace()) |
|
|
{ |
|
|
{ |
|
|
@ -46,8 +58,6 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed |
|
|
// 使用系统区域语言发布通知
|
|
|
// 使用系统区域语言发布通知
|
|
|
using (CultureHelper.Use(userDefaultCultureName, userDefaultCultureName)) |
|
|
using (CultureHelper.Use(userDefaultCultureName, userDefaultCultureName)) |
|
|
{ |
|
|
{ |
|
|
var tenantAdminUserIdentifier = new UserIdentifier(eventData.AdminUserId, eventData.AdminEmailAddress); |
|
|
|
|
|
|
|
|
|
|
|
var notificationData = new NotificationData(); |
|
|
var notificationData = new NotificationData(); |
|
|
notificationData.WriteStandardData( |
|
|
notificationData.WriteStandardData( |
|
|
L("NewTenantRegisteredNotificationTitle"), |
|
|
L("NewTenantRegisteredNotificationTitle"), |
|
|
|