From 0e585fba0cba4b32043923b36066f4910bf17ac1 Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Wed, 20 Oct 2021 14:59:46 +0800 Subject: [PATCH] fix message service irrationality --- .../Abp/IM/SignalR/Hubs/MessagesHub.cs | 5 +- .../LINGYUN/Abp/IM/Group/Group.cs | 56 +-- ...UN.Abp.MessageService.Domain.Shared.csproj | 10 + .../AbpMessageServiceDomainSharedModule.cs | 50 +- .../LINGYUN.Abp.MessageService.Domain.csproj | 10 - .../AbpMessageServiceDomainModule.cs | 93 ++-- .../Localization/Resources/en.json | 37 -- .../Localization/Resources/zh-Hans.json | 37 -- .../Group/EfCoreUserChatGroupRepository.cs | 4 +- .../Distributed/NotificationEventHandler.cs | 442 +++++++++--------- .../Distributed/TenantCreateEventHandler.cs | 155 +++--- .../UserCreateSendWelcomeEventHandler.cs | 135 +++--- .../Localization/HttpApiHost/en.json | 2 +- .../Localization/HttpApiHost/zh-Hans.json | 2 +- .../ElementAdminDataSeedContributor.cs | 8 +- .../VbenAdminDataSeedContributor.cs | 72 +-- 16 files changed, 523 insertions(+), 595 deletions(-) delete mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Localization/Resources/en.json delete mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs index 1b51b2f91..421a14941 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs @@ -43,8 +43,9 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs var userGroups = await UserGroupStore.GetUserGroupsAsync(client.TenantId, client.UserId.Value); foreach (var group in userGroups) { - await Groups.AddToGroupAsync(client.ConnectionId, group.Name); - var groupClient = Clients.Group(group.Name); + // 应使用群组标识 + await Groups.AddToGroupAsync(client.ConnectionId, group.Id); + var groupClient = Clients.Group(group.Id); if (groupClient != null) { // 发送用户上线通知 diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/Group.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/Group.cs index 4618778ab..7677f8ca9 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/Group.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/Group.cs @@ -1,26 +1,30 @@ -namespace LINGYUN.Abp.IM.Group -{ - public class Group - { - /// - /// 群组名称 - /// - public string Name { get; set; } - /// - /// 允许匿名聊天 - /// - public bool AllowAnonymous { get; set; } - /// - /// 允许发送消息 - /// - public bool AllowSendMessage { get; set; } - /// - /// 最大用户数 - /// - public int MaxUserLength { get; set; } - /// - /// 群组用户数 - /// - public int GroupUserCount { get; set; } - } -} +namespace LINGYUN.Abp.IM.Group +{ + public class Group + { + /// + /// 群组标识 + /// + public string Id { get; set; } + /// + /// 群组名称 + /// + public string Name { get; set; } + /// + /// 允许匿名聊天 + /// + public bool AllowAnonymous { get; set; } + /// + /// 允许发送消息 + /// + public bool AllowSendMessage { get; set; } + /// + /// 最大用户数 + /// + public int MaxUserLength { get; set; } + /// + /// 群组用户数 + /// + public int GroupUserCount { get; set; } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN.Abp.MessageService.Domain.Shared.csproj b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN.Abp.MessageService.Domain.Shared.csproj index 96dd257de..fb1aa0819 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN.Abp.MessageService.Domain.Shared.csproj +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN.Abp.MessageService.Domain.Shared.csproj @@ -7,6 +7,16 @@ + + + + + + + + + + diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/AbpMessageServiceDomainSharedModule.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/AbpMessageServiceDomainSharedModule.cs index d5aac9362..2d6fdc99d 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/AbpMessageServiceDomainSharedModule.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/AbpMessageServiceDomainSharedModule.cs @@ -1,18 +1,32 @@ -using LINGYUN.Abp.MessageService.Localization; -using Volo.Abp.Localization; -using Volo.Abp.Modularity; - -namespace LINGYUN.Abp.MessageService -{ - [DependsOn(typeof(AbpLocalizationModule))] - public class AbpMessageServiceDomainSharedModule : AbpModule - { - public override void ConfigureServices(ServiceConfigurationContext context) - { - Configure(options => - { - options.Resources.Add("en"); - }); - } - } -} +using LINGYUN.Abp.MessageService.Localization; +using Volo.Abp.Localization; +using Volo.Abp.Localization.ExceptionHandling; +using Volo.Abp.Modularity; +using Volo.Abp.VirtualFileSystem; + +namespace LINGYUN.Abp.MessageService +{ + [DependsOn(typeof(AbpLocalizationModule))] + public class AbpMessageServiceDomainSharedModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Add("en") + .AddVirtualJson("/LINGYUN/Abp/MessageService/Localization/Resources"); + }); + + Configure(options => + { + options.MapCodeNamespace(MessageServiceErrorCodes.Namespace, typeof(MessageServiceResource)); + }); + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN.Abp.MessageService.Domain.csproj b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN.Abp.MessageService.Domain.csproj index b18d3710f..b4ea0c23a 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN.Abp.MessageService.Domain.csproj +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN.Abp.MessageService.Domain.csproj @@ -7,16 +7,6 @@ - - - - - - - - - - diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/AbpMessageServiceDomainModule.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/AbpMessageServiceDomainModule.cs index 2f19e44ef..e843cf416 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/AbpMessageServiceDomainModule.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/AbpMessageServiceDomainModule.cs @@ -1,55 +1,38 @@ -using LINGYUN.Abp.MessageService.Chat; -using LINGYUN.Abp.MessageService.Localization; -using LINGYUN.Abp.MessageService.Mapper; -using LINGYUN.Abp.MessageService.ObjectExtending; -using Volo.Abp.AutoMapper; -using Volo.Abp.Caching; -using Volo.Abp.Localization; -using Volo.Abp.Localization.ExceptionHandling; -using Volo.Abp.Modularity; -using Volo.Abp.ObjectExtending.Modularity; -using Volo.Abp.VirtualFileSystem; - -namespace LINGYUN.Abp.MessageService -{ - [DependsOn( - typeof(AbpAutoMapperModule), - typeof(AbpCachingModule), - typeof(AbpMessageServiceDomainSharedModule))] - public class AbpMessageServiceDomainModule : AbpModule - { - public override void ConfigureServices(ServiceConfigurationContext context) - { - Configure(options => - { - options.AddProfile(validate: true); - }); - - Configure(options => - { - options.FileSets.AddEmbedded(); - }); - - Configure(options => - { - options.Resources - .Get() - .AddVirtualJson("/LINGYUN/Abp/MessageService/Localization/Resources"); - }); - - Configure(options => - { - options.MapCodeNamespace(MessageServiceErrorCodes.Namespace, typeof(MessageServiceResource)); - }); - } - - public override void PostConfigureServices(ServiceConfigurationContext context) - { - ModuleExtensionConfigurationHelper.ApplyEntityConfigurationToEntity( - MessageServiceModuleExtensionConsts.ModuleName, - MessageServiceModuleExtensionConsts.EntityNames.Message, - typeof(Message) - ); - } - } -} +using LINGYUN.Abp.MessageService.Chat; +using LINGYUN.Abp.MessageService.Localization; +using LINGYUN.Abp.MessageService.Mapper; +using LINGYUN.Abp.MessageService.ObjectExtending; +using Volo.Abp.AutoMapper; +using Volo.Abp.Caching; +using Volo.Abp.Localization; +using Volo.Abp.Localization.ExceptionHandling; +using Volo.Abp.Modularity; +using Volo.Abp.ObjectExtending.Modularity; +using Volo.Abp.VirtualFileSystem; + +namespace LINGYUN.Abp.MessageService +{ + [DependsOn( + typeof(AbpAutoMapperModule), + typeof(AbpCachingModule), + typeof(AbpMessageServiceDomainSharedModule))] + public class AbpMessageServiceDomainModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.AddProfile(validate: true); + }); + } + + public override void PostConfigureServices(ServiceConfigurationContext context) + { + ModuleExtensionConfigurationHelper.ApplyEntityConfigurationToEntity( + MessageServiceModuleExtensionConsts.ModuleName, + MessageServiceModuleExtensionConsts.EntityNames.Message, + typeof(Message) + ); + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Localization/Resources/en.json b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Localization/Resources/en.json deleted file mode 100644 index bc5f0a3ef..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Localization/Resources/en.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "culture": "en", - "texts": { - "LINGYUN.Abp.Message:01400": "Sending the message failed: The message is incomplete!", - "LINGYUN.Abp.Message:01401": "You have not joined the group and cannot operate!", - "LINGYUN.Abp.Message:02301": "Group application has been sent, waiting for administrator's approval", - "LINGYUN.Abp.Message:02302": "You need to validate the questions to join the group chat", - "LINGYUN.Abp.Message:02400": "The administrator has turned on silence mode!", - "LINGYUN.Abp.Message:02403": "The administrator has banned you from speaking!", - "LINGYUN.Abp.Message:02401": "The administrator does not allow anonymous speaking!", - "LINGYUN.Abp.Message:02404": "Sending the message failed: the group does not exist or is disbanded!", - "LINGYUN.Abp.Message:03301": "Friend request has been sent, waiting for the other party's approval", - "LINGYUN.Abp.Message:03302": "You need to verify the problem to add friends", - "LINGYUN.Abp.Message:03400": "The user has rejected all messages!", - "LINGYUN.Abp.Message:03401": "The user rejects the message you sent!", - "LINGYUN.Abp.Message:03402": "Users do not receive anonymous comments!", - "LINGYUN.Abp.Message:03403": "Sending the message failed: the person needs to agree to add a friend!", - "LINGYUN.Abp.Message:03404": "Sending the message failed: the user does not exist or is deactivated!", - "LINGYUN.Abp.Message:03410": "Users refuse to add friends", - "LINGYUN.Abp.Message:03411": "The other party is already your friend or has sent an authentication request. The operation cannot be repeated!", - "Notifications:MultiTenancy": "Multi Tenancy", - "Notifications:Users": "Users", - "Notifications:NewTenantRegisterd": "Tenant creation notification", - "Notifications:WelcomeToApplication": "User Welcome Notice", - "Notifications:IM": "Instant Messaging", - "Notifications:FriendValidation": "Friend verification notification", - "Notifications:NewFriend": "New friend notification", - "Notifications:RequestAddNewFriend": "User {name} has requested that you be added as a friend", - "Notifications:RequestAddNewFriendDetail": "Description: {description}", - "Notifications:JoinGroup": "Join group notification", - "Notifications:ExitGroup": "Exit group notification", - "Notifications:DissolveGroup": "Dissolve group notification", - "AddNewFriendBySearchId": "Add by account search", - "WelcomeToApplicationFormUser": "User :{0} welcome to join us!", - "Messages:NewFriend": "I have added you as a friend, let's chat together!" - } -} \ No newline at end of file diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json deleted file mode 100644 index 1f6a464e4..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "culture": "zh-Hans", - "texts": { - "LINGYUN.Abp.Message:01400": "发送消息失败: 消息不完整!", - "LINGYUN.Abp.Message:01401": "您还未加入群组,不能进行操作!", - "LINGYUN.Abp.Message:02301": "已发送群组申请,等待管理员同意", - "LINGYUN.Abp.Message:02302": "你需要验证问题才能加入群聊", - "LINGYUN.Abp.Message:02400": "管理员已开启全员禁言!", - "LINGYUN.Abp.Message:02403": "管理员已禁止您发言!", - "LINGYUN.Abp.Message:02401": "管理员不允许匿名发言!", - "LINGYUN.Abp.Message:02404": "发送消息失败: 群组不存在或已解散!", - "LINGYUN.Abp.Message:03301": "已发送好友申请,等待对方同意", - "LINGYUN.Abp.Message:03302": "你需要验证问题才能添加好友", - "LINGYUN.Abp.Message:03400": "用户已拒接所有消息!", - "LINGYUN.Abp.Message:03401": "用户拒绝您发送的消息!", - "LINGYUN.Abp.Message:03402": "用户不接收匿名发言!", - "LINGYUN.Abp.Message:03403": "需要对方同意添加好友才能发送消息!", - "LINGYUN.Abp.Message:03404": "发送消息失败: 用户不存在或已注销账号!", - "LINGYUN.Abp.Message:03410": "用户拒绝添加好友", - "LINGYUN.Abp.Message:03411": "对方已是您的好友或已发送验证请求,不能重复操作!", - "Notifications:MultiTenancy": "租户通知", - "Notifications:Users": "用户通知", - "Notifications:NewTenantRegisterd": "租户创建通知", - "Notifications:WelcomeToApplication": "用户欢迎通知", - "Notifications:IM": "即时通讯", - "Notifications:FriendValidation": "好友验证通知", - "Notifications:NewFriend": "新好友通知", - "Notifications:RequestAddNewFriend": "用户 {name} 请求添加您为好友", - "Notifications:RequestAddNewFriendDetail": "附加说明: {description}", - "Notifications:JoinGroup": "加入群组通知", - "Notifications:ExitGroup": "退出群组通知", - "Notifications:DissolveGroup": "群组解散通知", - "AddNewFriendBySearchId": "通过账号搜索添加", - "WelcomeToApplicationFormUser": "用户:{0} 欢迎您的加入!", - "Messages:NewFriend": "我已经添加您为好友,让我们一起聊天吧!" - } -} \ No newline at end of file diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Group/EfCoreUserChatGroupRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Group/EfCoreUserChatGroupRepository.cs index 65ba42e36..169235260 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Group/EfCoreUserChatGroupRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Group/EfCoreUserChatGroupRepository.cs @@ -140,7 +140,8 @@ namespace LINGYUN.Abp.MessageService.Group gp.AllowAnonymous, gp.AllowSendMessage, gp.MaxUserCount, - gp.Name + gp.Name, + gp.GroupId, } into cg select new IM.Group.Group @@ -149,6 +150,7 @@ namespace LINGYUN.Abp.MessageService.Group AllowSendMessage = cg.Key.AllowSendMessage, MaxUserLength = cg.Key.MaxUserCount, Name = cg.Key.Name, + Id = cg.Key.GroupId.ToString(), GroupUserCount = cg.Count() }; diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Distributed/NotificationEventHandler.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Distributed/NotificationEventHandler.cs index 64150a86c..631321f52 100644 --- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Distributed/NotificationEventHandler.cs +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Distributed/NotificationEventHandler.cs @@ -1,221 +1,221 @@ -using LINGYUN.Abp.MessageService.Utils; -using LINGYUN.Abp.Notifications; -using LINGYUN.Abp.RealTime; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; -using Microsoft.Extensions.Options; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Volo.Abp.BackgroundJobs; -using Volo.Abp.DependencyInjection; -using Volo.Abp.EventBus.Distributed; -using Volo.Abp.Json; -using Volo.Abp.Uow; - -namespace LINGYUN.Abp.MessageService.EventBus.Distributed -{ - /// - /// 订阅通知发布事件,统一发布消息 - /// - /// - /// 作用在于SignalR客户端只会与一台服务器建立连接, - /// 只有启用了SignlR服务端的才能真正将消息发布到客户端 - /// - public class NotificationEventHandler : IDistributedEventHandler>, ITransientDependency - { - /// - /// Reference to . - /// - public ILogger Logger { get; set; } - /// - /// Reference to . - /// - protected AbpNotificationOptions Options { get; } - /// - /// Reference to . - /// - protected IJsonSerializer JsonSerializer { get; } - /// - /// Reference to . - /// - protected IBackgroundJobManager BackgroundJobManager { get; } - /// - /// Reference to . - /// - protected INotificationStore NotificationStore { get; } - /// - /// Reference to . - /// - protected INotificationDefinitionManager NotificationDefinitionManager { get; } - /// - /// Reference to . - /// - protected INotificationSubscriptionManager NotificationSubscriptionManager { get; } - /// - /// Reference to . - /// - protected INotificationPublishProviderManager NotificationPublishProviderManager { get; } - - /// - /// Initializes a new instance of the class. - /// - public NotificationEventHandler( - IJsonSerializer jsonSerializer, - IBackgroundJobManager backgroundJobManager, - IOptions options, - INotificationStore notificationStore, - INotificationDefinitionManager notificationDefinitionManager, - INotificationSubscriptionManager notificationSubscriptionManager, - INotificationPublishProviderManager notificationPublishProviderManager) - { - Options = options.Value; - JsonSerializer = jsonSerializer; - BackgroundJobManager = backgroundJobManager; - NotificationStore = notificationStore; - NotificationDefinitionManager = notificationDefinitionManager; - NotificationSubscriptionManager = notificationSubscriptionManager; - NotificationPublishProviderManager = notificationPublishProviderManager; - - Logger = NullLogger.Instance; - } - - [UnitOfWork] - public virtual async Task HandleEventAsync(NotificationEto eventData) - { - // 如果上面过滤了应用程序,这里可以使用Get方法,否则,最好使用GetOrNull加以判断 - var notification = NotificationDefinitionManager.GetOrNull(eventData.Name); - if (notification == null) - { - return; - } - - var notificationInfo = new NotificationInfo - { - Name = notification.Name, - CreationTime = eventData.CreationTime, - Data = eventData.Data, - Severity = eventData.Severity, - Lifetime = notification.NotificationLifetime, - TenantId = eventData.TenantId, - Type = notification.NotificationType - }; - notificationInfo.SetId(eventData.Id); - - // TODO: 可以做成一个接口来序列化消息 - notificationInfo.Data = NotificationDataConverter.Convert(notificationInfo.Data); - - Logger.LogDebug($"Persistent notification {notificationInfo.Name}"); - - // 持久化通知 - await NotificationStore.InsertNotificationAsync(notificationInfo); - - var providers = Enumerable - .Reverse(NotificationPublishProviderManager.Providers); - - await PublishFromProvidersAsync(providers, eventData.Users, notificationInfo); - } - - /// - /// 指定提供者发布通知 - /// - /// 提供者列表 - /// 通知信息 - /// - protected async Task PublishFromProvidersAsync( - IEnumerable providers, - IEnumerable users, - NotificationInfo notificationInfo) - { - // 检查是够已订阅消息 - Logger.LogDebug($"Gets a list of user subscriptions {notificationInfo.Name}"); - List userSubscriptions; - if (users == null) - { - // 获取用户订阅列表 - userSubscriptions = await NotificationSubscriptionManager - .GetUserSubscriptionsAsync(notificationInfo.TenantId, notificationInfo.Name); - } - else - { - // 过滤未订阅的用户 - userSubscriptions = await NotificationSubscriptionManager - .GetUsersSubscriptionsAsync(notificationInfo.TenantId, notificationInfo.Name, users); - } - - users = userSubscriptions.Select(us => new UserIdentifier(us.UserId, us.UserName)); - - if (users.Count() > 0) - { - // 持久化用户通知 - Logger.LogDebug($"Persistent user notifications {notificationInfo.Name}"); - await NotificationStore - .InsertUserNotificationsAsync( - notificationInfo, - users.Select(u => u.UserId)); - - // 2020-11-02 fix bug, 多个发送提供者处于同一个工作单元之下,不能把删除用户订阅写入到单个通知提供者完成事件中 - // 而且为了确保一致性,删除订阅移动到发布通知之前 - if (notificationInfo.Lifetime == NotificationLifetime.OnlyOne) - { - // 一次性通知在发送完成后就取消用户订阅 - await NotificationStore - .DeleteUserSubscriptionAsync( - notificationInfo.TenantId, - users, - notificationInfo.Name); - } - - // 发布通知 - foreach (var provider in providers) - { - await PublishAsync(provider, notificationInfo, users); - } - } - } - /// - /// 发布通知 - /// - /// 通知发布者 - /// 通知信息 - /// 订阅用户列表 - /// - protected async Task PublishAsync( - INotificationPublishProvider provider, - NotificationInfo notificationInfo, - IEnumerable subscriptionUserIdentifiers) - { - try - { - Logger.LogDebug($"Sending notification with provider {provider.Name}"); - var notifacationDataMapping = Options.NotificationDataMappings - .GetMapItemOrDefault(notificationInfo.Name, provider.Name); - if (notifacationDataMapping != null) - { - notificationInfo.Data = notifacationDataMapping.MappingFunc(notificationInfo.Data); - } - // 发布 - await provider.PublishAsync(notificationInfo, subscriptionUserIdentifiers); - - Logger.LogDebug($"Send notification {notificationInfo.Name} with provider {provider.Name} was successful"); - } - catch (Exception ex) - { - Logger.LogWarning($"Send notification error with provider {provider.Name}"); - Logger.LogWarning($"Error message:{ex.Message}"); - - Logger.LogTrace(ex, $"Send notification error with provider { provider.Name}"); - - Logger.LogDebug($"Send notification error, notification {notificationInfo.Name} entry queue"); - // 发送失败的消息进入后台队列 - await BackgroundJobManager.EnqueueAsync( - new NotificationPublishJobArgs( - notificationInfo.GetId(), - provider.GetType().AssemblyQualifiedName, - subscriptionUserIdentifiers.ToList(), - notificationInfo.TenantId)); - } - } - } -} +using LINGYUN.Abp.MessageService.Utils; +using LINGYUN.Abp.Notifications; +using LINGYUN.Abp.RealTime; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.Extensions.Options; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.BackgroundJobs; +using Volo.Abp.DependencyInjection; +using Volo.Abp.EventBus.Distributed; +using Volo.Abp.Json; +using Volo.Abp.Uow; + +namespace LINGYUN.Abp.MessageService.EventBus.Distributed +{ + /// + /// 订阅通知发布事件,统一发布消息 + /// + /// + /// 作用在于SignalR客户端只会与一台服务器建立连接, + /// 只有启用了SignlR服务端的才能真正将消息发布到客户端 + /// + public class NotificationEventHandler : IDistributedEventHandler>, ITransientDependency + { + /// + /// Reference to . + /// + public ILogger Logger { get; set; } + /// + /// Reference to . + /// + protected AbpNotificationOptions Options { get; } + /// + /// Reference to . + /// + protected IJsonSerializer JsonSerializer { get; } + /// + /// Reference to . + /// + protected IBackgroundJobManager BackgroundJobManager { get; } + /// + /// Reference to . + /// + protected INotificationStore NotificationStore { get; } + /// + /// Reference to . + /// + protected INotificationDefinitionManager NotificationDefinitionManager { get; } + /// + /// Reference to . + /// + protected INotificationSubscriptionManager NotificationSubscriptionManager { get; } + /// + /// Reference to . + /// + protected INotificationPublishProviderManager NotificationPublishProviderManager { get; } + + /// + /// Initializes a new instance of the class. + /// + public NotificationEventHandler( + IJsonSerializer jsonSerializer, + IBackgroundJobManager backgroundJobManager, + IOptions options, + INotificationStore notificationStore, + INotificationDefinitionManager notificationDefinitionManager, + INotificationSubscriptionManager notificationSubscriptionManager, + INotificationPublishProviderManager notificationPublishProviderManager) + { + Options = options.Value; + JsonSerializer = jsonSerializer; + BackgroundJobManager = backgroundJobManager; + NotificationStore = notificationStore; + NotificationDefinitionManager = notificationDefinitionManager; + NotificationSubscriptionManager = notificationSubscriptionManager; + NotificationPublishProviderManager = notificationPublishProviderManager; + + Logger = NullLogger.Instance; + } + + [UnitOfWork] + public virtual async Task HandleEventAsync(NotificationEto eventData) + { + // 如果上面过滤了应用程序,这里可以使用Get方法,否则,最好使用GetOrNull加以判断 + var notification = NotificationDefinitionManager.GetOrNull(eventData.Name); + if (notification == null) + { + return; + } + + var notificationInfo = new NotificationInfo + { + Name = notification.Name, + CreationTime = eventData.CreationTime, + Data = eventData.Data, + Severity = eventData.Severity, + Lifetime = notification.NotificationLifetime, + TenantId = eventData.TenantId, + Type = notification.NotificationType + }; + notificationInfo.SetId(eventData.Id); + + // TODO: 可以做成一个接口来序列化消息 + notificationInfo.Data = NotificationDataConverter.Convert(notificationInfo.Data); + + Logger.LogDebug($"Persistent notification {notificationInfo.Name}"); + + // 持久化通知 + await NotificationStore.InsertNotificationAsync(notificationInfo); + + var providers = Enumerable + .Reverse(NotificationPublishProviderManager.Providers); + + await PublishFromProvidersAsync(providers, eventData.Users, notificationInfo); + } + + /// + /// 指定提供者发布通知 + /// + /// 提供者列表 + /// 通知信息 + /// + protected async Task PublishFromProvidersAsync( + IEnumerable providers, + IEnumerable users, + NotificationInfo notificationInfo) + { + // 检查是够已订阅消息 + Logger.LogDebug($"Gets a list of user subscriptions {notificationInfo.Name}"); + List userSubscriptions; + if (users == null) + { + // 获取用户订阅列表 + userSubscriptions = await NotificationSubscriptionManager + .GetUserSubscriptionsAsync(notificationInfo.TenantId, notificationInfo.Name); + } + else + { + // 过滤未订阅的用户 + userSubscriptions = await NotificationSubscriptionManager + .GetUsersSubscriptionsAsync(notificationInfo.TenantId, notificationInfo.Name, users); + } + + users = userSubscriptions.Select(us => new UserIdentifier(us.UserId, us.UserName)); + + if (users.Any()) + { + // 持久化用户通知 + Logger.LogDebug($"Persistent user notifications {notificationInfo.Name}"); + await NotificationStore + .InsertUserNotificationsAsync( + notificationInfo, + users.Select(u => u.UserId)); + + // 2020-11-02 fix bug, 多个发送提供者处于同一个工作单元之下,不能把删除用户订阅写入到单个通知提供者完成事件中 + // 而且为了确保一致性,删除订阅移动到发布通知之前 + if (notificationInfo.Lifetime == NotificationLifetime.OnlyOne) + { + // 一次性通知在发送完成后就取消用户订阅 + await NotificationStore + .DeleteUserSubscriptionAsync( + notificationInfo.TenantId, + users, + notificationInfo.Name); + } + + // 发布通知 + foreach (var provider in providers) + { + await PublishAsync(provider, notificationInfo, users); + } + } + } + /// + /// 发布通知 + /// + /// 通知发布者 + /// 通知信息 + /// 订阅用户列表 + /// + protected async Task PublishAsync( + INotificationPublishProvider provider, + NotificationInfo notificationInfo, + IEnumerable subscriptionUserIdentifiers) + { + try + { + Logger.LogDebug($"Sending notification with provider {provider.Name}"); + var notifacationDataMapping = Options.NotificationDataMappings + .GetMapItemOrDefault(notificationInfo.Name, provider.Name); + if (notifacationDataMapping != null) + { + notificationInfo.Data = notifacationDataMapping.MappingFunc(notificationInfo.Data); + } + // 发布 + await provider.PublishAsync(notificationInfo, subscriptionUserIdentifiers); + + Logger.LogDebug($"Send notification {notificationInfo.Name} with provider {provider.Name} was successful"); + } + catch (Exception ex) + { + Logger.LogWarning($"Send notification error with provider {provider.Name}"); + Logger.LogWarning($"Error message:{ex.Message}"); + + Logger.LogTrace(ex, $"Send notification error with provider { provider.Name}"); + + Logger.LogDebug($"Send notification error, notification {notificationInfo.Name} entry queue"); + // 发送失败的消息进入后台队列 + await BackgroundJobManager.EnqueueAsync( + new NotificationPublishJobArgs( + notificationInfo.GetId(), + provider.GetType().AssemblyQualifiedName, + subscriptionUserIdentifiers.ToList(), + notificationInfo.TenantId)); + } + } + } +} diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Distributed/TenantCreateEventHandler.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Distributed/TenantCreateEventHandler.cs index 283b40f2f..4f9973907 100644 --- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Distributed/TenantCreateEventHandler.cs +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Distributed/TenantCreateEventHandler.cs @@ -1,83 +1,72 @@ -using LINGYUN.Abp.MessageService.Localization; -using LINGYUN.Abp.MultiTenancy; -using LINGYUN.Abp.Notifications; -using Microsoft.Extensions.Localization; -using Microsoft.Extensions.Logging; -using System; -using System.Globalization; -using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; -using Volo.Abp.EventBus.Distributed; -using Volo.Abp.Localization; -using Volo.Abp.MultiTenancy; -using Volo.Abp.Settings; - -namespace LINGYUN.Abp.MessageService.EventBus.Distributed -{ - public class TenantCreateEventHandler : IDistributedEventHandler, ITransientDependency - { - protected ILogger Logger { get; } - protected ICurrentTenant CurrentTenant { get; } - protected ISettingProvider SettingProvider { get; } - protected IStringLocalizer StringLocalizer { get; } - protected INotificationSender NotificationSender { get; } - protected INotificationSubscriptionManager NotificationSubscriptionManager { get; } - - public TenantCreateEventHandler( - ICurrentTenant currentTenant, - ISettingProvider settingProvider, - INotificationSender notificationSender, - INotificationSubscriptionManager notificationSubscriptionManager, - IStringLocalizer stringLocalizer, - ILogger logger) - { - Logger = logger; - CurrentTenant = currentTenant; - SettingProvider = settingProvider; - StringLocalizer = stringLocalizer; - NotificationSender = notificationSender; - NotificationSubscriptionManager = notificationSubscriptionManager; - } - - 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); - if (userDefaultCultureName.IsNullOrWhiteSpace()) - { - userDefaultCultureName = CultureInfo.CurrentUICulture.Name; - } - // 使用系统区域语言发布通知 - using (CultureHelper.Use(userDefaultCultureName, userDefaultCultureName)) - { - var notificationData = new NotificationData(); - notificationData.WriteStandardData( - L("NewTenantRegisteredNotificationTitle"), - L("NewTenantRegisteredNotificationMessage", eventData.Name), - DateTime.Now, eventData.AdminEmailAddress); - - // 发布租户创建通知 - await NotificationSender - .SendNofiterAsync( - TenantNotificationNames.NewTenantRegistered, - notificationData, - tenantAdminUserIdentifier, - eventData.Id, - NotificationSeverity.Success); - } - } - - protected string L(string name, params object[] args) - { - return StringLocalizer[name, args]?.Value; - } - } -} +using LINGYUN.Abp.MessageService.Localization; +using LINGYUN.Abp.MultiTenancy; +using LINGYUN.Abp.Notifications; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.EventBus.Distributed; +using Volo.Abp.Localization; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Abp.MessageService.EventBus.Distributed +{ + public class TenantCreateEventHandler : IDistributedEventHandler, ITransientDependency + { + protected ILogger Logger { get; } + protected INotificationSender NotificationSender { get; } + protected INotificationSubscriptionManager NotificationSubscriptionManager { get; } + + public TenantCreateEventHandler( + INotificationSender notificationSender, + INotificationSubscriptionManager notificationSubscriptionManager, + ILogger logger) + { + Logger = logger; + NotificationSender = notificationSender; + NotificationSubscriptionManager = notificationSubscriptionManager; + } + + public async Task HandleEventAsync(CreateEventData eventData) + { + var tenantAdminUserIdentifier = new UserIdentifier(eventData.AdminUserId, eventData.AdminEmailAddress); + + Logger.LogInformation("tenant administrator subscribes to new tenant events.."); + // 租户管理员订阅事件 + await NotificationSubscriptionManager + .SubscribeAsync( + eventData.Id, + tenantAdminUserIdentifier, + TenantNotificationNames.NewTenantRegistered); + + var notificationData = new NotificationData(); + notificationData.WriteLocalizedData( + new LocalizableStringInfo( + LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), + "NewTenantRegisteredNotificationTitle", + new Dictionary + { + { "User", eventData.Name } + }), + new LocalizableStringInfo( + LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), + "NewTenantRegisteredNotificationMessage", + new Dictionary + { + { "User", eventData.Name} + }), + DateTime.Now, eventData.AdminEmailAddress); + + Logger.LogInformation("publish new tenant notification.."); + // 发布租户创建通知 + await NotificationSender + .SendNofiterAsync( + TenantNotificationNames.NewTenantRegistered, + notificationData, + tenantAdminUserIdentifier, + eventData.Id, + NotificationSeverity.Success); + } + } +} diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Local/UserCreateSendWelcomeEventHandler.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Local/UserCreateSendWelcomeEventHandler.cs index f396b3c1a..2e55ef7b0 100644 --- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Local/UserCreateSendWelcomeEventHandler.cs +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Local/UserCreateSendWelcomeEventHandler.cs @@ -1,63 +1,72 @@ -using LINGYUN.Abp.MessageService.Localization; -using LINGYUN.Abp.Notifications; -using System; -using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Entities.Events; -using Volo.Abp.EventBus; -using Volo.Abp.Localization; -using Volo.Abp.Users; - -namespace LINGYUN.Abp.MessageService.EventBus -{ - public class UserCreateSendWelcomeEventHandler : ILocalEventHandler>, ITransientDependency - { - private readonly INotificationSender _notificationSender; - private readonly INotificationSubscriptionManager _notificationSubscriptionManager; - public UserCreateSendWelcomeEventHandler( - INotificationSender notificationSender, - INotificationSubscriptionManager notificationSubscriptionManager - ) - { - _notificationSender = notificationSender; - _notificationSubscriptionManager = notificationSubscriptionManager; - } - - public async Task HandleEventAsync(EntityCreatedEventData eventData) - { - var userIdentifer = new UserIdentifier(eventData.Entity.Id, eventData.Entity.UserName); - // 订阅用户欢迎消息 - await _notificationSubscriptionManager - .SubscribeAsync( - eventData.Entity.TenantId, - userIdentifer, - UserNotificationNames.WelcomeToApplication); - - var userWelcomeNotifictionData = new NotificationData(); - - //userWelcomeNotifictionData.WriteStandardData( - // L("WelcomeToApplicationFormUser", eventData.Entity.Name ?? eventData.Entity.UserName), - // L("WelcomeToApplicationFormUser", eventData.Entity.Name ?? eventData.Entity.UserName), - // DateTime.Now, eventData.Entity.UserName); - - userWelcomeNotifictionData - .WriteLocalizedData( - new LocalizableStringInfo( - LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), - "WelcomeToApplicationFormUser"), - new LocalizableStringInfo( - LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), - "WelcomeToApplicationFormUser"), - DateTime.Now, eventData.Entity.UserName); - - await _notificationSender - .SendNofiterAsync( - UserNotificationNames.WelcomeToApplication, - userWelcomeNotifictionData, - userIdentifer, - eventData.Entity.TenantId, - NotificationSeverity.Info - ); - } - } -} +using LINGYUN.Abp.MessageService.Localization; +using LINGYUN.Abp.Notifications; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities.Events; +using Volo.Abp.EventBus; +using Volo.Abp.Localization; +using Volo.Abp.Users; + +namespace LINGYUN.Abp.MessageService.EventBus +{ + public class UserCreateSendWelcomeEventHandler : ILocalEventHandler>, ITransientDependency + { + private readonly INotificationSender _notificationSender; + private readonly INotificationSubscriptionManager _notificationSubscriptionManager; + public UserCreateSendWelcomeEventHandler( + INotificationSender notificationSender, + INotificationSubscriptionManager notificationSubscriptionManager + ) + { + _notificationSender = notificationSender; + _notificationSubscriptionManager = notificationSubscriptionManager; + } + + public async Task HandleEventAsync(EntityCreatedEventData eventData) + { + var userIdentifer = new UserIdentifier(eventData.Entity.Id, eventData.Entity.UserName); + // 订阅用户欢迎消息 + await _notificationSubscriptionManager + .SubscribeAsync( + eventData.Entity.TenantId, + userIdentifer, + UserNotificationNames.WelcomeToApplication); + + var userWelcomeNotifictionData = new NotificationData(); + + //userWelcomeNotifictionData.WriteStandardData( + // L("WelcomeToApplicationFormUser", eventData.Entity.Name ?? eventData.Entity.UserName), + // L("WelcomeToApplicationFormUser", eventData.Entity.Name ?? eventData.Entity.UserName), + // DateTime.Now, eventData.Entity.UserName); + + userWelcomeNotifictionData + .WriteLocalizedData( + new LocalizableStringInfo( + LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), + "WelcomeToApplicationFormUser", + new Dictionary + { + { "User", eventData.Entity.UserName } + }), + new LocalizableStringInfo( + LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), + "WelcomeToApplicationFormUser", + new Dictionary + { + { "User", eventData.Entity.UserName } + }), + DateTime.Now, eventData.Entity.UserName); + + await _notificationSender + .SendNofiterAsync( + UserNotificationNames.WelcomeToApplication, + userWelcomeNotifictionData, + userIdentifer, + eventData.Entity.TenantId, + NotificationSeverity.Info + ); + } + } +} diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Localization/HttpApiHost/en.json b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Localization/HttpApiHost/en.json index 26ddf61ad..b7e60779f 100644 --- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Localization/HttpApiHost/en.json +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Localization/HttpApiHost/en.json @@ -2,6 +2,6 @@ "culture": "en", "texts": { "NewTenantRegisteredNotificationTitle": "Tenants create notification", - "NewTenantRegisteredNotificationMessage": "New tenants to create success, the tenant name: {0}!" + "NewTenantRegisteredNotificationMessage": "New tenants to create success, the tenant name: {Name}!" } } diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Localization/HttpApiHost/zh-Hans.json b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Localization/HttpApiHost/zh-Hans.json index d7b22055b..c23f6b8a9 100644 --- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Localization/HttpApiHost/zh-Hans.json +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Localization/HttpApiHost/zh-Hans.json @@ -2,6 +2,6 @@ "culture": "zh-Hans", "texts": { "NewTenantRegisteredNotificationTitle": "租户创建通知", - "NewTenantRegisteredNotificationMessage": "新租户创建成功,租户名称:{0}!" + "NewTenantRegisteredNotificationMessage": "新租户创建成功,租户名称:{Name}!" } } diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/DataSeeder/ElementAdminDataSeedContributor.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/DataSeeder/ElementAdminDataSeedContributor.cs index e16666069..49d34f856 100644 --- a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/DataSeeder/ElementAdminDataSeedContributor.cs +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/DataSeeder/ElementAdminDataSeedContributor.cs @@ -241,9 +241,9 @@ namespace LINGYUN.Platform.DataSeeder private async Task SeedAdminMenuAsync(Layout layout, Data data) { var adminMenu = await SeedMenuAsync( - layout, + layout, data, - "admin", + "admin", "/admin", CodeNumberGenerator.CreateCode(2), layout.Path, @@ -938,7 +938,7 @@ namespace LINGYUN.Platform.DataSeeder menu.SetProperty(item.Key, item.Value); } } - + if (roles != null) { foreach (var role in roles) @@ -958,4 +958,4 @@ namespace LINGYUN.Platform.DataSeeder return menu; } } -} +} \ No newline at end of file diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/DataSeeder/VbenAdminDataSeedContributor.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/DataSeeder/VbenAdminDataSeedContributor.cs index b62d6ee88..c566211ae 100644 --- a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/DataSeeder/VbenAdminDataSeedContributor.cs +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/DataSeeder/VbenAdminDataSeedContributor.cs @@ -288,7 +288,7 @@ namespace LINGYUN.Platform.DataSeeder { "hideTab", false }, { "ignoreAuth", true }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var analysis = await SeedMenuAsync( layout, //layout @@ -308,7 +308,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var workbench = await SeedMenuAsync( layout, //layout @@ -328,7 +328,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); } private async Task SeedManageMenuAsync(Layout layout, Data data) @@ -352,7 +352,7 @@ namespace LINGYUN.Platform.DataSeeder { "hideTab", false }, { "ignoreAuth", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var identity = await SeedMenuAsync( layout, //layout @@ -372,7 +372,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var user = await SeedMenuAsync( layout, //layout data, //data @@ -391,7 +391,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var role = await SeedMenuAsync( layout, //layout data, //data @@ -410,7 +410,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var claimTypes = await SeedMenuAsync( layout, //layout data, //data @@ -429,7 +429,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var organizationUnits = await SeedMenuAsync( layout, //layout data, //data @@ -448,7 +448,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var securityLog = await SeedMenuAsync( layout, //layout data, //data @@ -468,7 +468,7 @@ namespace LINGYUN.Platform.DataSeeder { "hideTab", false }, { "requiredFeatures", "AbpAuditing.Logging.SecurityLog" } // 此路由需要依赖安全日志特性 }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var auditLogs = await SeedMenuAsync( layout, //layout @@ -489,7 +489,7 @@ namespace LINGYUN.Platform.DataSeeder { "hideTab", false }, { "requiredFeatures", "AbpAuditing.Logging.AuditLog" } // 此路由需要依赖审计日志特性 }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var settings = await SeedMenuAsync( layout, //layout @@ -510,7 +510,7 @@ namespace LINGYUN.Platform.DataSeeder { "hideTab", false }, { "requiredFeatures", "SettingManagement.Enable" } // 此路由需要依赖设置管理特性 }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var identityServer = await SeedMenuAsync( layout, //layout @@ -530,7 +530,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var clients = await SeedMenuAsync( layout, //layout data, //data @@ -549,7 +549,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var apiResource = await SeedMenuAsync( layout, //layout data, //data @@ -568,7 +568,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var identityResources = await SeedMenuAsync( layout, //layout data, //data @@ -587,7 +587,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var apiScopes = await SeedMenuAsync( layout, //layout data, //data @@ -606,7 +606,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var persistedGrants = await SeedMenuAsync( layout, //layout data, //data @@ -625,7 +625,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); } @@ -650,7 +650,7 @@ namespace LINGYUN.Platform.DataSeeder { "hideTab", false }, { "ignoreAuth", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var tenants = await SeedMenuAsync( layout, //layout data, //data @@ -669,7 +669,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); } private async Task SeedPlatformMenuAsync(Layout layout, Data data) @@ -693,7 +693,7 @@ namespace LINGYUN.Platform.DataSeeder { "hideTab", false }, { "ignoreAuth", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var dataDictionary = await SeedMenuAsync( layout, //layout data, //data @@ -712,7 +712,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var layouts = await SeedMenuAsync( layout, //layout data, //data @@ -731,7 +731,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var menus = await SeedMenuAsync( layout, //layout data, //data @@ -750,7 +750,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); } private async Task SeedApiGatewayMenuAsync(Layout layout, Data data) @@ -774,7 +774,7 @@ namespace LINGYUN.Platform.DataSeeder { "hideTab", false }, { "ignoreAuth", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var routeGroup = await SeedMenuAsync( layout, //layout data, //data @@ -793,7 +793,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var global = await SeedMenuAsync( layout, //layout data, //data @@ -812,7 +812,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var route = await SeedMenuAsync( layout, //layout data, //data @@ -831,7 +831,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var aggregate = await SeedMenuAsync( layout, //layout data, //data @@ -850,7 +850,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); } private async Task SeedLocalizationMenuAsync(Layout layout, Data data) @@ -874,7 +874,7 @@ namespace LINGYUN.Platform.DataSeeder { "hideTab", false }, { "ignoreAuth", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var languages = await SeedMenuAsync( layout, //layout data, //data @@ -893,7 +893,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var resources = await SeedMenuAsync( layout, //layout data, //data @@ -912,7 +912,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var texts = await SeedMenuAsync( layout, //layout data, //data @@ -931,7 +931,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); } private async Task SeedOssManagementMenuAsync(Layout layout, Data data) @@ -955,7 +955,7 @@ namespace LINGYUN.Platform.DataSeeder { "hideTab", false }, { "ignoreAuth", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var containers = await SeedMenuAsync( layout, //layout data, //data @@ -974,7 +974,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); var objects = await SeedMenuAsync( layout, //layout data, //data @@ -993,7 +993,7 @@ namespace LINGYUN.Platform.DataSeeder { "icon", "" }, { "hideTab", false }, }, - new string[] { "vben-admin" }); + new string[] { "admin" }); } private async Task SeedMenuAsync(