From 798e5d22ad7ff4a3a00460759ef1e3859c15d35e Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Sat, 24 Oct 2020 11:43:15 +0800 Subject: [PATCH 01/10] aggregate headers are case sensitive --- aspnet-core/LINGYUN.MicroService.sln | 2 +- .../Multiplexer/AbpApiDefinitionAggregator.cs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/aspnet-core/LINGYUN.MicroService.sln b/aspnet-core/LINGYUN.MicroService.sln index b82d811e1..e01605823 100644 --- a/aspnet-core/LINGYUN.MicroService.sln +++ b/aspnet-core/LINGYUN.MicroService.sln @@ -249,7 +249,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.PermissionManag EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.PermissionManagement.Domain.Identity", "modules\identity\LINGYUN.Abp.PermissionManagement.Domain.Identity\LINGYUN.Abp.PermissionManagement.Domain.Identity.csproj", "{2D377D3A-70EC-4BB3-9F4C-6C933693DA98}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Account.Web", "modules\account\LINGYUN.Abp.Account.Web\LINGYUN.Abp.Account.Web.csproj", "{5F43141B-6C63-4547-B9D6-D69EC3D7CA7E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Account.Web", "modules\account\LINGYUN.Abp.Account.Web\LINGYUN.Abp.Account.Web.csproj", "{5F43141B-6C63-4547-B9D6-D69EC3D7CA7E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/Ocelot/Middleware/Multiplexer/AbpApiDefinitionAggregator.cs b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/Ocelot/Middleware/Multiplexer/AbpApiDefinitionAggregator.cs index af72d9369..7910ccb4a 100644 --- a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/Ocelot/Middleware/Multiplexer/AbpApiDefinitionAggregator.cs +++ b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/Ocelot/Middleware/Multiplexer/AbpApiDefinitionAggregator.cs @@ -20,9 +20,11 @@ namespace Ocelot.Middleware.Multiplexer protected virtual async Task MapAbpApiDefinitionAggregateContentAsync(List responses) { JObject responseObject = null; - JsonMergeSettings mergeSetting = new JsonMergeSettings(); - mergeSetting.MergeArrayHandling = MergeArrayHandling.Union; - mergeSetting.PropertyNameComparison = System.StringComparison.CurrentCultureIgnoreCase; + JsonMergeSettings mergeSetting = new JsonMergeSettings + { + MergeArrayHandling = MergeArrayHandling.Union, + PropertyNameComparison = System.StringComparison.CurrentCultureIgnoreCase + }; foreach (var httpResponse in responses) { var content = await httpResponse.Items.DownstreamResponse().Content.ReadAsStringAsync(); @@ -40,7 +42,7 @@ namespace Ocelot.Middleware.Multiplexer { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } }; - stringContent.Headers.Add("_abperrorformat", "true"); + stringContent.Headers.Add("_AbpErrorFormat", "true"); return new DownstreamResponse(stringContent, HttpStatusCode.OK, new List>>(), "OK"); } From a999be4a3e01236094315f4918566044f9c1dc78 Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Sat, 24 Oct 2020 21:38:13 +0800 Subject: [PATCH 02/10] Refactor the module: Instant messaging --- aspnet-core/LINGYUN.MicroService.sln | 7 + ...YUN.Abp.AspNetCore.SignalR.JwtToken.csproj | 14 + ...AspNetCoreSignalRJwtTokenMapPathOptions.cs | 25 + .../AbpAspNetCoreSignalRJwtTokenModule.cs | 18 + ...alRJwtTokenApplicationBuilderExtensions.cs | 0 .../Http/SignalRJwtTokenMiddleware.cs | 45 ++ .../LINGYUN.Abp.IM.SignalR.csproj | 2 + .../Abp/IM/SignalR/AbpIMSignalRModule.cs | 14 +- .../Hubs/{MessageHub.cs => MessagesHub.cs} | 71 +- .../SignalR/Messages/SignalRMessageSender.cs | 4 +- .../LINGYUN/Abp/IM/Contract/IFriendStore.cs | 110 +++ .../LINGYUN/Abp/IM/Contract/UserFriend.cs | 28 + .../LINGYUN/Abp/IM/Group/GroupUserCard.cs | 12 +- .../LINGYUN/Abp/IM/Group/IUserGroupStore.cs | 17 +- .../LINGYUN/Abp/IM/IUserCardFinder.cs | 60 ++ .../LINGYUN/Abp/IM/Messages/IMessageStore.cs | 41 +- .../LINGYUN.Abp.IM/LINGYUN/Abp/IM/Sex.cs | 9 + .../LINGYUN.Abp.IM/LINGYUN/Abp/IM/UserCard.cs | 25 +- .../LINGYUN.Abp.Notifications.SignalR.csproj | 1 + .../SignalR/AbpNotificationsSignalRModule.cs | 11 +- .../Http/SignalRJwtTokenMiddleware.cs | 25 - .../Chat/Dto/GroupMessageGetByPagedDto.cs | 1 + .../Chat/Dto/GroupUserGetByPagedDto.cs | 2 + .../Chat/Dto/MyFriendCreateDto.cs | 7 + .../Chat/Dto/MyFriendGetByPagedDto.cs | 15 + .../Chat/Dto/MyFriendOperationDto.cs | 11 + .../Chat/Dto/UserMessageGetByPagedDto.cs | 1 + .../MessageService/Chat/IChatAppService.cs | 2 +- .../Chat/IMyFriendAppService.cs | 18 + .../Abp/MessageService/Chat/ChatAppService.cs | 29 +- .../MessageService/Chat/MyFriendAppService.cs | 53 ++ ...UN.Abp.MessageService.Domain.Shared.csproj | 1 + .../MessageService/Chat/UserChatCardConsts.cs | 13 + .../AbpMessageServiceDbProperties.cs | 2 + .../Abp/MessageService/Chat/ChatDataSeeder.cs | 54 ++ .../Abp/MessageService/Chat/ChatGroup.cs | 27 +- .../Abp/MessageService/Chat/ChatGroupAdmin.cs | 69 -- .../Abp/MessageService/Chat/FriendStore.cs | 119 ++++ .../MessageService/Chat/IChatDataSeeder.cs | 11 + .../MessageService/Chat/IGroupRepository.cs | 15 +- .../MessageService/Chat/IMessageRepository.cs | 82 ++- .../Chat/IUserChatCardRepository.cs | 38 ++ .../Chat/IUserChatFriendRepository.cs | 47 ++ .../Chat/IUserChatGroupRepository.cs | 77 ++- .../Abp/MessageService/Chat/MessageStore.cs | 65 +- .../Abp/MessageService/Chat/UserCardFinder.cs | 47 ++ .../Abp/MessageService/Chat/UserChatCard.cs | 105 +++ .../Abp/MessageService/Chat/UserChatFriend.cs | 54 ++ .../Abp/MessageService/Chat/UserGroupCard.cs | 74 ++ .../Abp/MessageService/Chat/UserGroupStore.cs | 37 +- .../Local/UserCreateJoinIMEventHandler.cs | 31 +- .../MessageService/Utils/DateTimeHelper.cs | 17 + .../Chat/EfCoreGroupRepository.cs | 36 +- .../Chat/EfCoreMessageRepository.cs | 147 ++-- .../Chat/EfCoreUserChatCardRepository.cs | 63 ++ .../Chat/EfCoreUserChatFriendRepository.cs | 164 +++++ .../Chat/EfCoreUserChatGroupRepository.cs | 359 +++++++--- .../Chat/EfCoreUserChatSettingRepository.cs | 4 +- ...MessageServiceEntityFrameworkCoreModule.cs | 3 + .../IMessageServiceDbContext.cs | 14 + .../MessageServiceDbContext.cs | 11 +- ...ServiceDbContextModelCreatingExtensions.cs | 48 +- .../EfCoreNotificationRepository.cs | 4 +- .../EfCoreUserNotificationRepository.cs | 4 +- .../EfCoreUserSubscribeRepository.cs | 4 +- .../Abp/MessageService/Chat/ChatController.cs | 4 +- .../MessageService/Chat/MyFriendController.cs | 46 ++ .../BackendAdminHostModule.cs | 6 + .../LINGYUN.ApiGateway.Host/event-bus-cap.db | Bin 40960 -> 40960 bytes ...AbpIdentityServerAdminHttpApiHostModule.cs | 7 + ...24093309_Add-MemberCard-Entity.Designer.cs | 590 ++++++++++++++++ .../20201024093309_Add-MemberCard-Entity.cs | 125 ++++ ...4206_Add-UserChatFriend-Entity.Designer.cs | 634 ++++++++++++++++++ ...0201024114206_Add-UserChatFriend-Entity.cs | 44 ++ ...iceHostMigrationsDbContextModelSnapshot.cs | 307 ++++++--- vueJs/package-lock.json | 8 + vueJs/package.json | 1 + vueJs/src/api/instant-message.ts | 71 ++ vueJs/src/components/InstantMessage/index.vue | 122 ++++ vueJs/src/main.ts | 3 + vueJs/src/shims.d.ts | 3 + vueJs/src/views/dashboard/admin/index.vue | 25 +- 82 files changed, 3989 insertions(+), 531 deletions(-) create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/LINGYUN.Abp.AspNetCore.SignalR.JwtToken.csproj create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/LINGYUN/Abp/AspNetCore/SignalR/JwtToken/AbpAspNetCoreSignalRJwtTokenMapPathOptions.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/LINGYUN/Abp/AspNetCore/SignalR/JwtToken/AbpAspNetCoreSignalRJwtTokenModule.cs rename aspnet-core/modules/common/{LINGYUN.Abp.Notifications.SignalR => LINGYUN.Abp.AspNetCore.SignalR}/Microsoft/AspNetCore/Builder/SignalRJwtTokenApplicationBuilderExtensions.cs (100%) create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/Microsoft/AspNetCore/Http/SignalRJwtTokenMiddleware.cs rename aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/{MessageHub.cs => MessagesHub.cs} (58%) create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/IFriendStore.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserFriend.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/IUserCardFinder.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Sex.cs delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/Microsoft/AspNetCore/Http/SignalRJwtTokenMiddleware.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendCreateDto.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendGetByPagedDto.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendOperationDto.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IMyFriendAppService.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/MyFriendAppService.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Chat/UserChatCardConsts.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatDataSeeder.cs delete mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatGroupAdmin.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/FriendStore.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IChatDataSeeder.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatCardRepository.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatFriendRepository.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserCardFinder.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatCard.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriend.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserGroupCard.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Utils/DateTimeHelper.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatCardRepository.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/IMessageServiceDbContext.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/MyFriendController.cs create mode 100644 aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201024093309_Add-MemberCard-Entity.Designer.cs create mode 100644 aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201024093309_Add-MemberCard-Entity.cs create mode 100644 aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201024114206_Add-UserChatFriend-Entity.Designer.cs create mode 100644 aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201024114206_Add-UserChatFriend-Entity.cs create mode 100644 vueJs/src/api/instant-message.ts create mode 100644 vueJs/src/components/InstantMessage/index.vue diff --git a/aspnet-core/LINGYUN.MicroService.sln b/aspnet-core/LINGYUN.MicroService.sln index e01605823..358dab774 100644 --- a/aspnet-core/LINGYUN.MicroService.sln +++ b/aspnet-core/LINGYUN.MicroService.sln @@ -251,6 +251,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.PermissionManag EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Account.Web", "modules\account\LINGYUN.Abp.Account.Web\LINGYUN.Abp.Account.Web.csproj", "{5F43141B-6C63-4547-B9D6-D69EC3D7CA7E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.AspNetCore.SignalR.JwtToken", "modules\common\LINGYUN.Abp.AspNetCore.SignalR\LINGYUN.Abp.AspNetCore.SignalR.JwtToken.csproj", "{A66D48C9-F141-4111-9169-CEB64AFFF61D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -665,6 +667,10 @@ Global {5F43141B-6C63-4547-B9D6-D69EC3D7CA7E}.Debug|Any CPU.Build.0 = Debug|Any CPU {5F43141B-6C63-4547-B9D6-D69EC3D7CA7E}.Release|Any CPU.ActiveCfg = Release|Any CPU {5F43141B-6C63-4547-B9D6-D69EC3D7CA7E}.Release|Any CPU.Build.0 = Release|Any CPU + {A66D48C9-F141-4111-9169-CEB64AFFF61D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A66D48C9-F141-4111-9169-CEB64AFFF61D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A66D48C9-F141-4111-9169-CEB64AFFF61D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A66D48C9-F141-4111-9169-CEB64AFFF61D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -791,6 +797,7 @@ Global {B46D6DAF-98C6-441F-9FA5-3CAD7CF27727} = {CC362C67-6FC1-42B3-A130-8120AA8D790C} {2D377D3A-70EC-4BB3-9F4C-6C933693DA98} = {52B5D4F7-237B-4E0A-A167-68442164F70A} {5F43141B-6C63-4547-B9D6-D69EC3D7CA7E} = {9E72FEB9-A626-4312-892B-CDD043879758} + {A66D48C9-F141-4111-9169-CEB64AFFF61D} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/LINGYUN.Abp.AspNetCore.SignalR.JwtToken.csproj b/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/LINGYUN.Abp.AspNetCore.SignalR.JwtToken.csproj new file mode 100644 index 000000000..5e09bfd3b --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/LINGYUN.Abp.AspNetCore.SignalR.JwtToken.csproj @@ -0,0 +1,14 @@ + + + + + + netcoreapp3.1 + + + + + + + + diff --git a/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/LINGYUN/Abp/AspNetCore/SignalR/JwtToken/AbpAspNetCoreSignalRJwtTokenMapPathOptions.cs b/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/LINGYUN/Abp/AspNetCore/SignalR/JwtToken/AbpAspNetCoreSignalRJwtTokenMapPathOptions.cs new file mode 100644 index 000000000..76c4ec29d --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/LINGYUN/Abp/AspNetCore/SignalR/JwtToken/AbpAspNetCoreSignalRJwtTokenMapPathOptions.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; + +namespace LINGYUN.Abp.AspNetCore.SignalR.JwtToken +{ + public class AbpAspNetCoreSignalRJwtTokenMapPathOptions + { + public List MapJwtTokenPaths { get; set; } + public AbpAspNetCoreSignalRJwtTokenMapPathOptions() + { + MapJwtTokenPaths = new List(); + } + + public void MapPath(string path) + { + if (path.StartsWith("/signalr-hubs/")) + { + MapJwtTokenPaths.AddIfNotContains(path); + } + else + { + MapJwtTokenPaths.AddIfNotContains($"/signalr-hubs/{path}"); + } + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/LINGYUN/Abp/AspNetCore/SignalR/JwtToken/AbpAspNetCoreSignalRJwtTokenModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/LINGYUN/Abp/AspNetCore/SignalR/JwtToken/AbpAspNetCoreSignalRJwtTokenModule.cs new file mode 100644 index 000000000..bb478ed30 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/LINGYUN/Abp/AspNetCore/SignalR/JwtToken/AbpAspNetCoreSignalRJwtTokenModule.cs @@ -0,0 +1,18 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AspNetCore.SignalR; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.AspNetCore.SignalR.JwtToken +{ + [DependsOn( + typeof(AbpAspNetCoreSignalRModule))] + public class AbpAspNetCoreSignalRJwtTokenModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + + Configure(configuration.GetSection("SignalR:MapPath")); + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/Microsoft/AspNetCore/Builder/SignalRJwtTokenApplicationBuilderExtensions.cs b/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/Microsoft/AspNetCore/Builder/SignalRJwtTokenApplicationBuilderExtensions.cs similarity index 100% rename from aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/Microsoft/AspNetCore/Builder/SignalRJwtTokenApplicationBuilderExtensions.cs rename to aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/Microsoft/AspNetCore/Builder/SignalRJwtTokenApplicationBuilderExtensions.cs diff --git a/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/Microsoft/AspNetCore/Http/SignalRJwtTokenMiddleware.cs b/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/Microsoft/AspNetCore/Http/SignalRJwtTokenMiddleware.cs new file mode 100644 index 000000000..8944ed0e0 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR/Microsoft/AspNetCore/Http/SignalRJwtTokenMiddleware.cs @@ -0,0 +1,45 @@ +using LINGYUN.Abp.AspNetCore.SignalR.JwtToken; +using Microsoft.Extensions.Options; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace Microsoft.AspNetCore.Http +{ + public class SignalRJwtTokenMiddleware : IMiddleware, ITransientDependency + { + protected AbpAspNetCoreSignalRJwtTokenMapPathOptions Options { get; } + + public SignalRJwtTokenMiddleware(IOptions options) + { + Options = options.Value; + } + + public async Task InvokeAsync(HttpContext context, RequestDelegate next) + { + if (Options.MapJwtTokenPaths.Any(path => context.Request.Path.StartsWithSegments(path))) + { + if (context.User.Identity?.IsAuthenticated != true) + { + if (context.Request.Query.TryGetValue("access_token", out var accessToken)) + { + context.Request.Headers.Add("Authorization", $"Bearer {accessToken}"); + } + + } + } + //if (context.Request.Path.StartsWithSegments("/signalr-hubs/")) + //{ + // if (context.User.Identity?.IsAuthenticated != true) + // { + // if (context.Request.Query.TryGetValue("access_token", out var accessToken)) + // { + // context.Request.Headers.Add("Authorization", $"Bearer {accessToken}"); + // } + + // } + //} + await next(context); + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN.Abp.IM.SignalR.csproj b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN.Abp.IM.SignalR.csproj index a5f0374fb..f7a1552f9 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN.Abp.IM.SignalR.csproj +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN.Abp.IM.SignalR.csproj @@ -9,9 +9,11 @@ + + diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/AbpIMSignalRModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/AbpIMSignalRModule.cs index 6d2bcdc75..1708965fd 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/AbpIMSignalRModule.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/AbpIMSignalRModule.cs @@ -1,4 +1,5 @@ -using LINGYUN.Abp.RealTime; +using LINGYUN.Abp.AspNetCore.SignalR.JwtToken; +using LINGYUN.Abp.RealTime; using Volo.Abp.AspNetCore.SignalR; using Volo.Abp.Modularity; @@ -6,9 +7,16 @@ namespace LINGYUN.Abp.IM.SignalR { [DependsOn( typeof(AbpRealTimeModule), - typeof(AbpAspNetCoreSignalRModule))] + typeof(AbpAspNetCoreSignalRModule), + typeof(AbpAspNetCoreSignalRJwtTokenModule))] public class AbpIMSignalRModule : AbpModule { - + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.MapPath("messages"); + }); + } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessageHub.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs similarity index 58% rename from aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessageHub.cs rename to aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs index cf47eeaa5..84a6559ad 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessageHub.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs @@ -1,23 +1,82 @@ -using LINGYUN.Abp.IM.Messages; +using LINGYUN.Abp.IM.Contract; +using LINGYUN.Abp.IM.Messages; using LINGYUN.Abp.RealTime.Client; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.SignalR; using Microsoft.Extensions.Logging; using System; using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; namespace LINGYUN.Abp.IM.SignalR.Hubs { [Authorize] - public class MessageHub : OnlineClientHubBase + public class MessagesHub : OnlineClientHubBase { - private readonly IMessageStore _messageStore; + protected IFriendStore FriendStore { get; } + protected IMessageStore MessageStore { get; } - public MessageHub( + public MessagesHub( + IFriendStore friendStore, IMessageStore messageStore) { - _messageStore = messageStore; + FriendStore = friendStore; + MessageStore = messageStore; } + + [HubMethodName("LastContactFriends")] + public virtual async Task> GetLastContactFriendsAsync( + Guid? tenantId, + Guid userId, + int skipCount = 0, + int maxResultCount = 10) + { + var myFrientCount = await FriendStore.GetCountAsync(tenantId, userId); + + var lastContractFriends = await FriendStore + .GetLastContactListAsync(tenantId, userId, skipCount, maxResultCount); + + return new PagedResultDto(myFrientCount, lastContractFriends); + } + + [HubMethodName("MyFriends")] + public virtual async Task> GetMyFriendsAsync( + Guid? tenantId, + Guid userId, + string filter = "", + string sorting = nameof(UserFriend.UserId), + bool reverse = false, + int skipCount = 0, + int maxResultCount = 10) + { + var myFrientCount = await FriendStore.GetCountAsync(tenantId, userId); + + var myFriends = await FriendStore + .GetListAsync(tenantId, userId, filter, sorting, reverse, skipCount, maxResultCount); + + return new PagedResultDto(myFrientCount, myFriends); + } + + [HubMethodName("AddFriend")] + public virtual async Task AddFriendAsync( + Guid? tenantId, + Guid userId, + Guid friendId, + string remarkName = "") + { + await FriendStore.AddMemberAsync(tenantId, userId, friendId, remarkName); + } + + [HubMethodName("RemoveFriend")] + public virtual async Task RemoveFriendAsync( + Guid? tenantId, + Guid userId, + Guid friendId, + string remarkName = "") + { + await FriendStore.RemoveMemberAsync(tenantId, userId, friendId); + } + /// /// 客户端调用发送消息方法 /// @@ -27,7 +86,7 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs public virtual async Task SendMessageAsync(ChatMessage chatMessage) { // 持久化 - await _messageStore.StoreMessageAsync(chatMessage); + await MessageStore.StoreMessageAsync(chatMessage); try { diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSender.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSender.cs index 380c90669..dc804e5c6 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSender.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSender.cs @@ -16,13 +16,13 @@ namespace LINGYUN.Abp.IM.SignalR.Messages private readonly IOnlineClientManager _onlineClientManager; - private readonly IHubContext _hubContext; + private readonly IHubContext _hubContext; private readonly IMessageStore _messageStore; public SignalRMessageSender( IOnlineClientManager onlineClientManager, - IHubContext hubContext, + IHubContext hubContext, IMessageStore messageStore) { _hubContext = hubContext; diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/IFriendStore.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/IFriendStore.cs new file mode 100644 index 000000000..102fc7ef3 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/IFriendStore.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace LINGYUN.Abp.IM.Contract +{ + public interface IFriendStore + { + /// + /// 获取好友数量 + /// + /// + /// + /// + /// + Task GetCountAsync( + Guid? tenantId, + Guid userId, + string filter = ""); + /// + /// 获取好友列表 + /// + /// + /// + /// + /// + /// + /// + /// + /// + Task> GetListAsync( + Guid? tenantId, + Guid userId, + string filter = "", + string sorting = nameof(UserFriend.UserId), + bool reverse = false, + int skipCount = 0, + int maxResultCount = 10); + /// + /// 获取最近联系好友列表 + /// + /// + /// + /// + /// + /// + Task> GetLastContactListAsync( + Guid? tenantId, + Guid userId, + int skipCount = 0, + int maxResultCount = 10); + /// + /// 获取好友信息 + /// + /// + /// + /// + /// + Task GetMemberAsync( + Guid? tenantId, + Guid userId, + Guid friendId); + /// + /// 添加好友 + /// + /// + /// + /// + /// + /// + Task AddMemberAsync( + Guid? tenantId, + Guid userId, + Guid friendId, + string remarkName = ""); + /// + /// 移除好友 + /// + /// + /// + /// + /// + Task RemoveMemberAsync( + Guid? tenantId, + Guid userId, + Guid friendId); + /// + /// 添加黑名单 + /// + /// + /// + /// + /// + Task AddShieldMemberAsync( + Guid? tenantId, + Guid userId, + Guid friendId); + /// + /// 移除黑名单 + /// + /// + /// + /// + /// + Task RemoveShieldMemberAsync( + Guid? tenantId, + Guid userId, + Guid friendId); + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserFriend.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserFriend.cs new file mode 100644 index 000000000..394ba4634 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserFriend.cs @@ -0,0 +1,28 @@ +using System; + +namespace LINGYUN.Abp.IM.Contract +{ + public class UserFriend : UserCard + { + /// + /// 好友标识 + /// + public Guid FriendId { get; set; } + /// + /// 已添加黑名单 + /// + public bool Black { get; set; } + /// + /// 特别关注 + /// + public bool SpecialFocus { get; set; } + /// + /// 消息免打扰 + /// + public bool DontDisturb { get; set; } + /// + /// 备注名称 + /// + public string RemarkName { get; set; } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/GroupUserCard.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/GroupUserCard.cs index ff6315a5b..f41d84064 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/GroupUserCard.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/GroupUserCard.cs @@ -1,22 +1,12 @@ -using System.Collections.Generic; -using System.Linq; - -namespace LINGYUN.Abp.IM.Group +namespace LINGYUN.Abp.IM.Group { public class GroupUserCard : UserCard { public long GroupId { get; set; } public bool IsAdmin { get; set; } public bool IsSuperAdmin { get; set; } - public IDictionary Permissions { get; set; } public GroupUserCard() { - Permissions = new Dictionary(); - } - - public bool IsGrant(string key) - { - return Permissions.Any(x => x.Equals(key) && x.Value); } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/IUserGroupStore.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/IUserGroupStore.cs index ccd152c80..670f55eba 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/IUserGroupStore.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/IUserGroupStore.cs @@ -22,20 +22,19 @@ namespace LINGYUN.Abp.IM.Group /// Task> GetUserGroupsAsync(Guid? tenantId, Guid userId); /// - /// 获取通讯组所有用户 + /// 获取群组成员列表 /// /// /// /// - Task> GetGroupUsersAsync(Guid? tenantId, long groupId); + Task> GetMembersAsync(Guid? tenantId, long groupId); /// - /// 获取通讯组用户数 + /// 获取群组成员数 /// /// /// - /// /// - Task GetGroupUsersCountAsync(Guid? tenantId, long groupId, string filter = ""); + Task GetMembersCountAsync(Guid? tenantId, long groupId); /// /// 获取通讯组用户 /// @@ -46,7 +45,13 @@ namespace LINGYUN.Abp.IM.Group /// /// /// - Task> GetGroupUsersAsync(Guid? tenantId, long groupId, string filter = "", string sorting = nameof(UserGroup.UserId), int skipCount = 1, int maxResultCount = 10); + Task> GetMembersAsync( + Guid? tenantId, + long groupId, + string sorting = nameof(GroupUserCard.UserId), + bool reverse = false, + int skipCount = 0, + int maxResultCount = 10); /// /// 用户加入通讯组 /// diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/IUserCardFinder.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/IUserCardFinder.cs new file mode 100644 index 000000000..cdbe9834c --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/IUserCardFinder.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace LINGYUN.Abp.IM +{ + /// + /// IM用户资料查找接口 + /// + public interface IUserCardFinder + { + /// + /// 查询IM用户数量 + /// + /// + /// 用户名称 + /// 起止年龄 + /// 起止年龄 + /// 性别 + /// + Task GetCountAsync( + Guid? tenantId, + string findUserName = "", + int? startAge = null, + int? endAge = null, + Sex? sex = null); + /// + /// 查询IM用户列表 + /// + /// + /// 用户名称 + /// 起止年龄 + /// 起止年龄 + /// 性别 + /// 排序字段 + /// 是否倒序 + /// 起始记录位置 + /// 最大返回数量 + /// + Task> GetListAsync( + Guid? tenantId, + string findUserName = "", + int? startAge = null, + int? endAge = null, + Sex? sex = null, + string sorting = nameof(UserCard.UserId), + bool reverse = false, + int skipCount = 0, + int maxResultCount = 10); + /// + /// 获取IM用户信息 + /// + /// + /// + /// + Task GetMemberAsync( + Guid? tenantId, + Guid findUserId); + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageStore.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageStore.cs index abc64135e..8cdbf63ac 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageStore.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageStore.cs @@ -22,15 +22,32 @@ namespace LINGYUN.Abp.IM.Messages /// /// /// - Task GetGroupMessageCountAsync(Guid? tenantId, long groupId, string filter = "", MessageType? type = null); + Task GetGroupMessageCountAsync( + Guid? tenantId, + long groupId, + string filter = "", + MessageType? type = null); /// /// 获取群组聊天记录 /// /// - /// + /// + /// + /// + /// + /// + /// /// /// - Task> GetGroupMessageAsync(Guid? tenantId, long groupId, string filter = "", string sorting = nameof(ChatMessage.MessageId), MessageType? type = null, int skipCount = 1, int maxResultCount = 10); + Task> GetGroupMessageAsync( + Guid? tenantId, + long groupId, + string filter = "", + string sorting = nameof(ChatMessage.MessageId), + bool reverse = true, + MessageType? type = null, + int skipCount = 0, + int maxResultCount = 10); /// /// 获取与某个用户的聊天记录总数 /// @@ -40,7 +57,12 @@ namespace LINGYUN.Abp.IM.Messages /// /// /// - Task GetChatMessageCountAsync(Guid? tenantId, Guid sendUserId, Guid receiveUserId, string filter = "", MessageType? type = null); + Task GetChatMessageCountAsync( + Guid? tenantId, + Guid sendUserId, + Guid receiveUserId, + string filter = "", + MessageType? type = null); /// /// 获取与某个用户的聊天记录 /// @@ -48,6 +70,15 @@ namespace LINGYUN.Abp.IM.Messages /// /// /// - Task> GetChatMessageAsync(Guid? tenantId, Guid sendUserId, Guid receiveUserId, string filter = "", string sorting = nameof(ChatMessage.MessageId), MessageType? type = null, int skipCount = 1, int maxResultCount = 10); + Task> GetChatMessageAsync( + Guid? tenantId, + Guid sendUserId, + Guid receiveUserId, + string filter = "", + string sorting = nameof(ChatMessage.MessageId), + bool reverse = true, + MessageType? type = null, + int skipCount = 0, + int maxResultCount = 10); } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Sex.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Sex.cs new file mode 100644 index 000000000..9421daaa5 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Sex.cs @@ -0,0 +1,9 @@ +namespace LINGYUN.Abp.IM +{ + public enum Sex + { + Male, + Female, + Other + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/UserCard.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/UserCard.cs index ef6b03503..ba243271e 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/UserCard.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/UserCard.cs @@ -5,15 +5,16 @@ namespace LINGYUN.Abp.IM public class UserCard { public Guid? TenantId { get; set; } + public Guid UserId { get; set; } - #region 下一个版本细粒度的用户资料 与Identity集成 + #region 细粒度的用户资料 public string UserName { get; set; } /// /// 头像 /// - public string AvatarlUrl { get; set; } + public string AvatarUrl { get; set; } /// /// 昵称 /// @@ -21,27 +22,23 @@ namespace LINGYUN.Abp.IM /// /// 年龄 /// - public int Arg { get; set; } + public int Age { get; set; } /// /// 性别 /// - public string Sex { get; set; } - /// - /// 国家 - /// - public string Countriy { get; set; } + public Sex Sex { get; set; } /// - /// 省份 + /// 签名 /// - public string Province { get; set; } + public string Sign { get; set; } /// - /// 城市 + /// 说明 /// - public string City { get; set; } + public string Description { get; set; } /// - /// 签名 + /// 生日 /// - public string Sign { get; set; } + public DateTime? Birthday { get; set; } #endregion } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN.Abp.Notifications.SignalR.csproj b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN.Abp.Notifications.SignalR.csproj index 19c1f208f..624125a8a 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN.Abp.Notifications.SignalR.csproj +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN.Abp.Notifications.SignalR.csproj @@ -13,6 +13,7 @@ + diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/AbpNotificationsSignalRModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/AbpNotificationsSignalRModule.cs index 572ab75c3..130a9fd30 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/AbpNotificationsSignalRModule.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/AbpNotificationsSignalRModule.cs @@ -1,4 +1,5 @@ -using LINGYUN.Abp.RealTime; +using LINGYUN.Abp.AspNetCore.SignalR.JwtToken; +using LINGYUN.Abp.RealTime; using Volo.Abp.AspNetCore.SignalR; using Volo.Abp.Modularity; @@ -7,7 +8,8 @@ namespace LINGYUN.Abp.Notifications.SignalR [DependsOn( typeof(AbpRealTimeModule), typeof(AbpNotificationModule), - typeof(AbpAspNetCoreSignalRModule))] + typeof(AbpAspNetCoreSignalRModule), + typeof(AbpAspNetCoreSignalRJwtTokenModule))] public class AbpNotificationsSignalRModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) @@ -16,6 +18,11 @@ namespace LINGYUN.Abp.Notifications.SignalR { options.PublishProviders.Add(); }); + + Configure(options => + { + options.MapPath("notifications"); + }); } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/Microsoft/AspNetCore/Http/SignalRJwtTokenMiddleware.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/Microsoft/AspNetCore/Http/SignalRJwtTokenMiddleware.cs deleted file mode 100644 index 3941222b6..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/Microsoft/AspNetCore/Http/SignalRJwtTokenMiddleware.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; - -namespace Microsoft.AspNetCore.Http -{ - public class SignalRJwtTokenMiddleware : IMiddleware, ITransientDependency - { - public async Task InvokeAsync(HttpContext context, RequestDelegate next) - { - // 仅针对自定义的SignalR hub - if (context.Request.Path.StartsWithSegments("/signalr-hubs/notifications")) - { - if (context.User.Identity?.IsAuthenticated != true) - { - if (context.Request.Query.TryGetValue("access_token", out var accessToken)) - { - context.Request.Headers.Add("Authorization", $"Bearer {accessToken}"); - } - - } - } - await next(context); - } - } -} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/GroupMessageGetByPagedDto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/GroupMessageGetByPagedDto.cs index 6c64ff096..82ec7c4a5 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/GroupMessageGetByPagedDto.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/GroupMessageGetByPagedDto.cs @@ -8,6 +8,7 @@ namespace LINGYUN.Abp.MessageService.Chat { [Required] public long GroupId { get; set; } + public bool Reverse { get; set; } public string Filter { get; set; } public MessageType? MessageType { get; set; } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/GroupUserGetByPagedDto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/GroupUserGetByPagedDto.cs index 03f52b729..3441332c8 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/GroupUserGetByPagedDto.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/GroupUserGetByPagedDto.cs @@ -8,6 +8,8 @@ namespace LINGYUN.Abp.MessageService.Chat [Required] public long GroupId { get; set; } + public bool Reverse { get; set; } + public string Filter { get; set; } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendCreateDto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendCreateDto.cs new file mode 100644 index 000000000..00192a0ae --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendCreateDto.cs @@ -0,0 +1,7 @@ +namespace LINGYUN.Abp.MessageService.Chat +{ + public class MyFriendCreateDto : MyFriendOperationDto + { + public string RemarkName { get; set; } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendGetByPagedDto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendGetByPagedDto.cs new file mode 100644 index 000000000..ae27bef2b --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendGetByPagedDto.cs @@ -0,0 +1,15 @@ +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public class MyFriendGetByPagedDto : PagedAndSortedResultRequestDto + { + public string Filter { get; set; } + + public bool Reverse { get; set; } + } + + public class MyLastContractFriendGetByPagedDto : PagedResultRequestDto + { + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendOperationDto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendOperationDto.cs new file mode 100644 index 000000000..4b1021666 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendOperationDto.cs @@ -0,0 +1,11 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public class MyFriendOperationDto + { + [Required] + public Guid FriendId { get; set; } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/UserMessageGetByPagedDto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/UserMessageGetByPagedDto.cs index 444dfaf37..514e5decc 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/UserMessageGetByPagedDto.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/UserMessageGetByPagedDto.cs @@ -9,6 +9,7 @@ namespace LINGYUN.Abp.MessageService.Chat { [Required] public Guid ReceiveUserId { get; set; } + public bool Reverse { get; set; } public string Filter { get; set; } public MessageType? MessageType { get; set; } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IChatAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IChatAppService.cs index 1180b0582..befeb27ad 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IChatAppService.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IChatAppService.cs @@ -30,7 +30,7 @@ namespace LINGYUN.Abp.MessageService.Chat /// /// /// - Task> GetGroupUsersAsync(GroupUserGetByPagedDto groupUserGetByPaged); + Task> GetGroupUsersAsync(GroupUserGetByPagedDto groupUserGetByPaged); /// /// 处理用户群组申请 /// diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IMyFriendAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IMyFriendAppService.cs new file mode 100644 index 000000000..58c3c7c4c --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IMyFriendAppService.cs @@ -0,0 +1,18 @@ +using LINGYUN.Abp.IM.Contract; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public interface IMyFriendAppService : IApplicationService + { + Task> GetMyFriendsAsync(MyFriendGetByPagedDto input); + + Task> GetLastContactFriendsAsync(PagedResultRequestDto input); + + Task CreateAsync(MyFriendCreateDto input); + + Task DeleteAsync(MyFriendOperationDto input); + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/ChatAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/ChatAppService.cs index a0ecd69a9..e5c509afd 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/ChatAppService.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/ChatAppService.cs @@ -1,5 +1,6 @@ using LINGYUN.Abp.IM.Group; using LINGYUN.Abp.IM.Messages; +using Microsoft.AspNetCore.Authorization; using System.Collections.Immutable; using System.Threading.Tasks; using Volo.Abp; @@ -25,6 +26,7 @@ namespace LINGYUN.Abp.MessageService.Chat _userGroupStore = userGroupStore; } + [Authorize] public virtual async Task> GetMyChatMessageAsync(UserMessageGetByPagedDto userMessageGetByPaged) { var chatMessageCount = await _messageStore @@ -33,38 +35,41 @@ namespace LINGYUN.Abp.MessageService.Chat var chatMessages = await _messageStore .GetChatMessageAsync(CurrentTenant.Id, CurrentUser.GetId(), userMessageGetByPaged.ReceiveUserId, - userMessageGetByPaged.Filter, userMessageGetByPaged.Sorting, userMessageGetByPaged.MessageType, - userMessageGetByPaged.SkipCount, userMessageGetByPaged.MaxResultCount); + userMessageGetByPaged.Filter, userMessageGetByPaged.Sorting, userMessageGetByPaged.Reverse, + userMessageGetByPaged.MessageType, userMessageGetByPaged.SkipCount, userMessageGetByPaged.MaxResultCount); return new PagedResultDto(chatMessageCount, chatMessages); } public virtual async Task> GetGroupMessageAsync(GroupMessageGetByPagedDto groupMessageGetByPaged) { + // TODO: 增加验证,用户不在群组却来查询这个群组消息,是非法客户端操作 + var groupMessageCount = await _messageStore .GetGroupMessageCountAsync(CurrentTenant.Id, groupMessageGetByPaged.GroupId, groupMessageGetByPaged.Filter, groupMessageGetByPaged.MessageType); var groupMessages = await _messageStore .GetGroupMessageAsync(CurrentTenant.Id, groupMessageGetByPaged.GroupId, - groupMessageGetByPaged.Filter, groupMessageGetByPaged.Sorting, groupMessageGetByPaged.MessageType, - groupMessageGetByPaged.SkipCount, groupMessageGetByPaged.MaxResultCount); + groupMessageGetByPaged.Filter, groupMessageGetByPaged.Sorting, groupMessageGetByPaged.Reverse, + groupMessageGetByPaged.MessageType, groupMessageGetByPaged.SkipCount, groupMessageGetByPaged.MaxResultCount); return new PagedResultDto(groupMessageCount, groupMessages); } - public virtual async Task> GetGroupUsersAsync(GroupUserGetByPagedDto groupUserGetByPaged) + public virtual async Task> GetGroupUsersAsync(GroupUserGetByPagedDto groupUserGetByPaged) { - var groupUserCount = await _userGroupStore.GetGroupUsersCountAsync(CurrentTenant.Id, - groupUserGetByPaged.GroupId, groupUserGetByPaged.Filter); + var groupUserCardCount = await _userGroupStore + .GetMembersCountAsync(CurrentTenant.Id, groupUserGetByPaged.GroupId); - var groupUsers = await _userGroupStore.GetGroupUsersAsync(CurrentTenant.Id, - groupUserGetByPaged.GroupId, groupUserGetByPaged.Filter, groupUserGetByPaged.Sorting, + var groupUserCards = await _userGroupStore.GetMembersAsync(CurrentTenant.Id, + groupUserGetByPaged.GroupId, groupUserGetByPaged.Sorting, groupUserGetByPaged.Reverse, groupUserGetByPaged.SkipCount, groupUserGetByPaged.MaxResultCount); - return new PagedResultDto(groupUserCount, groupUsers); + return new PagedResultDto(groupUserCardCount, groupUserCards); } + [Authorize] public virtual async Task> GetMyGroupsAsync() { var myGroups = await _userGroupStore.GetUserGroupsAsync(CurrentTenant.Id, CurrentUser.GetId()); @@ -81,7 +86,7 @@ namespace LINGYUN.Abp.MessageService.Chat // 当前登录用户不再用户组 throw new UserFriendlyException(""); } - if (!myGroupCard.IsGrant(nameof(ChatGroupAdmin.AllowAddPeople))) + if (!myGroupCard.IsAdmin) { // 当前登录用户没有加人权限 throw new UserFriendlyException(""); @@ -99,7 +104,7 @@ namespace LINGYUN.Abp.MessageService.Chat // 当前登录用户不再用户组 throw new UserFriendlyException(""); } - if (!myGroupCard.IsGrant(nameof(ChatGroupAdmin.AllowKickPeople))) + if (!myGroupCard.IsAdmin) { // 当前登录用户没有踢人权限 throw new UserFriendlyException(""); diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/MyFriendAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/MyFriendAppService.cs new file mode 100644 index 000000000..b11ffcda1 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/MyFriendAppService.cs @@ -0,0 +1,53 @@ +using LINGYUN.Abp.IM.Contract; +using Microsoft.AspNetCore.Authorization; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; +using Volo.Abp.Users; + +namespace LINGYUN.Abp.MessageService.Chat +{ + [Authorize] + public class MyFriendAppService : ApplicationService, IMyFriendAppService + { + protected IFriendStore FriendStore { get; } + + public MyFriendAppService(IFriendStore friendStore) + { + FriendStore = friendStore; + } + + public virtual async Task CreateAsync(MyFriendCreateDto input) + { + await FriendStore.AddMemberAsync(CurrentTenant.Id, CurrentUser.GetId(), input.FriendId, input.RemarkName); + } + + public virtual async Task DeleteAsync(MyFriendOperationDto input) + { + await FriendStore.RemoveMemberAsync(CurrentTenant.Id, CurrentUser.GetId(), input.FriendId); + } + + public virtual async Task> GetLastContactFriendsAsync(PagedResultRequestDto input) + { + var myFrientCount = await FriendStore.GetCountAsync(CurrentTenant.Id, CurrentUser.GetId()); + + var myFriends = await FriendStore + .GetLastContactListAsync(CurrentTenant.Id, CurrentUser.GetId(), + input.SkipCount, input.MaxResultCount); + + return new PagedResultDto(myFrientCount, myFriends); + } + + public virtual async Task> GetMyFriendsAsync(MyFriendGetByPagedDto input) + { + var myFrientCount = await FriendStore.GetCountAsync(CurrentTenant.Id, CurrentUser.GetId()); + + var myFriends = await FriendStore + .GetListAsync(CurrentTenant.Id, CurrentUser.GetId(), + input.Filter, input.Sorting, input.Reverse, + input.SkipCount, input.MaxResultCount); + + return new PagedResultDto(myFrientCount, myFriends); + } + } +} 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 57cd2fec7..5c97ed0c0 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 @@ -9,6 +9,7 @@ + diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Chat/UserChatCardConsts.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Chat/UserChatCardConsts.cs new file mode 100644 index 000000000..9a29d2986 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Chat/UserChatCardConsts.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Users; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public class UserChatCardConsts + { + public static int MaxUserNameLength { get; set; } = AbpUserConsts.MaxUserNameLength; + public static int MaxSignLength { get; set; } = 30; + public static int MaxNickNameLength { get; set; } = AbpUserConsts.MaxUserNameLength; + public static int MaxDescriptionLength { get; set; } = 50; + public static int MaxAvatarUrlLength { get; set; } = 512; + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/AbpMessageServiceDbProperties.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/AbpMessageServiceDbProperties.cs index 6a87fed45..091a3b76b 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/AbpMessageServiceDbProperties.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/AbpMessageServiceDbProperties.cs @@ -5,5 +5,7 @@ public const string DefaultTablePrefix = "App"; public const string DefaultSchema = null; + + public const string ConnectionStringName = "MessageService"; } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatDataSeeder.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatDataSeeder.cs new file mode 100644 index 000000000..9a0532e55 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatDataSeeder.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.MultiTenancy; +using Volo.Abp.Timing; +using Volo.Abp.Uow; +using Volo.Abp.Users; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public class ChatDataSeeder : IChatDataSeeder, ITransientDependency + { + protected IClock Clock { get; } + protected ICurrentTenant CurrentTenant { get; } + protected IUserChatCardRepository UserChatCardRepository { get; } + protected IUserChatSettingRepository UserChatSettingRepository { get; } + public ChatDataSeeder( + IClock clock, + ICurrentTenant currentTenant, + IUserChatCardRepository userChatCardRepository, + IUserChatSettingRepository userChatSettingRepository) + { + Clock = clock; + CurrentTenant = currentTenant; + UserChatCardRepository = userChatCardRepository; + UserChatSettingRepository = userChatSettingRepository; + } + + [UnitOfWork] + public virtual async Task SeedAsync(IUserData user) + { + using (CurrentTenant.Change(user.TenantId)) + { + var userHasOpendIm = await UserChatSettingRepository.UserHasOpendImAsync(user.Id); + if (!userHasOpendIm) + { + var userChatSetting = new UserChatSetting(user.Id, user.TenantId); + + await UserChatSettingRepository.InsertAsync(userChatSetting); + + var userChatCard = new UserChatCard(user.Id, user.UserName, IM.Sex.Male, user.UserName, tenantId: user.TenantId) + { + CreationTime = Clock.Now, + CreatorId = user.Id + }; + + await UserChatCardRepository.InsertAsync(userChatCard); + } + } + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatGroup.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatGroup.cs index cb1eb1136..ee22667ba 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatGroup.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatGroup.cs @@ -14,6 +14,10 @@ namespace LINGYUN.Abp.MessageService.Chat /// public virtual Guid? TenantId { get; protected set; } /// + /// 群主 + /// + public virtual Guid AdminUserId { get; protected set; } + /// /// 群组标识 /// public virtual long GroupId { get; protected set; } @@ -28,11 +32,11 @@ namespace LINGYUN.Abp.MessageService.Chat /// /// 群组地址 /// - public virtual string Address { get; protected set; } + public virtual string Address { get; set; } /// /// 群组公告 /// - public virtual string Notice { get; protected set; } + public virtual string Notice { get; set; } /// /// 最大用户数量 /// @@ -52,23 +56,20 @@ namespace LINGYUN.Abp.MessageService.Chat protected ChatGroup() { } - public ChatGroup(long id, string name, string tag = "", string address = "", int maxUserCount = 200) + public ChatGroup( + long id, + Guid adminUserId, + string name, + string tag = "", + string address = "", + int maxUserCount = 200) { GroupId = id; + AdminUserId = adminUserId; Name = name; Tag = tag; Address = address; MaxUserCount = maxUserCount; } - - public void ChangeAddress(string address) - { - Address = address; - } - - public void SetNotice(string notice) - { - Notice = notice; - } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatGroupAdmin.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatGroupAdmin.cs deleted file mode 100644 index 6ab195ccf..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatGroupAdmin.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using Volo.Abp.Domain.Entities.Auditing; -using Volo.Abp.MultiTenancy; - -namespace LINGYUN.Abp.MessageService.Chat -{ - /// - /// 群管理员 - /// - public class ChatGroupAdmin : AuditedEntity, IMultiTenant - { - /// - /// 租户 - /// - public virtual Guid? TenantId { get; protected set; } - /// - /// 群组标识 - /// - public virtual long GroupId { get; protected set; } - /// - /// 管理员用户 - /// - public virtual Guid UserId { get; protected set; } - /// - /// 是否群主 - /// - public virtual bool IsSuperAdmin { get; protected set; } - /// - /// 允许禁言 - /// - public virtual bool AllowSilence { get; set; } - /// - /// 允许踢人 - /// - public virtual bool AllowKickPeople { get; set; } - /// - /// 允许加人 - /// - public virtual bool AllowAddPeople { get; set; } - /// - /// 允许发送群公告 - /// - public virtual bool AllowSendNotice { get; set; } - /// - /// 允许解散群组 - /// - public virtual bool AllowDissolveGroup { get; set; } - protected ChatGroupAdmin() { } - public ChatGroupAdmin(long groupId, Guid userId, bool isSuperAdmin = false) - { - GroupId = groupId; - UserId = userId; - AllowSilence = true; - AllowKickPeople = true; - AllowAddPeople = true; - AllowSendNotice = true; - SetSuperAdmin(isSuperAdmin); - } - - public void SetSuperAdmin(bool isSuperAdmin = false) - { - IsSuperAdmin = isSuperAdmin; - if (isSuperAdmin) - { - AllowDissolveGroup = true; - } - } - } -} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/FriendStore.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/FriendStore.cs new file mode 100644 index 000000000..e4bd716f7 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/FriendStore.cs @@ -0,0 +1,119 @@ +using LINGYUN.Abp.IM.Contract; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; +using Volo.Abp.Uow; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public class FriendStore : DomainService, IFriendStore + { + protected IUserChatFriendRepository UserChatFriendRepository { get; } + + public FriendStore( + IUserChatFriendRepository userChatFriendRepository) + { + UserChatFriendRepository = userChatFriendRepository; + } + + [UnitOfWork] + public virtual async Task AddMemberAsync(Guid? tenantId, Guid userId, Guid friendId, string remarkName = "") + { + using (CurrentTenant.Change(tenantId)) + { + if (!await UserChatFriendRepository.IsAddedAsync(userId, friendId)) + { + var userChatFriend = new UserChatFriend(userId, friendId, remarkName, tenantId) + { + CreationTime = Clock.Now, + CreatorId = userId + }; + + await UserChatFriendRepository.InsertAsync(userChatFriend); + } + } + } + + [UnitOfWork] + public virtual async Task AddShieldMemberAsync(Guid? tenantId, Guid userId, Guid friendId) + { + await ChangeFriendShieldAsync(tenantId, userId, friendId, true); + } + + public virtual async Task GetCountAsync(Guid? tenantId, Guid userId, string filter = "") + { + using (CurrentTenant.Change(tenantId)) + { + return await UserChatFriendRepository + .GetMembersCountAsync(userId, filter); + } + } + + public virtual async Task> GetListAsync(Guid? tenantId, Guid userId, string filter = "", string sorting = nameof(UserFriend.UserId), bool reverse = false, int skipCount = 0, int maxResultCount = 10) + { + using (CurrentTenant.Change(tenantId)) + { + return await UserChatFriendRepository + .GetMembersAsync(userId, filter, sorting, reverse, + skipCount, maxResultCount); + } + } + + public virtual async Task> GetLastContactListAsync( + Guid? tenantId, + Guid userId, + int skipCount = 0, + int maxResultCount = 10) + { + using (CurrentTenant.Change(tenantId)) + { + return await UserChatFriendRepository + .GetLastContactMembersAsync(userId, + skipCount, maxResultCount); + } + } + + public virtual async Task GetMemberAsync(Guid? tenantId, Guid userId, Guid friendId) + { + using (CurrentTenant.Change(tenantId)) + { + return await UserChatFriendRepository + .GetMemberAsync(userId, friendId); + } + } + + [UnitOfWork] + public virtual async Task RemoveMemberAsync(Guid? tenantId, Guid userId, Guid friendId) + { + using (CurrentTenant.Change(tenantId)) + { + var userChatFriend = await UserChatFriendRepository.FindByUserFriendIdAsync(userId, friendId); + if (userChatFriend != null) + { + await UserChatFriendRepository.DeleteAsync(userChatFriend); + } + } + } + + [UnitOfWork] + public virtual async Task RemoveShieldMemberAsync(Guid? tenantId, Guid userId, Guid friendId) + { + await ChangeFriendShieldAsync(tenantId, userId, friendId, false); + } + + + protected virtual async Task ChangeFriendShieldAsync(Guid? tenantId, Guid userId, Guid friendId, bool isBlack = false) + { + using (CurrentTenant.Change(tenantId)) + { + var userChatFriend = await UserChatFriendRepository.FindByUserFriendIdAsync(userId, friendId); + if (userChatFriend != null) + { + userChatFriend.Black = isBlack; + await UserChatFriendRepository.UpdateAsync(userChatFriend); + } + } + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IChatDataSeeder.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IChatDataSeeder.cs new file mode 100644 index 000000000..03ca8b7e3 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IChatDataSeeder.cs @@ -0,0 +1,11 @@ +using System.Threading.Tasks; +using Volo.Abp.Users; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public interface IChatDataSeeder + { + Task SeedAsync( + IUserData user); + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IGroupRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IGroupRepository.cs index 845ceeb63..568845459 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IGroupRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IGroupRepository.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; @@ -13,10 +14,18 @@ namespace LINGYUN.Abp.MessageService.Chat /// /// /// - Task UserHasBlackedAsync(long id, Guid formUserId); + Task UserHasBlackedAsync( + long id, + Guid formUserId, + CancellationToken cancellationToken = default); - Task GetByIdAsync(long id); + Task GetByIdAsync( + long id, + CancellationToken cancellationToken = default); + + Task> GetGroupAdminAsync( + long id, + CancellationToken cancellationToken = default); - Task> GetGroupAdminAsync(long id); } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IMessageRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IMessageRepository.cs index de3bf2bef..9c5af2539 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IMessageRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IMessageRepository.cs @@ -1,30 +1,92 @@ using LINGYUN.Abp.IM.Messages; using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; namespace LINGYUN.Abp.MessageService.Chat { public interface IMessageRepository { - Task InsertUserMessageAsync(UserMessage userMessage, bool saveChangs = false); + Task InsertUserMessageAsync( + UserMessage userMessage, + CancellationToken cancellationToken = default); - Task InsertGroupMessageAsync(GroupMessage groupMessage, bool saveChangs = false); + Task InsertGroupMessageAsync( + GroupMessage groupMessage, + CancellationToken cancellationToken = default); - Task GetUserMessageAsync(long id); + Task GetUserMessageAsync( + long id, + CancellationToken cancellationToken = default); - Task GetGroupMessageAsync(long id); + Task GetGroupMessageAsync( + long id, + CancellationToken cancellationToken = default); - Task GetUserMessagesCountAsync(Guid sendUserId, Guid receiveUserId, string filter = "", MessageType? type = null); + Task GetUserMessagesCountAsync( + Guid sendUserId, + Guid receiveUserId, + string filter = "", + MessageType? type = null, + CancellationToken cancellationToken = default); - Task> GetUserMessagesAsync(Guid sendUserId, Guid receiveUserId, string filter = "", string sorting = nameof(UserMessage.MessageId), MessageType? type = null, int skipCount = 1, int maxResultCount = 10); + Task GetCountAsync( + long groupId, + string filter = "", + MessageType? type = null, + CancellationToken cancellationToken = default); - Task GetGroupMessagesCountAsync(long groupId, string filter = "", MessageType? type = null); + Task GetCountAsync( + Guid sendUserId, + Guid receiveUserId, + string filter = "", + MessageType? type = null, + CancellationToken cancellationToken = default); - Task> GetGroupMessagesAsync(long groupId, string filter = "", string sorting = nameof(UserMessage.MessageId), MessageType? type = null, int skipCount = 1, int maxResultCount = 10); + Task> GetUserMessagesAsync( + Guid sendUserId, + Guid receiveUserId, + string filter = "", + string sorting = nameof(UserMessage.MessageId), + bool reverse = true, + MessageType? type = null, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default); - Task GetUserGroupMessagesCountAsync(Guid sendUserId, long groupId, string filter = "", MessageType? type = null); + Task GetGroupMessagesCountAsync( + long groupId, + string filter = "", + MessageType? type = null, + CancellationToken cancellationToken = default); - Task> GetUserGroupMessagesAsync(Guid sendUserId, long groupId, string filter = "", string sorting = nameof(UserMessage.MessageId), MessageType? type = null, int skipCount = 1, int maxResultCount = 10); + Task> GetGroupMessagesAsync( + long groupId, + string filter = "", + string sorting = nameof(UserMessage.MessageId), + bool reverse = true, + MessageType? type = null, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default); + + Task GetUserGroupMessagesCountAsync( + Guid sendUserId, + long groupId, + string filter = "", + MessageType? type = null, + CancellationToken cancellationToken = default); + + Task> GetUserGroupMessagesAsync( + Guid sendUserId, + long groupId, + string filter = "", + string sorting = nameof(UserMessage.MessageId), + bool reverse = true, + MessageType? type = null, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default); } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatCardRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatCardRepository.cs new file mode 100644 index 000000000..e55c9ab96 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatCardRepository.cs @@ -0,0 +1,38 @@ +using LINGYUN.Abp.IM; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public interface IUserChatCardRepository : IBasicRepository + { + Task CheckUserIdExistsAsync( + Guid userId, + CancellationToken cancellationToken = default); + + Task GetMemberCountAsync( + string findUserName = "", + int? startAge = null, + int? endAge = null, + Sex? sex = null, + CancellationToken cancellationToken = default); + + Task> GetMembersAsync( + string findUserName = "", + int? startAge = null, + int? endAge = null, + Sex? sex = null, + string sorting = nameof(UserChatCard.UserId), + bool reverse = false, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default); + + Task GetMemberAsync( + Guid findUserId, + CancellationToken cancellationToken = default); + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatFriendRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatFriendRepository.cs new file mode 100644 index 000000000..96cebd7fa --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatFriendRepository.cs @@ -0,0 +1,47 @@ +using LINGYUN.Abp.IM.Contract; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public interface IUserChatFriendRepository : IBasicRepository + { + Task IsAddedAsync( + Guid userId, + Guid frientId, + CancellationToken cancellationToken = default); + + Task FindByUserFriendIdAsync( + Guid userId, + Guid friendId, + CancellationToken cancellationToken = default); + + Task GetMembersCountAsync( + Guid userId, + string filter = "", + CancellationToken cancellationToken = default); + + Task> GetMembersAsync( + Guid userId, + string filter = "", + string sorting = nameof(UserChatFriend.UserId), + bool reverse = false, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default); + + Task> GetLastContactMembersAsync( + Guid userId, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default); + + Task GetMemberAsync( + Guid userId, + Guid friendId, + CancellationToken cancellationToken = default); + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatGroupRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatGroupRepository.cs index bcf1bfdfb..f7f04df57 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatGroupRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatGroupRepository.cs @@ -1,6 +1,7 @@ using LINGYUN.Abp.IM.Group; using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; @@ -9,23 +10,71 @@ namespace LINGYUN.Abp.MessageService.Chat public interface IUserChatGroupRepository : IBasicRepository { /// - /// 用户是否在组里 + /// 成员是否在群组里 /// /// /// /// - Task UserHasInGroupAsync(long groupId, Guid userId); - - Task GetUserGroupAsync(long groupId, Guid userId); - - Task GetGroupUserCardAsync(long groupId, Guid userId); - - Task> GetGroupUsersAsync(long groupId); - - Task GetGroupUsersCountAsync(long groupId, string filter = ""); - - Task> GetGroupUsersAsync(long groupId, string filter = "", string sorting = nameof(UserGroup.UserId), int skipCount = 1, int maxResultCount = 10); - - Task> GetUserGroupsAsync(Guid userId); + Task MemberHasInGroupAsync( + long groupId, + Guid userId, + CancellationToken cancellationToken = default); + /// + /// 获取群组成员 + /// + /// + /// + /// + /// + Task GetMemberAsync( + long groupId, + Guid userId, + CancellationToken cancellationToken = default); + /// + /// 获取群组成员数 + /// + /// + /// + /// + Task GetMembersCountAsync( + long groupId, + CancellationToken cancellationToken = default); + /// + /// 获取群组成员列表 + /// + /// + /// + /// + /// + /// + /// + /// + Task> GetMembersAsync( + long groupId, + string sorting = nameof(UserChatCard.UserId), + bool reverse = false, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default); + /// + /// 获取成员所在群组列表 + /// + /// + /// + /// + Task> GetMemberGroupsAsync( + Guid userId, + CancellationToken cancellationToken = default); + /// + /// 从群组中移除成员 + /// + /// + /// + /// + /// + Task RemoveMemberFormGroupAsync( + long groupId, + Guid userId, + CancellationToken cancellationToken = default); } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/MessageStore.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/MessageStore.cs index af3f84572..b11bbc06a 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/MessageStore.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/MessageStore.cs @@ -54,31 +54,72 @@ namespace LINGYUN.Abp.MessageService.Chat } } - public async Task> GetGroupMessageAsync(Guid? tenantId, long groupId, string filter = "", - string sorting = nameof(ChatMessage.MessageId), MessageType? type = null, int skipCount = 1, int maxResultCount = 10) + public async Task> GetGroupMessageAsync( + Guid? tenantId, + long groupId, + string filter = "", + string sorting = nameof(ChatMessage.MessageId), + bool reverse = true, + MessageType? type = null, + int skipCount = 0, + int maxResultCount = 10) { using (CurrentTenant.Change(tenantId)) { var groupMessages = await MessageRepository - .GetGroupMessagesAsync(groupId, filter, sorting, type, skipCount, maxResultCount); + .GetGroupMessagesAsync(groupId, filter, sorting, reverse, type, skipCount, maxResultCount); var chatMessages = ObjectMapper.Map, List>(groupMessages); return chatMessages; } } - public async Task> GetChatMessageAsync(Guid? tenantId, Guid sendUserId, Guid receiveUserId, string filter = "", - string sorting = nameof(ChatMessage.MessageId), MessageType? type = null, int skipCount = 1, int maxResultCount = 10) + public async Task> GetChatMessageAsync( + Guid? tenantId, + Guid sendUserId, + Guid receiveUserId, + string filter = "", + string sorting = nameof(ChatMessage.MessageId), + bool reverse = true, + MessageType? type = null, + int skipCount = 0, + int maxResultCount = 10) { using (CurrentTenant.Change(tenantId)) { - var userMessages = await MessageRepository.GetUserMessagesAsync(sendUserId, receiveUserId, filter, sorting, type, skipCount, maxResultCount); + var userMessages = await MessageRepository + .GetUserMessagesAsync(sendUserId, receiveUserId, filter, sorting, reverse, type, skipCount, maxResultCount); var chatMessages = ObjectMapper.Map, List>(userMessages); return chatMessages; } } - + + public virtual async Task GetGroupMessageCountAsync( + Guid? tenantId, + long groupId, + string filter = "", + MessageType? type = null) + { + using (CurrentTenant.Change(tenantId)) + { + return await MessageRepository.GetCountAsync(groupId, filter, type); + } + } + + public virtual async Task GetChatMessageCountAsync( + Guid? tenantId, + Guid sendUserId, + Guid receiveUserId, + string filter = "", + MessageType? type = null) + { + using (CurrentTenant.Change(tenantId)) + { + return await MessageRepository.GetCountAsync(sendUserId, receiveUserId, filter, type); + } + } + protected virtual async Task StoreUserMessageAsync(ChatMessage chatMessage) { var userHasBlacked = await UserChatSettingRepository @@ -135,15 +176,5 @@ namespace LINGYUN.Abp.MessageService.Chat chatMessage.MessageId = messageId.ToString(); } - - public Task GetGroupMessageCountAsync(Guid? tenantId, long groupId, string filter = "", MessageType? type = null) - { - throw new NotImplementedException(); - } - - public Task GetChatMessageCountAsync(Guid? tenantId, Guid sendUserId, Guid receiveUserId, string filter = "", MessageType? type = null) - { - throw new NotImplementedException(); - } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserCardFinder.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserCardFinder.cs new file mode 100644 index 000000000..661e0b9bb --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserCardFinder.cs @@ -0,0 +1,47 @@ +using LINGYUN.Abp.IM; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public class UserCardFinder : DomainService, IUserCardFinder + { + protected IUserChatCardRepository UserChatCardRepository { get; } + + public UserCardFinder( + IUserChatCardRepository userChatCardRepository) + { + UserChatCardRepository = userChatCardRepository; + } + + public virtual async Task GetCountAsync(Guid? tenantId, string findUserName = "", int? startAge = null, int? endAge = null, Sex? sex = null) + { + using (CurrentTenant.Change(tenantId)) + { + return await UserChatCardRepository + .GetMemberCountAsync(findUserName, startAge, endAge, sex); + } + } + + public virtual async Task> GetListAsync(Guid? tenantId, string findUserName = "", int? startAge = null, int? endAge = null, Sex? sex = null, string sorting = nameof(UserCard.UserId), bool reverse = false, int skipCount = 0, int maxResultCount = 10) + { + using (CurrentTenant.Change(tenantId)) + { + return await UserChatCardRepository + .GetMembersAsync(findUserName, startAge, endAge, sex, + sorting, reverse, skipCount, maxResultCount); + } + } + + public virtual async Task GetMemberAsync(Guid? tenantId, Guid findUserId) + { + using (CurrentTenant.Change(tenantId)) + { + return await UserChatCardRepository + .GetMemberAsync(findUserId); + } + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatCard.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatCard.cs new file mode 100644 index 000000000..46c4eb463 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatCard.cs @@ -0,0 +1,105 @@ +using LINGYUN.Abp.IM; +using LINGYUN.Abp.MessageService.Utils; +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; +using Volo.Abp.Timing; + +namespace LINGYUN.Abp.MessageService.Chat +{ + /// + /// 用户卡片 + /// + public class UserChatCard : AuditedAggregateRoot, IMultiTenant + { + /// + /// 租户 + /// + public virtual Guid? TenantId { get; protected set; } + /// + /// 用户标识 + /// + public virtual Guid UserId { get; protected set; } + /// + /// 用户名 + /// + public virtual string UserName { get; protected set; } + /// + /// 性别 + /// + public virtual Sex Sex { get; set; } + /// + /// 签名 + /// + public virtual string Sign { get; set; } + /// + /// 昵称 + /// + public virtual string NickName { get; set; } + /// + /// 说明 + /// + public virtual string Description { get; set; } + /// + /// 头像地址 + /// + public virtual string AvatarUrl { get; protected set; } + /// + /// 生日 + /// + public virtual DateTime? Birthday { get; protected set; } + /// + /// 年龄 + /// + public virtual int Age { get; protected set; } + + protected UserChatCard() + { + } + + public UserChatCard( + Guid userId, + string userName, + Sex sex, + string nickName = null, + string avatarUrl = "", + Guid? tenantId = null) + { + Sex = sex; + UserId = userId; + UserName = userName; + NickName = nickName ?? userName; + AvatarUrl = avatarUrl; + TenantId = tenantId; + } + + public void SetBirthday(DateTime birthday, IClock clock) + { + Birthday = birthday; + + Age = DateTimeHelper.CalcAgrByBirthdate(birthday, clock.Now); + } + + public void SetAvatarUrl(string url) + { + AvatarUrl = url; + } + + public UserCard ToUserCard() + { + return new UserCard + { + Age = Age, + AvatarUrl = AvatarUrl, + Birthday = Birthday, + Description = Description, + NickName = NickName, + Sex = Sex, + Sign = Sign, + UserId = UserId, + UserName = UserName, + TenantId = TenantId + }; + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriend.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriend.cs new file mode 100644 index 000000000..1392955d3 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriend.cs @@ -0,0 +1,54 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public class UserChatFriend : CreationAuditedEntity, IMultiTenant + { + /// + /// 租户 + /// + public virtual Guid? TenantId { get; protected set; } + /// + /// 用户标识 + /// + public virtual Guid UserId { get; protected set; } + /// + /// 好友标识 + /// + public virtual Guid FrientId { get; protected set; } + /// + /// 已添加黑名单 + /// + public virtual bool Black { get; set; } + /// + /// 消息免打扰 + /// + public virtual bool DontDisturb { get; set; } + /// + /// 特别关注 + /// + public virtual bool SpecialFocus { get; set; } + /// + /// 备注名称 + /// + public virtual string RemarkName { get; set; } + + protected UserChatFriend() + { + } + + public UserChatFriend( + Guid userId, + Guid friendId, + string remarkName = "", + Guid? tenantId = null) + { + UserId = userId; + FrientId = friendId; + RemarkName = remarkName; + TenantId = tenantId; + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserGroupCard.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserGroupCard.cs new file mode 100644 index 000000000..a1732631f --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserGroupCard.cs @@ -0,0 +1,74 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; +using Volo.Abp.Timing; + +namespace LINGYUN.Abp.MessageService.Chat +{ + /// + /// 用户群组卡片 + /// + public class UserGroupCard : AuditedAggregateRoot, IMultiTenant + { + /// + /// 租户 + /// + public virtual Guid? TenantId { get; protected set; } + /// + /// 用户标识 + /// + public virtual Guid UserId { get; protected set; } + /// + /// 昵称 + /// + public virtual string NickName { get; set; } + /// + /// 是否管理员 + /// + public virtual bool IsAdmin { get; protected set; } + /// + /// 禁言期止 + /// + public virtual DateTime? SilenceEnd { get; protected set; } + protected UserGroupCard() + { + } + public UserGroupCard( + Guid userId, + string nickName = "", + bool isAdmin = false, + DateTime? silenceEnd = null, + Guid? tenantId = null) + { + UserId = userId; + NickName = nickName; + IsAdmin = isAdmin; + SilenceEnd = silenceEnd; + TenantId = tenantId; + } + /// + /// 设置管理员 + /// + /// + public void SetAdmin(bool admin) + { + IsAdmin = admin; + } + /// + /// 禁言 + /// + /// + /// + public void Silence(IClock clock, double seconds) + { + SilenceEnd = clock.Now.AddSeconds(seconds); + } + /// + /// 解除禁言 + /// + public void UnSilence() + { + SilenceEnd = null; + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserGroupStore.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserGroupStore.cs index 89a5881b1..1a7f935b9 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserGroupStore.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserGroupStore.cs @@ -31,7 +31,7 @@ namespace LINGYUN.Abp.MessageService.Chat { using (CurrentTenant.Change(tenantId)) { - var userHasInGroup = await UserChatGroupRepository.UserHasInGroupAsync(groupId, userId); + var userHasInGroup = await UserChatGroupRepository.MemberHasInGroupAsync(groupId, userId); if (!userHasInGroup) { var userGroup = new UserChatGroup(groupId, userId, acceptUserId, tenantId); @@ -48,19 +48,17 @@ namespace LINGYUN.Abp.MessageService.Chat { using (CurrentTenant.Change(tenantId)) { - var groupUserCard = await UserChatGroupRepository.GetGroupUserCardAsync(groupId, userId); + var groupUserCard = await UserChatGroupRepository.GetMemberAsync(groupId, userId); return groupUserCard; } } - public async Task> GetGroupUsersAsync(Guid? tenantId, long groupId) + public async Task> GetMembersAsync(Guid? tenantId, long groupId) { using (CurrentTenant.Change(tenantId)) { - var userGroups = await UserChatGroupRepository.GetGroupUsersAsync(groupId); - - return userGroups; + return await UserChatGroupRepository.GetMembersAsync(groupId); } } @@ -68,9 +66,7 @@ namespace LINGYUN.Abp.MessageService.Chat { using (CurrentTenant.Change(tenantId)) { - var groups = await UserChatGroupRepository.GetUserGroupsAsync(userId); - - return groups; + return await UserChatGroupRepository.GetMemberGroupsAsync(userId); } } @@ -81,31 +77,32 @@ namespace LINGYUN.Abp.MessageService.Chat { using (CurrentTenant.Change(tenantId)) { - var userGroup = await UserChatGroupRepository.GetUserGroupAsync(groupId, userId); - - if(userGroup != null) - { - await UserChatGroupRepository.DeleteAsync(userGroup); + await UserChatGroupRepository.RemoveMemberFormGroupAsync(groupId, userId); - await unitOfWork.SaveChangesAsync(); - } + await unitOfWork.SaveChangesAsync(); } } } - public async Task GetGroupUsersCountAsync(Guid? tenantId, long groupId, string filter = "") + public async Task GetMembersCountAsync(Guid? tenantId, long groupId) { using (CurrentTenant.Change(tenantId)) { - return await UserChatGroupRepository.GetGroupUsersCountAsync(groupId, filter); + return await UserChatGroupRepository.GetMembersCountAsync(groupId); } } - public async Task> GetGroupUsersAsync(Guid? tenantId, long groupId, string filter = "", string sorting = "UserId", int skipCount = 1, int maxResultCount = 10) + public async Task> GetMembersAsync( + Guid? tenantId, + long groupId, + string sorting = nameof(GroupUserCard.UserId), + bool reverse = false, + int skipCount = 0, + int maxResultCount = 10) { using (CurrentTenant.Change(tenantId)) { - return await UserChatGroupRepository.GetGroupUsersAsync(groupId, filter, sorting, skipCount, maxResultCount); + return await UserChatGroupRepository.GetMembersAsync(groupId, sorting, reverse, skipCount, maxResultCount); } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateJoinIMEventHandler.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateJoinIMEventHandler.cs index d82153783..7ca3728c6 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateJoinIMEventHandler.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateJoinIMEventHandler.cs @@ -3,47 +3,26 @@ using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities.Events; using Volo.Abp.EventBus; -using Volo.Abp.MultiTenancy; -using Volo.Abp.Uow; using Volo.Abp.Users; namespace LINGYUN.Abp.MessageService.EventBus.Distributed { public class UserCreateJoinIMEventHandler : ILocalEventHandler>, ITransientDependency { - private readonly ICurrentTenant _currentTenant; - private readonly IUnitOfWorkManager _unitOfWorkManager; - private readonly IUserChatSettingRepository _userChatSettingRepository; + private readonly IChatDataSeeder _chatDataSeeder; public UserCreateJoinIMEventHandler( - ICurrentTenant currentTenant, - IUnitOfWorkManager unitOfWorkManager, - IUserChatSettingRepository userChatSettingRepository) + IChatDataSeeder chatDataSeeder) { - _currentTenant = currentTenant; - _unitOfWorkManager = unitOfWorkManager; - _userChatSettingRepository = userChatSettingRepository; + _chatDataSeeder = chatDataSeeder; } /// - /// 接收添加用户事件,启用IM模块时增加用户配置 + /// 接收添加用户事件,初始化IM用户种子 /// /// /// public async Task HandleEventAsync(EntityCreatedEventData eventData) { - using (var unitOfWork = _unitOfWorkManager.Begin()) - { - using (_currentTenant.Change(eventData.Entity.TenantId)) - { - var userHasOpendIm = await _userChatSettingRepository.UserHasOpendImAsync(eventData.Entity.Id); - if (!userHasOpendIm) - { - var userChatSetting = new UserChatSetting(eventData.Entity.Id, eventData.Entity.TenantId); - await _userChatSettingRepository.InsertAsync(userChatSetting); - - await unitOfWork.SaveChangesAsync(); - } - } - } + await _chatDataSeeder.SeedAsync(eventData.Entity); } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Utils/DateTimeHelper.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Utils/DateTimeHelper.cs new file mode 100644 index 000000000..9aa6f8e34 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Utils/DateTimeHelper.cs @@ -0,0 +1,17 @@ +using System; + +namespace LINGYUN.Abp.MessageService.Utils +{ + public static class DateTimeHelper + { + public static int CalcAgrByBirthdate(DateTime birthdate, DateTime nowTime) + { + int age = nowTime.Year - birthdate.Year; + if (nowTime.Month < birthdate.Month || (nowTime.Month == birthdate.Month && nowTime.Day < birthdate.Day)) + { + age--; + } + return age < 0 ? 0 : age; + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreGroupRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreGroupRepository.cs index 5701da4d5..5d5bac6b8 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreGroupRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreGroupRepository.cs @@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; @@ -10,35 +11,46 @@ using Volo.Abp.EntityFrameworkCore; namespace LINGYUN.Abp.MessageService.Chat { - public class EfCoreGroupRepository : EfCoreRepository, + public class EfCoreGroupRepository : EfCoreRepository, IGroupRepository, ITransientDependency { public EfCoreGroupRepository( - IDbContextProvider dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } - public async Task GetByIdAsync(long id) + public virtual async Task GetByIdAsync( + long id, + CancellationToken cancellationToken = default) { - return await DbSet.Where(x => x.GroupId.Equals(id)).FirstOrDefaultAsync(); + return await DbSet + .Where(x => x.GroupId.Equals(id)) + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetGroupAdminAsync(long id) + public virtual async Task> GetGroupAdminAsync( + long id, + CancellationToken cancellationToken = default) { var groupAdmins = await (from gp in DbContext.Set() - join gpa in DbContext.Set() - on gp.GroupId equals gpa.GroupId - select gpa) - .Distinct() - .ToListAsync(); + join ucg in DbContext.Set() + on gp.GroupId equals ucg.GroupId + join ugc in DbContext.Set() + on ucg.UserId equals ugc.UserId + where ugc.IsAdmin + select ugc) + .ToListAsync(GetCancellationToken(cancellationToken)); return groupAdmins; } - public async Task UserHasBlackedAsync(long id, Guid formUserId) + public virtual async Task UserHasBlackedAsync( + long id, + Guid formUserId, + CancellationToken cancellationToken = default) { var userHasBlack = await DbContext.Set() - .AnyAsync(x => x.GroupId.Equals(id) && x.ShieldUserId.Equals(formUserId)); + .AnyAsync(x => x.GroupId.Equals(id) && x.ShieldUserId.Equals(formUserId), GetCancellationToken(cancellationToken)); return userHasBlack; } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs index d766e38db..4d0c7a9c5 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Linq.Dynamic.Core; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; @@ -12,88 +13,153 @@ using Volo.Abp.EntityFrameworkCore; namespace LINGYUN.Abp.MessageService.Chat { - public class EfCoreMessageRepository : EfCoreRepository, + public class EfCoreMessageRepository : EfCoreRepository, IMessageRepository, ITransientDependency { public EfCoreMessageRepository( - IDbContextProvider dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } - public async Task GetGroupMessageAsync(long id) + public virtual async Task GetGroupMessageAsync( + long id, + CancellationToken cancellationToken = default) { return await DbContext.Set() .Where(x => x.MessageId.Equals(id)) .AsNoTracking() - .FirstOrDefaultAsync(); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetGroupMessagesAsync(long groupId, string filter = "", - string sorting = nameof(UserMessage.MessageId), MessageType? type = null, int skipCount = 1, int maxResultCount = 10) + public virtual async Task> GetGroupMessagesAsync( + long groupId, + string filter = "", + string sorting = nameof(UserMessage.MessageId), + bool reverse = true, + MessageType? type = null, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default) { + sorting = reverse ? sorting + " desc" : sorting; var groupMessages = await DbContext.Set() .Distinct() .Where(x => x.GroupId.Equals(groupId)) .WhereIf(type != null, x => x.Type.Equals(type)) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Content.Contains(filter) || x.SendUserName.Contains(filter)) .OrderBy(sorting ?? nameof(GroupMessage.MessageId)) - .Page(skipCount, maxResultCount) + .PageBy(skipCount, maxResultCount) .AsNoTracking() - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); return groupMessages; } - public async Task GetGroupMessagesCountAsync(long groupId, string filter = "", MessageType? type = null) + public virtual async Task GetGroupMessagesCountAsync( + long groupId, + string filter = "", + MessageType? type = null, + CancellationToken cancellationToken = default) { var groupMessagesCount = await DbContext.Set() .Distinct() .Where(x => x.GroupId.Equals(groupId)) .WhereIf(type != null, x => x.Type.Equals(type)) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Content.Contains(filter) || x.SendUserName.Contains(filter)) - .LongCountAsync(); + .LongCountAsync(GetCancellationToken(cancellationToken)); return groupMessagesCount; } - public async Task> GetUserGroupMessagesAsync(Guid sendUserId, long groupId, string filter = "", - string sorting = nameof(UserMessage.MessageId), MessageType? type = null, int skipCount = 1, int maxResultCount = 10) + public virtual async Task> GetUserGroupMessagesAsync( + Guid sendUserId, + long groupId, + string filter = "", + string sorting = nameof(UserMessage.MessageId), + bool reverse = true, + MessageType? type = null, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default) { + sorting = reverse ? sorting + " desc" : sorting; var groupMessages = await DbContext.Set() .Distinct() .Where(x => x.GroupId.Equals(groupId) && x.CreatorId.Equals(sendUserId)) .WhereIf(type != null, x => x.Type.Equals(type)) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Content.Contains(filter) || x.SendUserName.Contains(filter)) .OrderBy(sorting ?? nameof(GroupMessage.MessageId)) - .Page(skipCount, maxResultCount) + .PageBy(skipCount, maxResultCount) .AsNoTracking() - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); return groupMessages; } - public async Task GetUserGroupMessagesCountAsync(Guid sendUserId, long groupId, string filter = "", MessageType? type = null) + public virtual async Task GetUserGroupMessagesCountAsync( + Guid sendUserId, + long groupId, + string filter = "", + MessageType? type = null, + CancellationToken cancellationToken = default) { var groupMessagesCount = await DbContext.Set() - .Distinct() .Where(x => x.GroupId.Equals(groupId) && x.CreatorId.Equals(sendUserId)) .WhereIf(type != null, x => x.Type.Equals(type)) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Content.Contains(filter) || x.SendUserName.Contains(filter)) - .LongCountAsync(); + .LongCountAsync(GetCancellationToken(cancellationToken)); return groupMessagesCount; } - public async Task GetUserMessageAsync(long id) + public virtual async Task GetCountAsync( + long groupId, + string filter = "", + MessageType? type = null, + CancellationToken cancellationToken = default) + { + return await DbContext.Set() + .Where(x => x.GroupId.Equals(groupId)) + .WhereIf(type != null, x => x.Type.Equals(type)) + .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Content.Contains(filter) || x.SendUserName.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task GetCountAsync( + Guid sendUserId, + Guid receiveUserId, + string filter = "", + MessageType? type = null, + CancellationToken cancellationToken = default) + { + return await DbContext.Set() + .Where(x => x.ReceiveUserId.Equals(receiveUserId) && x.CreatorId.Equals(sendUserId)) + .WhereIf(type != null, x => x.Type.Equals(type)) + .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Content.Contains(filter) || x.SendUserName.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task GetUserMessageAsync( + long id, + CancellationToken cancellationToken = default) { return await DbContext.Set() .Where(x => x.MessageId.Equals(id)) .AsNoTracking() - .FirstOrDefaultAsync(); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetUserMessagesAsync(Guid sendUserId, Guid receiveUserId, string filter = "", - string sorting = nameof(UserMessage.MessageId), MessageType? type = null, int skipCount = 1, int maxResultCount = 10) + public virtual async Task> GetUserMessagesAsync( + Guid sendUserId, + Guid receiveUserId, + string filter = "", + string sorting = nameof(UserMessage.MessageId), + bool reverse = true, + MessageType? type = null, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default) { + sorting = reverse ? sorting + " desc" : sorting; var userMessages = await DbContext.Set() .Distinct() .Where(x => x.CreatorId.Equals(sendUserId) && x.ReceiveUserId.Equals(receiveUserId)) @@ -102,45 +168,42 @@ namespace LINGYUN.Abp.MessageService.Chat .OrderBy(sorting ?? nameof(GroupMessage.MessageId)) .Page(skipCount, maxResultCount) .AsNoTracking() - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); return userMessages; } - public async Task GetUserMessagesCountAsync(Guid sendUserId, Guid receiveUserId, string filter = "", MessageType? type = null) + public virtual async Task GetUserMessagesCountAsync( + Guid sendUserId, + Guid receiveUserId, + string filter = "", + MessageType? type = null, + CancellationToken cancellationToken = default) { var userMessagesCount = await DbContext.Set() .Distinct() .Where(x => x.CreatorId.Equals(sendUserId) && x.ReceiveUserId.Equals(receiveUserId)) .WhereIf(type != null, x => x.Type.Equals(type)) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Content.Contains(filter) || x.SendUserName.Contains(filter)) - .LongCountAsync(); + .LongCountAsync(GetCancellationToken(cancellationToken)); return userMessagesCount; } - public async Task InsertGroupMessageAsync(GroupMessage groupMessage, bool saveChangs = false) + public virtual async Task InsertGroupMessageAsync( + GroupMessage groupMessage, + CancellationToken cancellationToken = default) { - groupMessage = (await DbContext.Set().AddAsync(groupMessage, GetCancellationToken())).Entity; - - if(saveChangs) - { - await DbContext.SaveChangesAsync(); - } - - return groupMessage; + await DbContext.Set() + .AddAsync(groupMessage, GetCancellationToken(cancellationToken)); } - public async Task InsertUserMessageAsync(UserMessage userMessage, bool saveChangs = false) + public virtual async Task InsertUserMessageAsync( + UserMessage userMessage, + CancellationToken cancellationToken = default) { - userMessage = (await DbContext.Set().AddAsync(userMessage, GetCancellationToken())).Entity; - - if (saveChangs) - { - await DbContext.SaveChangesAsync(); - } - - return userMessage; + await DbContext.Set() + .AddAsync(userMessage, GetCancellationToken(cancellationToken)); } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatCardRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatCardRepository.cs new file mode 100644 index 000000000..ff63e0edd --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatCardRepository.cs @@ -0,0 +1,63 @@ +using LINGYUN.Abp.IM; +using LINGYUN.Abp.MessageService.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Dynamic.Core; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public class EfCoreUserChatCardRepository : EfCoreRepository, IUserChatCardRepository + { + public EfCoreUserChatCardRepository( + IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } + + public virtual async Task CheckUserIdExistsAsync(Guid userId, CancellationToken cancellationToken = default) + { + return await DbSet + .AnyAsync(ucc => ucc.UserId == userId, + GetCancellationToken(cancellationToken)); + } + + public virtual async Task GetMemberAsync(Guid findUserId, CancellationToken cancellationToken = default) + { + return await DbSet + .Where(ucc => ucc.UserId == findUserId) + .Select(ucc => ucc.ToUserCard()) + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task GetMemberCountAsync(string findUserName = "", int? startAge = null, int? endAge = null, Sex? sex = null, CancellationToken cancellationToken = default) + { + return await DbSet + .WhereIf(!findUserName.IsNullOrWhiteSpace(), ucc => ucc.UserName.Contains(findUserName)) + .WhereIf(startAge.HasValue, ucc => ucc.Age >= startAge.Value) + .WhereIf(endAge.HasValue, ucc => ucc.Age <= endAge.Value) + .WhereIf(sex.HasValue, ucc => ucc.Sex == sex) + .CountAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetMembersAsync(string findUserName = "", int? startAge = null, int? endAge = null, Sex? sex = null, string sorting = nameof(UserChatCard.UserId), bool reverse = false, int skipCount = 0, int maxResultCount = 10, CancellationToken cancellationToken = default) + { + sorting ??= nameof(UserChatCard.UserId); + sorting = reverse ? sorting + " desc" : sorting; + return await DbSet + .WhereIf(!findUserName.IsNullOrWhiteSpace(), ucc => ucc.UserName.Contains(findUserName)) + .WhereIf(startAge.HasValue, ucc => ucc.Age >= startAge.Value) + .WhereIf(endAge.HasValue, ucc => ucc.Age <= endAge.Value) + .WhereIf(sex.HasValue, ucc => ucc.Sex == sex) + .OrderBy(sorting) + .PageBy(skipCount, maxResultCount) + .Select(ucc => ucc.ToUserCard()) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs new file mode 100644 index 000000000..a656d9977 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs @@ -0,0 +1,164 @@ +using LINGYUN.Abp.IM.Contract; +using LINGYUN.Abp.MessageService.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Dynamic.Core; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public class EfCoreUserChatFriendRepository : EfCoreRepository, IUserChatFriendRepository + { + public EfCoreUserChatFriendRepository( + IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } + + public virtual async Task FindByUserFriendIdAsync(Guid userId, Guid friendId, CancellationToken cancellationToken = default) + { + return await DbSet + .Where(ucf => ucf.UserId == userId && ucf.FrientId == friendId) + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task GetMemberAsync(Guid userId, Guid friendId, CancellationToken cancellationToken = default) + { + var userFriendQuery = from ucf in DbContext.Set() + join ucc in DbContext.Set() + on ucf.FrientId equals ucc.UserId + where ucf.UserId == userId && ucf.FrientId == friendId + select new UserFriend + { + Age = ucc.Age, + AvatarUrl = ucc.AvatarUrl, + Birthday = ucc.Birthday, + Black = ucf.Black, + Description = ucc.Description, + DontDisturb = ucf.DontDisturb, + FriendId = ucf.FrientId, + NickName = ucc.NickName, + RemarkName = ucf.RemarkName, + Sex = ucc.Sex, + Sign = ucc.Sign, + SpecialFocus = ucf.SpecialFocus, + TenantId = ucf.TenantId, + UserId = ucf.UserId, + UserName = ucc.UserName + }; + + return await userFriendQuery + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetMembersAsync(Guid userId, string filter = "", string sorting = nameof(UserChatFriend.UserId), bool reverse = false, int skipCount = 0, int maxResultCount = 10, CancellationToken cancellationToken = default) + { + // 过滤用户资料 + var userChatCardQuery = DbContext.Set() + .WhereIf(!filter.IsNullOrWhiteSpace(), ucc => ucc.UserName.Contains(filter) || ucc.NickName.Contains(filter)); + + // 过滤好友资料 + var userChatFriendQuery = DbContext.Set() + .WhereIf(!filter.IsNullOrWhiteSpace(), ucf => ucf.RemarkName.Contains(filter)); + + // 组合查询 + var userFriendQuery = from ucf in userChatFriendQuery + join ucc in userChatCardQuery // TODO: Need LEFT JOIN? + on ucf.FrientId equals ucc.UserId + where ucf.UserId == userId + select new UserFriend + { + Age = ucc.Age, + AvatarUrl = ucc.AvatarUrl, + Birthday = ucc.Birthday, + Black = ucf.Black, + Description = ucc.Description, + DontDisturb = ucf.DontDisturb, + FriendId = ucf.FrientId, + NickName = ucc.NickName, + RemarkName = ucf.RemarkName, + Sex = ucc.Sex, + Sign = ucc.Sign, + SpecialFocus = ucf.SpecialFocus, + TenantId = ucf.TenantId, + UserId = ucf.UserId, + UserName = ucc.UserName + }; + + return await userFriendQuery + .OrderBy(sorting) + .PageBy(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetLastContactMembersAsync( + Guid userId, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default) + { + var userReceiveMsgQuery = DbContext.Set() + .Where(um => um.ReceiveUserId == userId); + + var userFriendQuery = from ucf in DbContext.Set() + join ucc in DbContext.Set() + on ucf.FrientId equals ucc.UserId + join um in userReceiveMsgQuery + on ucc.UserId equals um.CreatorId + where ucf.UserId == userId + orderby um.CreationTime descending // 消息创建时间倒序 + select new UserFriend + { + Age = ucc.Age, + AvatarUrl = ucc.AvatarUrl, + Birthday = ucc.Birthday, + Black = ucf.Black, + Description = ucc.Description, + DontDisturb = ucf.DontDisturb, + FriendId = ucf.FrientId, + NickName = ucc.NickName, + RemarkName = ucf.RemarkName, + Sex = ucc.Sex, + Sign = ucc.Sign, + SpecialFocus = ucf.SpecialFocus, + TenantId = ucf.TenantId, + UserId = ucf.UserId, + UserName = ucc.UserName + }; + + return await userFriendQuery + .PageBy(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task GetMembersCountAsync(Guid userId, string filter = "", CancellationToken cancellationToken = default) + { + var userChatCardQuery = DbContext.Set() + .WhereIf(!filter.IsNullOrWhiteSpace(), ucc => ucc.UserName.Contains(filter) || ucc.NickName.Contains(filter)); + + var userChatFriendQuery = DbContext.Set() + .WhereIf(!filter.IsNullOrWhiteSpace(), ucf => ucf.RemarkName.Contains(filter)); + + var userFriendQuery = from ucf in userChatFriendQuery + join ucc in userChatCardQuery + on ucf.FrientId equals ucc.UserId + where ucf.UserId == userId + select ucc; + + return await userFriendQuery + .CountAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task IsAddedAsync(Guid userId, Guid frientId, CancellationToken cancellationToken = default) + { + return await DbSet + .AnyAsync(ucf => ucf.UserId == userId && ucf.FrientId == frientId, + GetCancellationToken(cancellationToken)); + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatGroupRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatGroupRepository.cs index 388afa740..a234e3058 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatGroupRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatGroupRepository.cs @@ -1,11 +1,12 @@ using LINGYUN.Abp.IM.Group; using LINGYUN.Abp.MessageService.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Internal; using System; using System.Collections.Generic; using System.Linq; +using System.Linq.Dynamic.Core; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; @@ -13,122 +14,292 @@ using Volo.Abp.EntityFrameworkCore; namespace LINGYUN.Abp.MessageService.Chat { - public class EfCoreUserChatGroupRepository : EfCoreRepository, + public class EfCoreUserChatGroupRepository : EfCoreRepository, IUserChatGroupRepository, ITransientDependency { public EfCoreUserChatGroupRepository( - IDbContextProvider dbContextProvider) : base(dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } - public async Task> GetGroupUsersAsync(long groupId) + public virtual async Task GetMemberAsync( + long groupId, + Guid userId, + CancellationToken cancellationToken = default) { - // TODO: 急需单元测试,对这段代码不是太自信... - var groupUsers = await (from ug in DbSet - join x in ( - from gaj in DbContext.Set() - where gaj.GroupId.Equals(groupId) - select gaj - ) on ug.UserId equals x.UserId - into y from ga in y.DefaultIfEmpty() - where ug.GroupId.Equals(groupId) - select new UserGroup - { - GroupId = ug.GroupId, - IsSuperAdmin = ga != null && ga.IsSuperAdmin, - IsAdmin = ga != null, - TenantId = ug.TenantId, - UserId = ug.UserId - }) - .Distinct() - .AsNoTracking() - .ToListAsync(); - return groupUsers; - } + var cardQuery = from gp in DbContext.Set() + join ucg in DbContext.Set() + on gp.GroupId equals ucg.GroupId + join ugc in DbContext.Set() + on ucg.UserId equals ugc.UserId + join uc in DbContext.Set() + on ugc.UserId equals uc.UserId + where gp.GroupId == groupId && ugc.UserId == userId + select new GroupUserCard + { + TenantId = uc.TenantId, + UserId = uc.UserId, + UserName = uc.UserName, + Age = uc.Age, + AvatarUrl = uc.AvatarUrl, + IsAdmin = ugc.IsAdmin, + IsSuperAdmin = gp.AdminUserId == uc.UserId, + GroupId = gp.GroupId, + Birthday = uc.Birthday, + Description = uc.Description, + NickName = ugc.NickName ?? uc.NickName, + Sex = uc.Sex, + Sign = uc.Sign + }; - public async Task GetGroupUserCardAsync(long groupId, Guid userId) - { - var groupUserCard = await (from cg in DbContext.Set() - join ucg in DbContext.Set().DefaultIfEmpty() - on cg.GroupId equals ucg.GroupId - join cga in DbContext.Set().DefaultIfEmpty() - on cg.GroupId equals cga.GroupId - where ucg.GroupId.Equals(groupId) && cga.UserId.Equals(userId) - select new GroupUserCard - { - IsSuperAdmin = cga != null && cga.IsSuperAdmin, - IsAdmin = cga != null,//能查到数据就是管理员 - GroupId = ucg.GroupId, - UserId = ucg.UserId, - TenantId = ucg.TenantId, - Permissions = new Dictionary - { - { nameof(ChatGroupAdmin.AllowAddPeople), cga != null &&cga.AllowAddPeople }, - { nameof(ChatGroupAdmin.AllowDissolveGroup), cga != null &&cga.AllowDissolveGroup }, - { nameof(ChatGroupAdmin.AllowKickPeople), cga != null &&cga.AllowKickPeople }, - { nameof(ChatGroupAdmin.AllowSendNotice), cga != null &&cga.AllowSendNotice }, - { nameof(ChatGroupAdmin.AllowSilence), cga != null &&cga.AllowSilence }, - { nameof(ChatGroupAdmin.IsSuperAdmin), cga != null &&cga.IsSuperAdmin } - } - }) - .AsNoTracking() - .FirstOrDefaultAsync(); - - return groupUserCard; + return await cardQuery + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } - public Task> GetGroupUsersAsync(long groupId, string filter = "", string sorting = "UserId", int skipCount = 1, int maxResultCount = 10) + public virtual async Task> GetMembersAsync( + long groupId, + string sorting = nameof(UserChatCard.UserId), + bool reverse = false, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default) { - // TODO: 复杂的实现,暂时无关紧要,后期再说 :) - throw new NotImplementedException(); + sorting ??= nameof(UserChatCard.UserId); + sorting = reverse ? sorting + " desc" : sorting; + var cardQuery = from gp in DbContext.Set() + join ucg in DbContext.Set() + on gp.GroupId equals ucg.GroupId + join ugc in DbContext.Set() + on ucg.UserId equals ugc.UserId + join uc in DbContext.Set() + on ugc.UserId equals uc.UserId + where gp.GroupId == groupId + select new GroupUserCard + { + TenantId = uc.TenantId, + UserId = uc.UserId, + UserName = uc.UserName, + Age = uc.Age, + AvatarUrl = uc.AvatarUrl, + IsAdmin = ugc.IsAdmin, + IsSuperAdmin = gp.AdminUserId == uc.UserId, + GroupId = gp.GroupId, + Birthday = uc.Birthday, + Description = uc.Description, + NickName = ugc.NickName ?? uc.NickName, + Sex = uc.Sex, + Sign = uc.Sign + }; + + return await cardQuery + .OrderBy(sorting ?? nameof(UserChatCard.UserId)) + .PageBy(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); } - public Task GetGroupUsersCountAsync(long groupId, string filter = "") + public virtual async Task GetMembersCountAsync( + long groupId, + CancellationToken cancellationToken = default) { - // TODO: 复杂的实现,暂时无关紧要,后期再说 :) - throw new NotImplementedException(); + var cardQuery = from gp in DbContext.Set() + join ucg in DbContext.Set() + on gp.GroupId equals ucg.GroupId + join ugc in DbContext.Set() + on ucg.UserId equals ugc.UserId + join uc in DbContext.Set() + on ugc.UserId equals uc.UserId + where gp.GroupId == groupId + select ucg; + + return await cardQuery + .CountAsync(GetCancellationToken(cancellationToken)); } - public async Task GetUserGroupAsync(long groupId, Guid userId) + public virtual async Task MemberHasInGroupAsync( + long groupId, + Guid userId, + CancellationToken cancellationToken = default) { - return await DbSet.Where(x => x.GroupId.Equals(groupId) && x.UserId.Equals(userId)) - .AsNoTracking() - .FirstOrDefaultAsync(); + return await DbContext.Set() + .AnyAsync(ucg => ucg.GroupId == groupId && ucg.UserId == userId, + GetCancellationToken(cancellationToken)); } - public async Task> GetUserGroupsAsync(Guid userId) + public virtual async Task> GetMemberGroupsAsync( + Guid userId, + CancellationToken cancellationToken = default) { - // TODO: 急需单元测试,对这段代码不是太自信... - var userGroups = await (from ucg in DbSet - join cg in DbContext.Set() - on ucg.GroupId equals cg.GroupId - group cg by new - { - cg.GroupId, - cg.Name, - cg.AllowAnonymous, - cg.AllowSendMessage, - cg.MaxUserCount - } - into ug - orderby ug.Key.GroupId descending - select new Group - { - AllowAnonymous = ug.Key.AllowAnonymous, - AllowSendMessage = ug.Key.AllowSendMessage, - GroupUserCount = ug.Count(), - MaxUserLength = ug.Key.MaxUserCount, - Name = ug.Key.Name - }) - .Distinct() - .ToListAsync(); - - return userGroups; + var groupQuery = from gp in DbContext.Set() + join ucg in DbContext.Set() + on gp.GroupId equals ucg.GroupId + where ucg.UserId.Equals(userId) + group ucg by new + { + gp.AllowAnonymous, + gp.AllowSendMessage, + gp.MaxUserCount, + gp.Name + } + into cg + select new Group + { + AllowAnonymous = cg.Key.AllowAnonymous, + AllowSendMessage = cg.Key.AllowSendMessage, + MaxUserLength = cg.Key.MaxUserCount, + Name = cg.Key.Name, + GroupUserCount = cg.Count() + }; + + return await groupQuery + .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task UserHasInGroupAsync(long groupId, Guid userId) + public virtual async Task RemoveMemberFormGroupAsync( + long groupId, + Guid userId, + CancellationToken cancellationToken = default) { - return await DbSet.AnyAsync(x => x.GroupId.Equals(groupId) && x.UserId.Equals(userId)); + await DeleteAsync(ucg => ucg.GroupId == groupId && ucg.UserId == userId); } + + //public virtual async Task> GetGroupUsersAsync( + // long groupId, + // CancellationToken cancellationToken = default) + //{ + // // TODO: 急需单元测试,对这段代码不是太自信... + // var groupUsers = await (from cg in DbContext.Set() + // join ucg in DbContext.Set() + // on cg.GroupId equals ucg.GroupId + // join ugc in DbContext.Set() + // on ucg.UserId equals ugc.UserId + // where cg.GroupId.Equals(groupId) + // select new GroupUserCard + // { + // GroupId = ucg.GroupId, + // IsSuperAdmin = ugc.UserId == cg.AdminUserId, + // IsAdmin = ugc.IsAdmin, + // TenantId = ucg.TenantId, + // UserId = ucg.UserId + // }) + // .Distinct() + // .AsNoTracking() + // .ToListAsync(GetCancellationToken(cancellationToken)); + // return groupUsers; + //} + + //public virtual async Task GetMemberAsync( + // long groupId, + // Guid userId, + // CancellationToken cancellationToken = default) + //{ + // var groupUserCard = await (from cg in DbContext.Set() + // join ucg in DbContext.Set().DefaultIfEmpty() + // on cg.GroupId equals ucg.GroupId + // join ucc in DbContext.Set().DefaultIfEmpty() + // on ucg.UserId equals ucc.UserId + // join cga in DbContext.Set().DefaultIfEmpty() + // on cg.GroupId equals cga.GroupId + // where ucg.GroupId.Equals(groupId) && cga.UserId.Equals(userId) + // select new GroupUserCard + // { + // IsSuperAdmin = cga != null && cga.IsSuperAdmin, + // IsAdmin = cga != null,//能查到数据就是管理员 + // GroupId = ucg.GroupId, + // UserId = ucg.UserId, + // TenantId = ucg.TenantId, + // Permissions = new Dictionary + // { + // { nameof(ChatGroupAdmin.AllowAddPeople), cga != null && cga.AllowAddPeople }, + // { nameof(ChatGroupAdmin.AllowDissolveGroup), cga != null && cga.AllowDissolveGroup }, + // { nameof(ChatGroupAdmin.AllowKickPeople), cga != null && cga.AllowKickPeople }, + // { nameof(ChatGroupAdmin.AllowSendNotice), cga != null && cga.AllowSendNotice }, + // { nameof(ChatGroupAdmin.AllowSilence), cga != null && cga.AllowSilence }, + // { nameof(ChatGroupAdmin.IsSuperAdmin), cga != null && cga.IsSuperAdmin } + // } + // }) + // .AsNoTracking() + // .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + + // return groupUserCard; + //} + + //public virtual Task> GetUsersAsync( + // long groupId, + // string filter = "", + // string sorting = nameof(UserGroup.UserId), + // bool reverse = false, + // int skipCount = 0, + // int maxResultCount = 10, + // CancellationToken cancellationToken = default) + //{ + // sorting = reverse ? sorting + " desc" : sorting; + // // TODO: 复杂的实现,暂时无关紧要,后期再说 :) + // throw new NotImplementedException(); + //} + + //public virtual Task GetMembersCountAsync( + // long groupId, + // string filter = "", + // CancellationToken cancellationToken = default) + //{ + // var ss = (from ucg in DbContext.Set() + // join cg in DbContext.Set() on ucg.GroupId equals cg.GroupId + // select cg) + // .WhereIf(!filter.IsNullOrWhiteSpace(),) + + // // TODO: 复杂的实现,暂时无关紧要,后期再说 :) + // //throw new NotImplementedException(); + //} + + //public virtual async Task GetUserGroupAsync( + // long groupId, + // Guid userId, + // CancellationToken cancellationToken = default) + //{ + // return await DbSet.Where(x => x.GroupId.Equals(groupId) && x.UserId.Equals(userId)) + // .AsNoTracking() + // .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + //} + + //public virtual async Task> GetUserGroupsAsync( + // Guid userId, + // CancellationToken cancellationToken = default) + //{ + // // TODO: 急需单元测试,对这段代码不是太自信... + // var userGroups = await (from ucg in DbSet + // join cg in DbContext.Set() + // on ucg.GroupId equals cg.GroupId + // group cg by new + // { + // cg.GroupId, + // cg.Name, + // cg.AllowAnonymous, + // cg.AllowSendMessage, + // cg.MaxUserCount + // } + // into ug + // orderby ug.Key.GroupId descending + // select new Group + // { + // AllowAnonymous = ug.Key.AllowAnonymous, + // AllowSendMessage = ug.Key.AllowSendMessage, + // GroupUserCount = ug.Count(), + // MaxUserLength = ug.Key.MaxUserCount, + // Name = ug.Key.Name + // }) + // .Distinct() + // .ToListAsync(GetCancellationToken(cancellationToken)); + + // return userGroups; + //} + + //public virtual async Task MemberHasInGroupAsync( + // long groupId, + // Guid userId, + // CancellationToken cancellationToken = default) + //{ + // return await DbSet + // .AnyAsync(x => x.GroupId.Equals(groupId) && x.UserId.Equals(userId), GetCancellationToken(cancellationToken)); + //} } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatSettingRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatSettingRepository.cs index 66e8926e3..d2784e0af 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatSettingRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatSettingRepository.cs @@ -9,11 +9,11 @@ using Volo.Abp.EntityFrameworkCore; namespace LINGYUN.Abp.MessageService.Chat { - public class EfCoreUserChatSettingRepository : EfCoreRepository, + public class EfCoreUserChatSettingRepository : EfCoreRepository, IUserChatSettingRepository, ITransientDependency { public EfCoreUserChatSettingRepository( - IDbContextProvider dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/AbpMessageServiceEntityFrameworkCoreModule.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/AbpMessageServiceEntityFrameworkCoreModule.cs index f990d1ec0..2939391a7 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/AbpMessageServiceEntityFrameworkCoreModule.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/AbpMessageServiceEntityFrameworkCoreModule.cs @@ -22,8 +22,11 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore options.AddRepository(); options.AddRepository(); + options.AddRepository(); options.AddRepository(); + options.AddRepository(); + options.AddDefaultRepositories(includeAllEntities: true); }); } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/IMessageServiceDbContext.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/IMessageServiceDbContext.cs new file mode 100644 index 000000000..bbfc5d399 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/IMessageServiceDbContext.cs @@ -0,0 +1,14 @@ +using LINGYUN.Abp.MessageService.Chat; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Data; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Abp.MessageService.EntityFrameworkCore +{ + [ConnectionStringName(AbpMessageServiceDbProperties.ConnectionStringName)] + public interface IMessageServiceDbContext : IEfCoreDbContext + { + DbSet UserChatCards { get; set; } + DbSet UserGroupCards { get; set; } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContext.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContext.cs index 4f7fbb22d..893d3ba01 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContext.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContext.cs @@ -1,17 +1,20 @@ -using Microsoft.EntityFrameworkCore; +using LINGYUN.Abp.MessageService.Chat; +using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; namespace LINGYUN.Abp.MessageService.EntityFrameworkCore { - [ConnectionStringName("MessageService")] - public class MessageServiceDbContext : AbpDbContext + [ConnectionStringName(AbpMessageServiceDbProperties.ConnectionStringName)] + public class MessageServiceDbContext : AbpDbContext, IMessageServiceDbContext { + public DbSet UserChatCards { get; set; } + public DbSet UserGroupCards { get; set; } + public MessageServiceDbContext(DbContextOptions options) : base(options) { } - protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.ConfigureMessageService(options => diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContextModelCreatingExtensions.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContextModelCreatingExtensions.cs index e4f08a537..c3307fff8 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContextModelCreatingExtensions.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContextModelCreatingExtensions.cs @@ -89,6 +89,45 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore b.HasIndex(p => new { p.TenantId, p.GroupId }); }); + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "UserChatFriends", options.Schema); + + b.Property(p => p.RemarkName).HasMaxLength(UserChatCardConsts.MaxUserNameLength); + + b.ConfigureByConvention(); + + b.HasIndex(p => new { p.TenantId, p.UserId, p.FrientId }); + }); + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "UserChatCards", options.Schema); + + b.Property(p => p.UserName).HasMaxLength(UserChatCardConsts.MaxUserNameLength).IsRequired(); + + b.Property(p => p.AvatarUrl).HasMaxLength(UserChatCardConsts.MaxAvatarUrlLength); + b.Property(p => p.Description).HasMaxLength(UserChatCardConsts.MaxDescriptionLength); + b.Property(p => p.NickName).HasMaxLength(UserChatCardConsts.MaxNickNameLength); + b.Property(p => p.Sign).HasMaxLength(UserChatCardConsts.MaxSignLength); + + b.ConfigureByConvention(); + + b.HasIndex(p => new { p.TenantId, p.UserId }); + }); + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "UserGroupCards", options.Schema); + + b.Property(p => p.NickName).HasMaxLength(UserChatCardConsts.MaxNickNameLength); + + b.ConfigureByConvention(); + + b.HasIndex(p => new { p.TenantId, p.UserId }); + }); + + builder.Entity(b => { b.ToTable(options.TablePrefix + "UserChatSettings", options.Schema); @@ -125,15 +164,6 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore b.HasIndex(p => new { p.TenantId, p.GroupId }); }); - builder.Entity(b => - { - b.ToTable(options.TablePrefix + "ChatGroupAdmins", options.Schema); - - b.ConfigureMultiTenant(); - - b.HasIndex(p => new { p.TenantId, p.GroupId }); - }); - builder.Entity(b => { b.ToTable(options.TablePrefix + "ChatGroups", options.Schema); diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreNotificationRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreNotificationRepository.cs index c4f698b56..97b094126 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreNotificationRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreNotificationRepository.cs @@ -9,11 +9,11 @@ using Volo.Abp.EntityFrameworkCore; namespace LINGYUN.Abp.MessageService.Notifications { - public class EfCoreNotificationRepository : EfCoreRepository, + public class EfCoreNotificationRepository : EfCoreRepository, INotificationRepository, ITransientDependency { public EfCoreNotificationRepository( - IDbContextProvider dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreUserNotificationRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreUserNotificationRepository.cs index 3fae6b5c1..1ae397e76 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreUserNotificationRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreUserNotificationRepository.cs @@ -12,11 +12,11 @@ using Volo.Abp.EntityFrameworkCore; namespace LINGYUN.Abp.MessageService.Notifications { - public class EfCoreUserNotificationRepository : EfCoreRepository, + public class EfCoreUserNotificationRepository : EfCoreRepository, IUserNotificationRepository, ITransientDependency { public EfCoreUserNotificationRepository( - IDbContextProvider dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Subscriptions/EfCoreUserSubscribeRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Subscriptions/EfCoreUserSubscribeRepository.cs index ad73dfacd..622a053ec 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Subscriptions/EfCoreUserSubscribeRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Subscriptions/EfCoreUserSubscribeRepository.cs @@ -11,11 +11,11 @@ using Volo.Abp.EntityFrameworkCore; namespace LINGYUN.Abp.MessageService.Subscriptions { - public class EfCoreUserSubscribeRepository : EfCoreRepository, + public class EfCoreUserSubscribeRepository : EfCoreRepository, IUserSubscribeRepository, ITransientDependency { public EfCoreUserSubscribeRepository( - IDbContextProvider dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/ChatController.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/ChatController.cs index 806a68968..374b8631a 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/ChatController.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/ChatController.cs @@ -9,7 +9,7 @@ using Volo.Abp.AspNetCore.Mvc; namespace LINGYUN.Abp.MessageService.Chat { [RemoteService(Name = AbpMessageServiceConsts.RemoteServiceName)] - [Route("api/chat")] + [Route("api/im/chat")] public class ChatController : AbpController, IChatAppService { private readonly IChatAppService _chatAppService; @@ -35,7 +35,7 @@ namespace LINGYUN.Abp.MessageService.Chat [HttpGet] [Route("groups/users")] - public virtual async Task> GetGroupUsersAsync(GroupUserGetByPagedDto groupUserGetByPaged) + public virtual async Task> GetGroupUsersAsync(GroupUserGetByPagedDto groupUserGetByPaged) { return await _chatAppService.GetGroupUsersAsync(groupUserGetByPaged); } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/MyFriendController.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/MyFriendController.cs new file mode 100644 index 000000000..fafcf3531 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/MyFriendController.cs @@ -0,0 +1,46 @@ +using LINGYUN.Abp.IM.Contract; +using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; + +namespace LINGYUN.Abp.MessageService.Chat +{ + [RemoteService(Name = AbpMessageServiceConsts.RemoteServiceName)] + [Route("api/im/my-friends")] + public class MyFriendController : AbpController, IMyFriendAppService + { + protected IMyFriendAppService MyFriendAppService { get; } + + public MyFriendController(IMyFriendAppService myFriendAppService) + { + MyFriendAppService = myFriendAppService; + } + + [HttpPost] + public virtual async Task CreateAsync(MyFriendCreateDto input) + { + await MyFriendAppService.CreateAsync(input); + } + + [HttpDelete] + public virtual async Task DeleteAsync(MyFriendOperationDto input) + { + await MyFriendAppService.DeleteAsync(input); + } + + [HttpGet] + [Route("last-contacts")] + public virtual async Task> GetLastContactFriendsAsync(PagedResultRequestDto input) + { + return await MyFriendAppService.GetLastContactFriendsAsync(input); + } + + [HttpGet] + public virtual async Task> GetMyFriendsAsync(MyFriendGetByPagedDto input) + { + return await MyFriendAppService.GetMyFriendsAsync(input); + } + } +} diff --git a/aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/BackendAdminHostModule.cs b/aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/BackendAdminHostModule.cs index dbbb331e1..2f1bed9d9 100644 --- a/aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/BackendAdminHostModule.cs +++ b/aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/BackendAdminHostModule.cs @@ -36,6 +36,7 @@ using Volo.Abp.Autofac; using Volo.Abp.Caching; using Volo.Abp.Caching.StackExchangeRedis; using Volo.Abp.Data; +using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.MySQL; using Volo.Abp.FeatureManagement; @@ -181,6 +182,11 @@ namespace LINGYUN.Abp.BackendAdmin options.GlobalCacheEntryOptions.AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(60); }); + Configure(options => + { + options.AutoEventSelectors.AddNamespace("Volo.Abp.TenantManagement"); + }); + Configure(options => { var redisConfig = ConfigurationOptions.Parse(options.Configuration); diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db index f3d2187879f74d6824c8f7ab72a4b2da1be4c261..99db5d63700c7ab5796e94dcb0dea9b19eee9ab3 100644 GIT binary patch delta 1118 zcmcJOPe>GT6vyArPOIy>4m-M=Sc|Kt4mtk*&HR3&fh!8x7RxSmD1(qxD7|((JUCloyI>zvW`ONRV-|su$_gFZKD+cEPqFbx) zACG7{K;(wky~Gl8r-IG?9-Y6~I5gC0=I=dUd-Ki9nYRsBxsJ=YvV}t!6CRBh!Xm|J zA0>Ul%XcJO_D6VQQ=>6)t{OlsTX2_1FPAudrj~|Z@i6IdMi}X#q=(tNCo+rLu5`IL zdu@Dta&lsF0zgaDw1KZ}Ia$$GxtR+kxFePHNWAzrX?p>*eblUzrU-RyqP%<}gAV9_ zIPf2CsdvDYl29TJI>0R=U8X3lIWTupt7#i3S7&KsxLlpG1Gb_Ohvb3nHxRj2| z9ma|4^~PuY+F;MfK3Z*?x_#=QFu!do0o0;ON&JKS^~~j38nw7%JA&+Mn@R$=D5JJb zotiR#Fmz)Zj3361@xj<`S^W32dOUTt}{!IP`kB|-q delta 1298 zcmZXTPe>F|9LL}8y1TmRJY6+S*Ic82hn(J@d2ikxP@I-GBDj0s&szo z?Sb-CXKS?Q;=7w$Z|%P59ZV@REMakjDq)z+K07p3PHBRO1flko+Sty5@qy}Wfi5W% z)KYfe!~wf{;81toV2Vp28DXTIl6J=9p2c)3P07`%t0N<0W20lE)7`;5TgqX3@;uMR zDP!;+%HhUg3p%ec>`#|k9k62812YoT)D@$aMR^wNgxlsC96oNc5-{jdI!>;=ZM zaBgr;t1bkW7BzR!5vCI+7;K|_aNYhAIzE^Sjw+(4G)zkwkU@5&%o(YJR^ZyhQR&W$lO!ETsdKl(H~3UkO<3U_LgJC?W(EL|FNAKof#{=YSR$cq4TR zbW=iZDwo=@6Q^q^1-lgXNbxzKa8Aqj!V;>3CEN&0us(v1p;~PoVT$+T1{~4;YFpZ8 z?Y;I2|HK>k1AdLy@Uph5J<}Ffj>OMvw<-f6U$l4E!tr&2_IcvLximp-8G+_sAcEqa zxUmLKt1Ei`EH)(xYV^eAFCZE`k-Q5%yEEeZ(options => + { + options.AutoEventSelectors.AddNamespace("Volo.Abp.Identity"); + options.AutoEventSelectors.AddNamespace("Volo.Abp.IdentityServer"); + }); + Configure(options => { var redisConfig = ConfigurationOptions.Parse(options.Configuration); diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201024093309_Add-MemberCard-Entity.Designer.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201024093309_Add-MemberCard-Entity.Designer.cs new file mode 100644 index 000000000..e2720f3da --- /dev/null +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201024093309_Add-MemberCard-Entity.Designer.cs @@ -0,0 +1,590 @@ +// +using System; +using LINGYUN.Abp.MessageService.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Abp.MessageService.Migrations +{ + [DbContext(typeof(MessageServiceHostMigrationsDbContext))] + [Migration("20201024093309_Add-MemberCard-Entity")] + partial class AddMemberCardEntity + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.7") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.ChatGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Address") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("AdminUserId") + .HasColumnType("char(36)"); + + b.Property("AllowAnonymous") + .HasColumnType("tinyint(1)"); + + b.Property("AllowSendMessage") + .HasColumnType("tinyint(1)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MaxUserCount") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.Property("Notice") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Tag") + .HasColumnType("varchar(512) CHARACTER SET utf8mb4") + .HasMaxLength(512); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AppChatGroups"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.GroupChatBlack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnType("char(36)"); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("ShieldUserId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "GroupId"); + + b.ToTable("AppGroupChatBlacks"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.GroupMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Content") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(1048576); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnType("char(36)"); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("MessageId") + .HasColumnType("bigint"); + + b.Property("SendState") + .HasColumnType("tinyint"); + + b.Property("SendUserName") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "GroupId"); + + b.ToTable("AppGroupMessages"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatBlack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnType("char(36)"); + + b.Property("ShieldUserId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserChatBlacks"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatCard", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Age") + .HasColumnType("int"); + + b.Property("AvatarUrl") + .HasColumnType("varchar(512) CHARACTER SET utf8mb4") + .HasMaxLength(512); + + b.Property("Birthday") + .HasColumnType("datetime(6)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("NickName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("Sex") + .HasColumnType("int"); + + b.Property("Sign") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserChatCards"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "GroupId", "UserId"); + + b.ToTable("AppUserChatGroups"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("AllowAddFriend") + .HasColumnType("tinyint(1)"); + + b.Property("AllowAnonymous") + .HasColumnType("tinyint(1)"); + + b.Property("AllowReceiveMessage") + .HasColumnType("tinyint(1)"); + + b.Property("AllowSendMessage") + .HasColumnType("tinyint(1)"); + + b.Property("RequireAddFriendValition") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserChatSettings"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserGroupCard", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsAdmin") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("NickName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("SilenceEnd") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserGroupCards"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Content") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(1048576); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnType("char(36)"); + + b.Property("MessageId") + .HasColumnType("bigint"); + + b.Property("ReceiveUserId") + .HasColumnType("char(36)"); + + b.Property("SendState") + .HasColumnType("tinyint"); + + b.Property("SendUserName") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ReceiveUserId"); + + b.ToTable("AppUserMessages"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserSpecialFocus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnType("char(36)"); + + b.Property("FocusUserId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserSpecialFocuss"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("ExpirationTime") + .HasColumnType("datetime(6)"); + + b.Property("NotificationCateGory") + .IsRequired() + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("NotificationData") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(1048576); + + b.Property("NotificationId") + .HasColumnType("bigint"); + + b.Property("NotificationName") + .IsRequired() + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("NotificationTypeName") + .IsRequired() + .HasColumnType("varchar(512) CHARACTER SET utf8mb4") + .HasMaxLength(512); + + b.Property("Severity") + .HasColumnType("tinyint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "NotificationName"); + + b.ToTable("AppNotifications"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.UserNotification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("NotificationId") + .HasColumnType("bigint"); + + b.Property("ReadStatus") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId", "NotificationId") + .HasName("IX_Tenant_User_Notification_Id"); + + b.ToTable("AppUserNotifications"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Subscriptions.UserSubscribe", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("NotificationName") + .IsRequired() + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("UserName") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128) + .HasDefaultValue("/"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId", "NotificationName") + .IsUnique() + .HasName("IX_Tenant_User_Notification_Name"); + + b.ToTable("AppUserSubscribes"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201024093309_Add-MemberCard-Entity.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201024093309_Add-MemberCard-Entity.cs new file mode 100644 index 000000000..4e6bdc925 --- /dev/null +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201024093309_Add-MemberCard-Entity.cs @@ -0,0 +1,125 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace LINGYUN.Abp.MessageService.Migrations +{ + public partial class AddMemberCardEntity : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AppChatGroupAdmins"); + + migrationBuilder.AddColumn( + name: "AdminUserId", + table: "AppChatGroups", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); + + migrationBuilder.CreateTable( + name: "AppUserChatCards", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + TenantId = table.Column(nullable: true), + UserId = table.Column(nullable: false), + UserName = table.Column(maxLength: 256, nullable: false), + Sex = table.Column(nullable: false), + Sign = table.Column(maxLength: 30, nullable: true), + NickName = table.Column(maxLength: 256, nullable: true), + Description = table.Column(maxLength: 50, nullable: true), + AvatarUrl = table.Column(maxLength: 512, nullable: true), + Birthday = table.Column(nullable: true), + Age = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AppUserChatCards", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AppUserGroupCards", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + TenantId = table.Column(nullable: true), + UserId = table.Column(nullable: false), + NickName = table.Column(maxLength: 256, nullable: true), + IsAdmin = table.Column(nullable: false), + SilenceEnd = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AppUserGroupCards", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_AppUserChatCards_TenantId_UserId", + table: "AppUserChatCards", + columns: new[] { "TenantId", "UserId" }); + + migrationBuilder.CreateIndex( + name: "IX_AppUserGroupCards_TenantId_UserId", + table: "AppUserGroupCards", + columns: new[] { "TenantId", "UserId" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AppUserChatCards"); + + migrationBuilder.DropTable( + name: "AppUserGroupCards"); + + migrationBuilder.DropColumn( + name: "AdminUserId", + table: "AppChatGroups"); + + migrationBuilder.CreateTable( + name: "AppChatGroupAdmins", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + AllowAddPeople = table.Column(type: "tinyint(1)", nullable: false), + AllowDissolveGroup = table.Column(type: "tinyint(1)", nullable: false), + AllowKickPeople = table.Column(type: "tinyint(1)", nullable: false), + AllowSendNotice = table.Column(type: "tinyint(1)", nullable: false), + AllowSilence = table.Column(type: "tinyint(1)", nullable: false), + CreationTime = table.Column(type: "datetime(6)", nullable: false), + CreatorId = table.Column(type: "char(36)", nullable: true), + GroupId = table.Column(type: "bigint", nullable: false), + IsSuperAdmin = table.Column(type: "tinyint(1)", nullable: false), + LastModificationTime = table.Column(type: "datetime(6)", nullable: true), + LastModifierId = table.Column(type: "char(36)", nullable: true), + TenantId = table.Column(type: "char(36)", nullable: true), + UserId = table.Column(type: "char(36)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AppChatGroupAdmins", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_AppChatGroupAdmins_TenantId_GroupId", + table: "AppChatGroupAdmins", + columns: new[] { "TenantId", "GroupId" }); + } + } +} diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201024114206_Add-UserChatFriend-Entity.Designer.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201024114206_Add-UserChatFriend-Entity.Designer.cs new file mode 100644 index 000000000..56da787fa --- /dev/null +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201024114206_Add-UserChatFriend-Entity.Designer.cs @@ -0,0 +1,634 @@ +// +using System; +using LINGYUN.Abp.MessageService.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Abp.MessageService.Migrations +{ + [DbContext(typeof(MessageServiceHostMigrationsDbContext))] + [Migration("20201024114206_Add-UserChatFriend-Entity")] + partial class AddUserChatFriendEntity + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.7") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.ChatGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Address") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("AdminUserId") + .HasColumnType("char(36)"); + + b.Property("AllowAnonymous") + .HasColumnType("tinyint(1)"); + + b.Property("AllowSendMessage") + .HasColumnType("tinyint(1)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MaxUserCount") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.Property("Notice") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Tag") + .HasColumnType("varchar(512) CHARACTER SET utf8mb4") + .HasMaxLength(512); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AppChatGroups"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.GroupChatBlack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnType("char(36)"); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("ShieldUserId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "GroupId"); + + b.ToTable("AppGroupChatBlacks"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.GroupMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Content") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(1048576); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnType("char(36)"); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("MessageId") + .HasColumnType("bigint"); + + b.Property("SendState") + .HasColumnType("tinyint"); + + b.Property("SendUserName") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "GroupId"); + + b.ToTable("AppGroupMessages"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatBlack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnType("char(36)"); + + b.Property("ShieldUserId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserChatBlacks"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatCard", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Age") + .HasColumnType("int"); + + b.Property("AvatarUrl") + .HasColumnType("varchar(512) CHARACTER SET utf8mb4") + .HasMaxLength(512); + + b.Property("Birthday") + .HasColumnType("datetime(6)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("NickName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("Sex") + .HasColumnType("int"); + + b.Property("Sign") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserChatCards"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatFriend", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Black") + .HasColumnType("tinyint(1)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DontDisturb") + .HasColumnType("tinyint(1)"); + + b.Property("FrientId") + .HasColumnType("char(36)"); + + b.Property("RemarkName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("SpecialFocus") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId", "FrientId"); + + b.ToTable("AppUserChatFriends"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "GroupId", "UserId"); + + b.ToTable("AppUserChatGroups"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("AllowAddFriend") + .HasColumnType("tinyint(1)"); + + b.Property("AllowAnonymous") + .HasColumnType("tinyint(1)"); + + b.Property("AllowReceiveMessage") + .HasColumnType("tinyint(1)"); + + b.Property("AllowSendMessage") + .HasColumnType("tinyint(1)"); + + b.Property("RequireAddFriendValition") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserChatSettings"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserGroupCard", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsAdmin") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("NickName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("SilenceEnd") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserGroupCards"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Content") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(1048576); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnType("char(36)"); + + b.Property("MessageId") + .HasColumnType("bigint"); + + b.Property("ReceiveUserId") + .HasColumnType("char(36)"); + + b.Property("SendState") + .HasColumnType("tinyint"); + + b.Property("SendUserName") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ReceiveUserId"); + + b.ToTable("AppUserMessages"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserSpecialFocus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnType("char(36)"); + + b.Property("FocusUserId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserSpecialFocuss"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("ExpirationTime") + .HasColumnType("datetime(6)"); + + b.Property("NotificationCateGory") + .IsRequired() + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("NotificationData") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(1048576); + + b.Property("NotificationId") + .HasColumnType("bigint"); + + b.Property("NotificationName") + .IsRequired() + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("NotificationTypeName") + .IsRequired() + .HasColumnType("varchar(512) CHARACTER SET utf8mb4") + .HasMaxLength(512); + + b.Property("Severity") + .HasColumnType("tinyint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "NotificationName"); + + b.ToTable("AppNotifications"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.UserNotification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("NotificationId") + .HasColumnType("bigint"); + + b.Property("ReadStatus") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId", "NotificationId") + .HasName("IX_Tenant_User_Notification_Id"); + + b.ToTable("AppUserNotifications"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Subscriptions.UserSubscribe", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("NotificationName") + .IsRequired() + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("UserName") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128) + .HasDefaultValue("/"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId", "NotificationName") + .IsUnique() + .HasName("IX_Tenant_User_Notification_Name"); + + b.ToTable("AppUserSubscribes"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201024114206_Add-UserChatFriend-Entity.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201024114206_Add-UserChatFriend-Entity.cs new file mode 100644 index 000000000..183413ae4 --- /dev/null +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201024114206_Add-UserChatFriend-Entity.cs @@ -0,0 +1,44 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace LINGYUN.Abp.MessageService.Migrations +{ + public partial class AddUserChatFriendEntity : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AppUserChatFriends", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + TenantId = table.Column(nullable: true), + UserId = table.Column(nullable: false), + FrientId = table.Column(nullable: false), + Black = table.Column(nullable: false), + DontDisturb = table.Column(nullable: false), + SpecialFocus = table.Column(nullable: false), + RemarkName = table.Column(maxLength: 256, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AppUserChatFriends", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_AppUserChatFriends_TenantId_UserId_FrientId", + table: "AppUserChatFriends", + columns: new[] { "TenantId", "UserId", "FrientId" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AppUserChatFriends"); + } + } +} diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/MessageServiceHostMigrationsDbContextModelSnapshot.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/MessageServiceHostMigrationsDbContextModelSnapshot.cs index 1cfe6b4a1..8082abdb1 100644 --- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/MessageServiceHostMigrationsDbContextModelSnapshot.cs +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/MessageServiceHostMigrationsDbContextModelSnapshot.cs @@ -16,10 +16,10 @@ namespace LINGYUN.Abp.MessageService.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) - .HasAnnotation("ProductVersion", "3.1.4") + .HasAnnotation("ProductVersion", "3.1.7") .HasAnnotation("Relational:MaxIdentifierLength", 64); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Messages.ChatGroup", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.ChatGroup", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -29,6 +29,9 @@ namespace LINGYUN.Abp.MessageService.Migrations .HasColumnType("varchar(256) CHARACTER SET utf8mb4") .HasMaxLength(256); + b.Property("AdminUserId") + .HasColumnType("char(36)"); + b.Property("AllowAnonymous") .HasColumnType("tinyint(1)"); @@ -39,7 +42,7 @@ namespace LINGYUN.Abp.MessageService.Migrations .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); - b.Property("CreatorId") + b.Property("CreatorId") .HasColumnName("CreatorId") .HasColumnType("char(36)"); @@ -54,7 +57,7 @@ namespace LINGYUN.Abp.MessageService.Migrations .HasColumnName("LastModificationTime") .HasColumnType("datetime(6)"); - b.Property("LastModifierId") + b.Property("LastModifierId") .HasColumnName("LastModifierId") .HasColumnType("char(36)"); @@ -74,7 +77,7 @@ namespace LINGYUN.Abp.MessageService.Migrations .HasColumnType("varchar(512) CHARACTER SET utf8mb4") .HasMaxLength(512); - b.Property("TenantId") + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); @@ -85,61 +88,82 @@ namespace LINGYUN.Abp.MessageService.Migrations b.ToTable("AppChatGroups"); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Messages.ChatGroupAdmin", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.GroupChatBlack", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("bigint"); - b.Property("AllowAddPeople") - .HasColumnType("tinyint(1)"); + b.Property("CreationTime") + .HasColumnType("datetime(6)"); - b.Property("AllowDissolveGroup") - .HasColumnType("tinyint(1)"); + b.Property("CreatorId") + .HasColumnType("char(36)"); - b.Property("AllowKickPeople") - .HasColumnType("tinyint(1)"); + b.Property("GroupId") + .HasColumnType("bigint"); - b.Property("AllowSendNotice") - .HasColumnType("tinyint(1)"); + b.Property("ShieldUserId") + .HasColumnType("char(36)"); - b.Property("AllowSilence") - .HasColumnType("tinyint(1)"); + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "GroupId"); + + b.ToTable("AppGroupChatBlacks"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.GroupMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Content") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(1048576); b.Property("CreationTime") + .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); - b.Property("CreatorId") + b.Property("CreatorId") .HasColumnType("char(36)"); b.Property("GroupId") .HasColumnType("bigint"); - b.Property("IsSuperAdmin") - .HasColumnType("tinyint(1)"); + b.Property("MessageId") + .HasColumnType("bigint"); - b.Property("LastModificationTime") - .HasColumnType("datetime(6)"); + b.Property("SendState") + .HasColumnType("tinyint"); - b.Property("LastModifierId") - .HasColumnType("char(36)"); + b.Property("SendUserName") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); - b.Property("TenantId") + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); - b.Property("UserId") - .IsRequired() - .HasColumnType("char(36)"); + b.Property("Type") + .HasColumnType("int"); b.HasKey("Id"); b.HasIndex("TenantId", "GroupId"); - b.ToTable("AppChatGroupAdmins"); + b.ToTable("AppGroupMessages"); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Messages.GroupChatBlack", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatBlack", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -148,105 +172,147 @@ namespace LINGYUN.Abp.MessageService.Migrations b.Property("CreationTime") .HasColumnType("datetime(6)"); - b.Property("CreatorId") + b.Property("CreatorId") .HasColumnType("char(36)"); - b.Property("GroupId") - .HasColumnType("bigint"); - - b.Property("ShieldUserId") - .IsRequired() + b.Property("ShieldUserId") .HasColumnType("char(36)"); - b.Property("TenantId") + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); + b.Property("UserId") + .HasColumnType("char(36)"); + b.HasKey("Id"); - b.HasIndex("TenantId", "GroupId"); + b.HasIndex("TenantId", "UserId"); - b.ToTable("AppGroupChatBlacks"); + b.ToTable("AppUserChatBlacks"); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Messages.GroupMessage", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatCard", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("bigint"); - b.Property("Content") - .IsRequired() - .HasColumnType("longtext CHARACTER SET utf8mb4") - .HasMaxLength(1048576); + b.Property("Age") + .HasColumnType("int"); + + b.Property("AvatarUrl") + .HasColumnType("varchar(512) CHARACTER SET utf8mb4") + .HasMaxLength(512); + + b.Property("Birthday") + .HasColumnType("datetime(6)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); b.Property("CreationTime") .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); - b.Property("CreatorId") + b.Property("CreatorId") + .HasColumnName("CreatorId") .HasColumnType("char(36)"); - b.Property("GroupId") - .HasColumnType("bigint"); + b.Property("Description") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); - b.Property("MessageId") - .HasColumnType("bigint"); + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("SendState") - .HasColumnType("tinyint"); + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); - b.Property("SendUserName") - .IsRequired() - .HasColumnType("varchar(64) CHARACTER SET utf8mb4") - .HasMaxLength(64); + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("NickName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("Sex") + .HasColumnType("int"); - b.Property("TenantId") + b.Property("Sign") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); - b.Property("Type") - .HasColumnType("int"); + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); b.HasKey("Id"); - b.HasIndex("TenantId", "GroupId"); + b.HasIndex("TenantId", "UserId"); - b.ToTable("AppGroupMessages"); + b.ToTable("AppUserChatCards"); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Messages.UserChatBlack", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatFriend", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("bigint"); + b.Property("Black") + .HasColumnType("tinyint(1)"); + b.Property("CreationTime") + .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); - b.Property("CreatorId") + b.Property("CreatorId") + .HasColumnName("CreatorId") .HasColumnType("char(36)"); - b.Property("ShieldUserId") - .IsRequired() + b.Property("DontDisturb") + .HasColumnType("tinyint(1)"); + + b.Property("FrientId") .HasColumnType("char(36)"); - b.Property("TenantId") + b.Property("RemarkName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("SpecialFocus") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); - b.Property("UserId") - .IsRequired() + b.Property("UserId") .HasColumnType("char(36)"); b.HasKey("Id"); - b.HasIndex("TenantId", "UserId"); + b.HasIndex("TenantId", "UserId", "FrientId"); - b.ToTable("AppUserChatBlacks"); + b.ToTable("AppUserChatFriends"); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Messages.UserChatGroup", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatGroup", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -256,19 +322,18 @@ namespace LINGYUN.Abp.MessageService.Migrations .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); - b.Property("CreatorId") + b.Property("CreatorId") .HasColumnName("CreatorId") .HasColumnType("char(36)"); b.Property("GroupId") .HasColumnType("bigint"); - b.Property("TenantId") + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); - b.Property("UserId") - .IsRequired() + b.Property("UserId") .HasColumnType("char(36)"); b.HasKey("Id"); @@ -278,7 +343,7 @@ namespace LINGYUN.Abp.MessageService.Migrations b.ToTable("AppUserChatGroups"); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Messages.UserChatSetting", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatSetting", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -299,12 +364,11 @@ namespace LINGYUN.Abp.MessageService.Migrations b.Property("RequireAddFriendValition") .HasColumnType("tinyint(1)"); - b.Property("TenantId") + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); - b.Property("UserId") - .IsRequired() + b.Property("UserId") .HasColumnType("char(36)"); b.HasKey("Id"); @@ -314,7 +378,63 @@ namespace LINGYUN.Abp.MessageService.Migrations b.ToTable("AppUserChatSettings"); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Messages.UserMessage", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserGroupCard", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsAdmin") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("NickName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("SilenceEnd") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserGroupCards"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserMessage", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -329,14 +449,13 @@ namespace LINGYUN.Abp.MessageService.Migrations .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); - b.Property("CreatorId") + b.Property("CreatorId") .HasColumnType("char(36)"); b.Property("MessageId") .HasColumnType("bigint"); - b.Property("ReceiveUserId") - .IsRequired() + b.Property("ReceiveUserId") .HasColumnType("char(36)"); b.Property("SendState") @@ -347,7 +466,7 @@ namespace LINGYUN.Abp.MessageService.Migrations .HasColumnType("varchar(64) CHARACTER SET utf8mb4") .HasMaxLength(64); - b.Property("TenantId") + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); @@ -361,7 +480,7 @@ namespace LINGYUN.Abp.MessageService.Migrations b.ToTable("AppUserMessages"); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Messages.UserSpecialFocus", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserSpecialFocus", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -370,19 +489,17 @@ namespace LINGYUN.Abp.MessageService.Migrations b.Property("CreationTime") .HasColumnType("datetime(6)"); - b.Property("CreatorId") + b.Property("CreatorId") .HasColumnType("char(36)"); - b.Property("FocusUserId") - .IsRequired() + b.Property("FocusUserId") .HasColumnType("char(36)"); - b.Property("TenantId") + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); - b.Property("UserId") - .IsRequired() + b.Property("UserId") .HasColumnType("char(36)"); b.HasKey("Id"); @@ -431,7 +548,7 @@ namespace LINGYUN.Abp.MessageService.Migrations b.Property("Severity") .HasColumnType("tinyint"); - b.Property("TenantId") + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); @@ -457,12 +574,11 @@ namespace LINGYUN.Abp.MessageService.Migrations b.Property("ReadStatus") .HasColumnType("int"); - b.Property("TenantId") + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); - b.Property("UserId") - .IsRequired() + b.Property("UserId") .HasColumnType("char(36)"); b.HasKey("Id"); @@ -488,12 +604,11 @@ namespace LINGYUN.Abp.MessageService.Migrations .HasColumnType("varchar(100) CHARACTER SET utf8mb4") .HasMaxLength(100); - b.Property("TenantId") + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); - b.Property("UserId") - .IsRequired() + b.Property("UserId") .HasColumnType("char(36)"); b.Property("UserName") diff --git a/vueJs/package-lock.json b/vueJs/package-lock.json index be3cf43d6..a6c66486a 100644 --- a/vueJs/package-lock.json +++ b/vueJs/package-lock.json @@ -14595,6 +14595,14 @@ "integrity": "sha1-W4o6d2Xf4AEmHd6RVYnngvjJTR4=", "dev": true }, + "lemon-imui": { + "version": "1.0.4", + "resolved": "https://registry.npm.taobao.org/lemon-imui/download/lemon-imui-1.0.4.tgz", + "integrity": "sha1-cq+I/hTHnTLv886bV97T1XoG5TI=", + "requires": { + "vue": "^2.6.10" + } + }, "leven": { "version": "3.1.0", "resolved": "https://registry.npm.taobao.org/leven/download/leven-3.1.0.tgz", diff --git a/vueJs/package.json b/vueJs/package.json index e5f50de33..2970d1cf1 100644 --- a/vueJs/package.json +++ b/vueJs/package.json @@ -31,6 +31,7 @@ "js-cookie": "^2.2.1", "jsonlint": "^1.6.3", "jszip": "^3.3.0", + "lemon-imui": "^1.0.4", "lodash": "^4.17.15", "morgan": "^1.10.0", "normalize.css": "^8.0.1", diff --git a/vueJs/src/api/instant-message.ts b/vueJs/src/api/instant-message.ts new file mode 100644 index 000000000..97aadafed --- /dev/null +++ b/vueJs/src/api/instant-message.ts @@ -0,0 +1,71 @@ +import ApiService from './serviceBase' +import { PagedResultDto, PagedAndSortedResultRequestDto, PagedResultRequestDto } from './types' + +const serviceUrl = process.env.VUE_APP_BASE_API + +export default class ImApiService { + public static getMyFriends(payload: MyFriendGetByPaged) { + let _url = 'api/im/my-friends' + _url += '?filter=' + payload.filter + _url += '&sorting=' + payload.sorting + _url += '&reverse=' + payload.reverse + _url += '&skipCount=' + payload.skipCount + _url += '&maxResultCount=' + payload.maxResultCount + return ApiService.Get>(_url, serviceUrl) + } +} + +export enum Sex +{ + Male, + Female, + Other +} + +export class UserCard { + tenantId?: string + userId = '' + userName = '' + avatarUrl = '' + nickName = '' + age = 0 + sex = Sex.Male + sign = '' + description = '' + birthday?: Date +} + +export class UserFriend extends UserCard { + friendId = '' + remarkName = '' + black = false + specialFocus = false + dontDisturb = false +} + +export class MyFriendGetByPaged extends PagedAndSortedResultRequestDto { + filter = '' + sorting = 'UserName' + skipCount = 0 + reverse = false +} + +export enum MessageType { + Text = 0, + Image = 10, + Link = 20, + Video = 30 +} + +export class ChatMessage { + tenantId?: string + groupId = '' + messageId = '' + formUserId = '' + formUserName = '' + toUserId = '' + content = '' + sendTime = new Date() + isAnonymous = false + messageType = MessageType.Text +} diff --git a/vueJs/src/components/InstantMessage/index.vue b/vueJs/src/components/InstantMessage/index.vue new file mode 100644 index 000000000..5f578350e --- /dev/null +++ b/vueJs/src/components/InstantMessage/index.vue @@ -0,0 +1,122 @@ + + + diff --git a/vueJs/src/main.ts b/vueJs/src/main.ts index 00e5e0d17..a59ee9adb 100644 --- a/vueJs/src/main.ts +++ b/vueJs/src/main.ts @@ -8,10 +8,12 @@ import SvgIcon from 'vue-svgicon' import uploader from 'vue-simple-uploader' import contextMenu from 'vue-contextmenujs' import VueEvents from '@/components/EventBus' +import LemonIMUI from 'lemon-imui' import '@/styles/element-variables.scss' import 'view-design/dist/styles/iview.css' import '@/styles/index.scss' +import 'lemon-imui/dist/index.css' import App from '@/App.vue' import store from '@/store' @@ -44,6 +46,7 @@ Vue.use(SvgIcon, { Vue.use(uploader) Vue.use(contextMenu) Vue.use(VueEvents) +Vue.use(LemonIMUI) // Register global directives Object.keys(directives).forEach(key => { diff --git a/vueJs/src/shims.d.ts b/vueJs/src/shims.d.ts index 03355ea3b..bbe4bd43b 100644 --- a/vueJs/src/shims.d.ts +++ b/vueJs/src/shims.d.ts @@ -31,3 +31,6 @@ declare module 'vue-simple-uploader' // TODO vue-contextmenujs declare module 'vue-contextmenujs' + +// TODO lemon-imui +declare module 'lemon-imui' diff --git a/vueJs/src/views/dashboard/admin/index.vue b/vueJs/src/views/dashboard/admin/index.vue index 0a13972b5..63a5102ce 100644 --- a/vueJs/src/views/dashboard/admin/index.vue +++ b/vueJs/src/views/dashboard/admin/index.vue @@ -1,21 +1,36 @@ diff --git a/vueJs/src/components/Lemon-IMUI/components/Avatar.vue b/vueJs/src/components/Lemon-IMUI/components/Avatar.vue new file mode 100644 index 000000000..a9a1efd7e --- /dev/null +++ b/vueJs/src/components/Lemon-IMUI/components/Avatar.vue @@ -0,0 +1,54 @@ + + + diff --git a/vueJs/src/components/Lemon-IMUI/index.vue b/vueJs/src/components/Lemon-IMUI/index.vue new file mode 100644 index 000000000..e69de29bb diff --git a/vueJs/src/mixins/DataListMiXin.ts b/vueJs/src/mixins/DataListMiXin.ts index 0caf13f13..76185319d 100644 --- a/vueJs/src/mixins/DataListMiXin.ts +++ b/vueJs/src/mixins/DataListMiXin.ts @@ -41,6 +41,7 @@ export default class DataListMiXin extends Vue { .then(res => { this.dataList = res.items this.dataTotal = res.items.length + this.onDataLoadCompleted() }) .finally(() => { this.dataLoading = false @@ -110,7 +111,9 @@ export default class DataListMiXin extends Vue { } /** 数据加载完毕事件 */ - protected onDataLoadCompleted() {} + protected onDataLoadCompleted() { + this.dataLoading = false + } /** * 排序变更事件 diff --git a/vueJs/src/mixins/EventBusMiXin.ts b/vueJs/src/mixins/EventBusMiXin.ts index a59ed6a59..af6fb439e 100644 --- a/vueJs/src/mixins/EventBusMiXin.ts +++ b/vueJs/src/mixins/EventBusMiXin.ts @@ -48,6 +48,13 @@ export default class EventBusMiXin extends Vue { this.$events.off(name, undefined) } + /** + * 注销所有事件 + */ + protected unSubscribeAll() { + this.$events.removeAll() + } + /** * 触发事件 * @param name 事件名称 diff --git a/vueJs/src/views/dashboard/admin/index.vue b/vueJs/src/views/dashboard/admin/index.vue index 63a5102ce..00034ba3f 100644 --- a/vueJs/src/views/dashboard/admin/index.vue +++ b/vueJs/src/views/dashboard/admin/index.vue @@ -1,29 +1,15 @@ diff --git a/vueJs/src/views/dashboard/index.vue b/vueJs/src/views/dashboard/index.vue index 3208b3cfc..c219b0373 100644 --- a/vueJs/src/views/dashboard/index.vue +++ b/vueJs/src/views/dashboard/index.vue @@ -1,23 +1,31 @@ From f5fb371c71e3a217a195401dc3dfe5289617bb6d Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Mon, 26 Oct 2020 09:44:33 +0800 Subject: [PATCH 04/10] Fix bug: Client update by redirectUris add duplicate values --- .../LINGYUN/Abp/IdentityServer/Clients/ClientAppService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/Clients/ClientAppService.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/Clients/ClientAppService.cs index cdb6571f1..0f2515610 100644 --- a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/Clients/ClientAppService.cs +++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/Clients/ClientAppService.cs @@ -180,7 +180,7 @@ namespace LINGYUN.Abp.IdentityServer.Clients client.RedirectUris.RemoveAll(uri => !input.RedirectUris.Contains(uri.RedirectUri)); foreach (var redirect in input.RedirectUris) { - if (client.FindRedirectUri(redirect) != null) + if (client.FindRedirectUri(redirect) == null) { client.AddRedirectUri(redirect); } From d74158fd5abfa5b72540cc47ad6799cb98bf4005 Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Mon, 26 Oct 2020 20:08:19 +0800 Subject: [PATCH 05/10] add component: AddUserFriend --- .../Abp/IM/SignalR/Hubs/MessagesHub.cs | 50 +++-- .../LINGYUN/Abp/IM/Contract/IFriendStore.cs | 14 ++ .../LINGYUN/Abp/IM/Contract/UserFriend.cs | 18 ++ .../Abp/IM/Contract/UserFriendGroup.cs | 17 ++ .../LINGYUN/Abp/IM/Messages/IMessageStore.cs | 16 ++ .../Abp/IM/Messages/LastChatMessage.cs | 9 + .../Chat/Dto/GetMyFriendsDto.cs | 10 + .../Chat/Dto/GetUserLastMessageDto.cs | 11 ++ .../MessageService/Chat/IChatAppService.cs | 35 ++-- .../Chat/IMyFriendAppService.cs | 4 +- .../Abp/MessageService/Chat/ChatAppService.cs | 63 +++--- .../MessageService/Chat/MyFriendAppService.cs | 12 +- .../MessageServiceErrorCodes.cs | 16 +- .../AbpMessageServiceDomainModule.cs | 5 +- .../Abp/MessageService/Chat/FriendStore.cs | 33 +++- .../MessageService/Chat/IMessageRepository.cs | 7 + .../Chat/IUserChatFriendRepository.cs | 6 + .../Abp/MessageService/Chat/MessageStore.cs | 40 ++-- .../Chat/UserChatFriendGroup.cs | 28 +++ .../Localization/Resources/en.json | 13 +- .../Localization/Resources/zh-Hans.json | 13 +- .../MessageServiceDomainAutoMapperProfile.cs | 11 ++ .../Chat/EfCoreMessageRepository.cs | 50 ++++- .../Chat/EfCoreUserChatFriendRepository.cs | 36 ++++ .../Abp/MessageService/Chat/ChatController.cs | 41 ++-- .../MessageService/Chat/MyFriendController.cs | 10 +- .../LINGYUN.ApiGateway.Host/event-bus-cap.db | Bin 40960 -> 40960 bytes vueJs/src/api/instant-message.ts | 48 ++++- vueJs/src/api/user-lookup.ts | 16 ++ .../InstantMessage/components/AddFriend.vue | 182 ++++++++++++++++++ vueJs/src/components/InstantMessage/index.vue | 118 ++++++++---- vueJs/src/mixins/EventBusMiXin.ts | 2 +- 32 files changed, 769 insertions(+), 165 deletions(-) create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserFriendGroup.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/LastChatMessage.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/GetMyFriendsDto.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/GetUserLastMessageDto.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriendGroup.cs create mode 100644 vueJs/src/api/user-lookup.ts create mode 100644 vueJs/src/components/InstantMessage/components/AddFriend.vue 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 84a6559ad..3d1d255b8 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 @@ -7,6 +7,7 @@ using Microsoft.Extensions.Logging; using System; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; +using Volo.Abp.Users; namespace LINGYUN.Abp.IM.SignalR.Hubs { @@ -39,22 +40,49 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs return new PagedResultDto(myFrientCount, lastContractFriends); } - [HubMethodName("MyFriends")] - public virtual async Task> GetMyFriendsAsync( - Guid? tenantId, + [HubMethodName("MyLastChatMessages")] + public virtual async Task> GetMyLastChatMessagesAsync( + string sorting = nameof(LastChatMessage.SendTime), + bool reverse = true, + int maxResultCount = 10) + { + return await GetLastChatMessagesAsync(CurrentUser.GetId(), sorting, reverse, maxResultCount); + } + + + [HubMethodName("LastChatMessages")] + public virtual async Task> GetLastChatMessagesAsync( Guid userId, - string filter = "", - string sorting = nameof(UserFriend.UserId), - bool reverse = false, - int skipCount = 0, + string sorting = nameof(LastChatMessage.SendTime), + bool reverse = true, int maxResultCount = 10) { - var myFrientCount = await FriendStore.GetCountAsync(tenantId, userId); + var messages = await MessageStore + .GetLastChatMessagesAsync( + CurrentTenant.Id, userId, sorting, reverse, maxResultCount); - var myFriends = await FriendStore - .GetListAsync(tenantId, userId, filter, sorting, reverse, skipCount, maxResultCount); + return new ListResultDto(messages); + } + + [HubMethodName("MyFriends")] + public virtual async Task> GetMyFriendsAsync( + string sorting = nameof(UserFriend.RemarkName), + bool reverse = false) + { + return await GetAllFriendsAsync(CurrentUser.GetId(), sorting, reverse); + } + + + [HubMethodName("AllFriends")] + public virtual async Task> GetAllFriendsAsync( + Guid userId, + string sorting = nameof(UserFriend.RemarkName), + bool reverse = false) + { + var userFriends = await FriendStore + .GetListAsync(CurrentTenant.Id, userId, sorting, reverse); - return new PagedResultDto(myFrientCount, myFriends); + return new ListResultDto(userFriends); } [HubMethodName("AddFriend")] diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/IFriendStore.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/IFriendStore.cs index 102fc7ef3..98722ee80 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/IFriendStore.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/IFriendStore.cs @@ -7,6 +7,20 @@ namespace LINGYUN.Abp.IM.Contract public interface IFriendStore { /// + /// 查询好友列表 + /// + /// + /// + /// + /// + /// + Task> GetListAsync( + Guid? tenantId, + Guid userId, + string sorting = nameof(UserFriend.UserId), + bool reverse = false + ); + /// /// 获取好友数量 /// /// diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserFriend.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserFriend.cs index 394ba4634..67d37cbe2 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserFriend.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserFriend.cs @@ -24,5 +24,23 @@ namespace LINGYUN.Abp.IM.Contract /// 备注名称 /// public string RemarkName { get; set; } + + public override int GetHashCode() + { + return FriendId.GetHashCode(); + } + + public override bool Equals(object obj) + { + if (obj == null) + { + return false; + } + if (obj is UserFriend friend) + { + return friend.FriendId.Equals(FriendId); + } + return false; + } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserFriendGroup.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserFriendGroup.cs new file mode 100644 index 000000000..f249f7a7a --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserFriendGroup.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace LINGYUN.Abp.IM.Contract +{ + public class UserFriendGroup + { + public Guid? TenantId { get; set; } + public string DisplayName { get; set; } + public List UserFriends { get; set; } = new List(); + + public void AddFriend(UserFriend friend) + { + UserFriends.AddIfNotContains(friend); + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageStore.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageStore.cs index 8cdbf63ac..81ac75b7f 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageStore.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageStore.cs @@ -49,6 +49,22 @@ namespace LINGYUN.Abp.IM.Messages int skipCount = 0, int maxResultCount = 10); /// + /// 获取上一次通讯消息记录 + /// + /// + /// + /// + /// + /// + /// + Task> GetLastChatMessagesAsync( + Guid? tenantId, + Guid userId, + string sorting = nameof(LastChatMessage.SendTime), + bool reverse = true, + int maxResultCount = 10 + ); + /// /// 获取与某个用户的聊天记录总数 /// /// diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/LastChatMessage.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/LastChatMessage.cs new file mode 100644 index 000000000..d0b193259 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/LastChatMessage.cs @@ -0,0 +1,9 @@ +namespace LINGYUN.Abp.IM.Messages +{ + /// + /// 上一次通讯消息 + /// + public class LastChatMessage : ChatMessage + { + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/GetMyFriendsDto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/GetMyFriendsDto.cs new file mode 100644 index 000000000..25799aa99 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/GetMyFriendsDto.cs @@ -0,0 +1,10 @@ +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public class GetMyFriendsDto : ISortedResultRequest + { + public string Sorting { get; set; } + public bool Reverse { get; set; } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/GetUserLastMessageDto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/GetUserLastMessageDto.cs new file mode 100644 index 000000000..6c9382eaf --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/GetUserLastMessageDto.cs @@ -0,0 +1,11 @@ +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public class GetUserLastMessageDto : ILimitedResultRequest, ISortedResultRequest + { + public int MaxResultCount { get; set; } + public string Sorting { get; set; } + public bool Reverse { get; set; } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IChatAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IChatAppService.cs index befeb27ad..f49837302 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IChatAppService.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IChatAppService.cs @@ -11,15 +11,15 @@ namespace LINGYUN.Abp.MessageService.Chat /// /// 发送消息 /// - /// + /// /// - Task SendMessageAsync(ChatMessage chatMessage); + Task SendMessageAsync(ChatMessage input); /// /// 申请加入群组 /// - /// + /// /// - Task ApplyJoinGroupAsync(UserJoinGroupDto userJoinGroup); + Task ApplyJoinGroupAsync(UserJoinGroupDto input); /// /// 获取我的群组 /// @@ -28,34 +28,39 @@ namespace LINGYUN.Abp.MessageService.Chat /// /// 获取群组用户 /// - /// + /// /// - Task> GetGroupUsersAsync(GroupUserGetByPagedDto groupUserGetByPaged); + Task> GetGroupUsersAsync(GroupUserGetByPagedDto input); /// /// 处理用户群组申请 /// - /// + /// /// - Task GroupAcceptUserAsync(GroupAcceptUserDto groupAcceptUser); + Task GroupAcceptUserAsync(GroupAcceptUserDto input); /// /// 群组移除用户 /// - /// + /// /// - Task GroupRemoveUserAsync(GroupRemoveUserDto groupRemoveUser); + Task GroupRemoveUserAsync(GroupRemoveUserDto input); /// /// 获取群组消息 /// - /// + /// /// - Task> GetGroupMessageAsync(GroupMessageGetByPagedDto groupMessageGetByPaged); + Task> GetGroupMessageAsync(GroupMessageGetByPagedDto input); /// /// 获取我的消息 /// - /// + /// /// - Task> GetMyChatMessageAsync(UserMessageGetByPagedDto userMessageGetByPaged); - + Task> GetMyChatMessageAsync(UserMessageGetByPagedDto input); + /// + /// 获取我最近的消息 + /// + /// + /// + Task> GetMyLastChatMessageAsync(GetUserLastMessageDto input); //TOTO: 还应该有获取我的未读消息 获取我的未读群组消息 } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IMyFriendAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IMyFriendAppService.cs index 58c3c7c4c..a220d5ee3 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IMyFriendAppService.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IMyFriendAppService.cs @@ -7,9 +7,9 @@ namespace LINGYUN.Abp.MessageService.Chat { public interface IMyFriendAppService : IApplicationService { - Task> GetMyFriendsAsync(MyFriendGetByPagedDto input); + Task> GetListAsync(MyFriendGetByPagedDto input); - Task> GetLastContactFriendsAsync(PagedResultRequestDto input); + Task> GetAllListAsync(GetMyFriendsDto input); Task CreateAsync(MyFriendCreateDto input); diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/ChatAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/ChatAppService.cs index e5c509afd..f3434c2f0 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/ChatAppService.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/ChatAppService.cs @@ -27,44 +27,53 @@ namespace LINGYUN.Abp.MessageService.Chat } [Authorize] - public virtual async Task> GetMyChatMessageAsync(UserMessageGetByPagedDto userMessageGetByPaged) + public virtual async Task> GetMyChatMessageAsync(UserMessageGetByPagedDto input) { var chatMessageCount = await _messageStore - .GetChatMessageCountAsync(CurrentTenant.Id, CurrentUser.GetId(), userMessageGetByPaged.ReceiveUserId, - userMessageGetByPaged.Filter, userMessageGetByPaged.MessageType); + .GetChatMessageCountAsync(CurrentTenant.Id, CurrentUser.GetId(), input.ReceiveUserId, + input.Filter, input.MessageType); var chatMessages = await _messageStore - .GetChatMessageAsync(CurrentTenant.Id, CurrentUser.GetId(), userMessageGetByPaged.ReceiveUserId, - userMessageGetByPaged.Filter, userMessageGetByPaged.Sorting, userMessageGetByPaged.Reverse, - userMessageGetByPaged.MessageType, userMessageGetByPaged.SkipCount, userMessageGetByPaged.MaxResultCount); + .GetChatMessageAsync(CurrentTenant.Id, CurrentUser.GetId(), input.ReceiveUserId, + input.Filter, input.Sorting, input.Reverse, + input.MessageType, input.SkipCount, input.MaxResultCount); return new PagedResultDto(chatMessageCount, chatMessages); } - public virtual async Task> GetGroupMessageAsync(GroupMessageGetByPagedDto groupMessageGetByPaged) + public virtual async Task> GetMyLastChatMessageAsync(GetUserLastMessageDto input) + { + var chatMessages = await _messageStore + .GetLastChatMessagesAsync(CurrentTenant.Id, CurrentUser.GetId(), + input.Sorting, input.Reverse, input.MaxResultCount); + + return new ListResultDto(chatMessages); + } + + public virtual async Task> GetGroupMessageAsync(GroupMessageGetByPagedDto input) { // TODO: 增加验证,用户不在群组却来查询这个群组消息,是非法客户端操作 var groupMessageCount = await _messageStore - .GetGroupMessageCountAsync(CurrentTenant.Id, groupMessageGetByPaged.GroupId, - groupMessageGetByPaged.Filter, groupMessageGetByPaged.MessageType); + .GetGroupMessageCountAsync(CurrentTenant.Id, input.GroupId, + input.Filter, input.MessageType); var groupMessages = await _messageStore - .GetGroupMessageAsync(CurrentTenant.Id, groupMessageGetByPaged.GroupId, - groupMessageGetByPaged.Filter, groupMessageGetByPaged.Sorting, groupMessageGetByPaged.Reverse, - groupMessageGetByPaged.MessageType, groupMessageGetByPaged.SkipCount, groupMessageGetByPaged.MaxResultCount); + .GetGroupMessageAsync(CurrentTenant.Id, input.GroupId, + input.Filter, input.Sorting, input.Reverse, + input.MessageType, input.SkipCount, input.MaxResultCount); return new PagedResultDto(groupMessageCount, groupMessages); } - public virtual async Task> GetGroupUsersAsync(GroupUserGetByPagedDto groupUserGetByPaged) + public virtual async Task> GetGroupUsersAsync(GroupUserGetByPagedDto input) { var groupUserCardCount = await _userGroupStore - .GetMembersCountAsync(CurrentTenant.Id, groupUserGetByPaged.GroupId); + .GetMembersCountAsync(CurrentTenant.Id, input.GroupId); var groupUserCards = await _userGroupStore.GetMembersAsync(CurrentTenant.Id, - groupUserGetByPaged.GroupId, groupUserGetByPaged.Sorting, groupUserGetByPaged.Reverse, - groupUserGetByPaged.SkipCount, groupUserGetByPaged.MaxResultCount); + input.GroupId, input.Sorting, input.Reverse, + input.SkipCount, input.MaxResultCount); return new PagedResultDto(groupUserCardCount, groupUserCards); } @@ -77,10 +86,10 @@ namespace LINGYUN.Abp.MessageService.Chat return new ListResultDto(myGroups.ToImmutableList()); } - public virtual async Task GroupAcceptUserAsync(GroupAcceptUserDto groupAcceptUser) + public virtual async Task GroupAcceptUserAsync(GroupAcceptUserDto input) { var myGroupCard = await _userGroupStore - .GetUserGroupCardAsync(CurrentTenant.Id, groupAcceptUser.GroupId, CurrentUser.GetId()); + .GetUserGroupCardAsync(CurrentTenant.Id, input.GroupId, CurrentUser.GetId()); if (myGroupCard == null) { // 当前登录用户不再用户组 @@ -92,13 +101,13 @@ namespace LINGYUN.Abp.MessageService.Chat throw new UserFriendlyException(""); } await _userGroupStore - .AddUserToGroupAsync(CurrentTenant.Id, groupAcceptUser.UserId, groupAcceptUser.GroupId, CurrentUser.GetId()); + .AddUserToGroupAsync(CurrentTenant.Id, input.UserId, input.GroupId, CurrentUser.GetId()); } - public virtual async Task GroupRemoveUserAsync(GroupRemoveUserDto groupRemoveUser) + public virtual async Task GroupRemoveUserAsync(GroupRemoveUserDto input) { var myGroupCard = await _userGroupStore - .GetUserGroupCardAsync(CurrentTenant.Id, groupRemoveUser.GroupId, CurrentUser.GetId()); + .GetUserGroupCardAsync(CurrentTenant.Id, input.GroupId, CurrentUser.GetId()); if (myGroupCard == null) { // 当前登录用户不再用户组 @@ -110,20 +119,20 @@ namespace LINGYUN.Abp.MessageService.Chat throw new UserFriendlyException(""); } await _userGroupStore - .RemoveUserFormGroupAsync(CurrentTenant.Id, groupRemoveUser.UserId, groupRemoveUser.GroupId); + .RemoveUserFormGroupAsync(CurrentTenant.Id, input.UserId, input.GroupId); } - public virtual async Task SendMessageAsync(ChatMessage chatMessage) + public virtual async Task SendMessageAsync(ChatMessage input) { // TODO:向其他租户发送消息? - chatMessage.TenantId = chatMessage.TenantId ?? CurrentTenant.Id; + input.TenantId = input.TenantId ?? CurrentTenant.Id; - await MessageSender.SendMessageAsync(chatMessage); + await MessageSender.SendMessageAsync(input); - return new ChatMessageSendResultDto(chatMessage.MessageId); + return new ChatMessageSendResultDto(input.MessageId); } - public virtual Task ApplyJoinGroupAsync(UserJoinGroupDto userJoinGroup) + public virtual Task ApplyJoinGroupAsync(UserJoinGroupDto input) { // TOTO 发送通知? return Task.CompletedTask; diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/MyFriendAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/MyFriendAppService.cs index b11ffcda1..d76bb4be7 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/MyFriendAppService.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/MyFriendAppService.cs @@ -27,18 +27,16 @@ namespace LINGYUN.Abp.MessageService.Chat await FriendStore.RemoveMemberAsync(CurrentTenant.Id, CurrentUser.GetId(), input.FriendId); } - public virtual async Task> GetLastContactFriendsAsync(PagedResultRequestDto input) + public virtual async Task> GetAllListAsync(GetMyFriendsDto input) { - var myFrientCount = await FriendStore.GetCountAsync(CurrentTenant.Id, CurrentUser.GetId()); - var myFriends = await FriendStore - .GetLastContactListAsync(CurrentTenant.Id, CurrentUser.GetId(), - input.SkipCount, input.MaxResultCount); + .GetListAsync(CurrentTenant.Id, CurrentUser.GetId(), + input.Sorting, input.Reverse); - return new PagedResultDto(myFrientCount, myFriends); + return new ListResultDto(myFriends); } - public virtual async Task> GetMyFriendsAsync(MyFriendGetByPagedDto input) + public virtual async Task> GetListAsync(MyFriendGetByPagedDto input) { var myFrientCount = await FriendStore.GetCountAsync(CurrentTenant.Id, CurrentUser.GetId()); diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/MessageServiceErrorCodes.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/MessageServiceErrorCodes.cs index 0ddb5ae88..574b5cd52 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/MessageServiceErrorCodes.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/MessageServiceErrorCodes.cs @@ -5,26 +5,30 @@ /// /// 管理员已开启全员禁言 /// - public const string GroupNotAllowedToSpeak = "Messages:Group:1001"; + public const string GroupNotAllowedToSpeak = "Messages.Group:1001"; /// /// 管理员不允许匿名发言 /// - public const string GroupNotAllowedToSpeakAnonymously = "Messages:Group:1002"; + public const string GroupNotAllowedToSpeakAnonymously = "Messages.Group:1002"; /// /// 管理员已禁止用户发言 /// - public const string GroupUserHasBlack = "Messages:Group:1003"; + public const string GroupUserHasBlack = "Messages.Group:1003"; /// /// 用户已将发信人拉黑 /// - public const string UserHasBlack = "Messages:User:1003"; + public const string UserHasBlack = "Messages.User:1003"; /// /// 用户已拒接所有消息 /// - public const string UserHasRejectAllMessage = "Messages:User:1001"; + public const string UserHasRejectAllMessage = "Messages.User:1001"; /// /// 用户不允许匿名发言 /// - public const string UserNotAllowedToSpeakAnonymously = "Messages:User:1002"; + public const string UserNotAllowedToSpeakAnonymously = "Messages.User:1002"; + /// + /// 已经添加对方为好友 + /// + public const string YouHaveAddedTheUserToFriend = "Messages.UserFriend:1001"; } } 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 60dfe789c..e5006dd94 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 @@ -34,8 +34,9 @@ namespace LINGYUN.Abp.MessageService Configure(options => { - options.MapCodeNamespace("Messages:Group", typeof(MessageServiceResource)); - options.MapCodeNamespace("Messages:User", typeof(MessageServiceResource)); + options.MapCodeNamespace("Messages.Group", typeof(MessageServiceResource)); + options.MapCodeNamespace("Messages.User", typeof(MessageServiceResource)); + options.MapCodeNamespace("Messages.UserFriend", typeof(MessageServiceResource)); }); } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/FriendStore.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/FriendStore.cs index e4bd716f7..aee590089 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/FriendStore.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/FriendStore.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Volo.Abp; using Volo.Abp.Domain.Services; using Volo.Abp.Uow; @@ -22,16 +23,18 @@ namespace LINGYUN.Abp.MessageService.Chat { using (CurrentTenant.Change(tenantId)) { - if (!await UserChatFriendRepository.IsAddedAsync(userId, friendId)) + if (await UserChatFriendRepository.IsAddedAsync(userId, friendId)) { - var userChatFriend = new UserChatFriend(userId, friendId, remarkName, tenantId) - { - CreationTime = Clock.Now, - CreatorId = userId - }; - - await UserChatFriendRepository.InsertAsync(userChatFriend); + throw new BusinessException(MessageServiceErrorCodes.YouHaveAddedTheUserToFriend); + } + var userChatFriend = new UserChatFriend(userId, friendId, remarkName, tenantId) + { + CreationTime = Clock.Now, + CreatorId = userId + }; + + await UserChatFriendRepository.InsertAsync(userChatFriend); } } @@ -41,6 +44,20 @@ namespace LINGYUN.Abp.MessageService.Chat await ChangeFriendShieldAsync(tenantId, userId, friendId, true); } + public virtual async Task> GetListAsync( + Guid? tenantId, + Guid userId, + string sorting = nameof(UserFriend.UserId), + bool reverse = false + ) + { + using (CurrentTenant.Change(tenantId)) + { + return await UserChatFriendRepository + .GetAllMembersAsync(userId, sorting, reverse); + } + } + public virtual async Task GetCountAsync(Guid? tenantId, Guid userId, string filter = "") { using (CurrentTenant.Change(tenantId)) diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IMessageRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IMessageRepository.cs index 9c5af2539..095124290 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IMessageRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IMessageRepository.cs @@ -44,6 +44,13 @@ namespace LINGYUN.Abp.MessageService.Chat MessageType? type = null, CancellationToken cancellationToken = default); + Task> GetLastMessagesByOneFriendAsync( + Guid userId, + string sorting = nameof(LastChatMessage.SendTime), + bool reverse = true, + int maxResultCount = 10, + CancellationToken cancellationToken = default); + Task> GetUserMessagesAsync( Guid sendUserId, Guid receiveUserId, diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatFriendRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatFriendRepository.cs index 96cebd7fa..af38f03b5 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatFriendRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatFriendRepository.cs @@ -19,6 +19,12 @@ namespace LINGYUN.Abp.MessageService.Chat Guid friendId, CancellationToken cancellationToken = default); + Task> GetAllMembersAsync( + Guid userId, + string sorting = nameof(UserChatFriend.RemarkName), + bool reverse = false, + CancellationToken cancellationToken = default); + Task GetMembersCountAsync( Guid userId, string filter = "", diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/MessageStore.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/MessageStore.cs index b11bbc06a..870cfe537 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/MessageStore.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/MessageStore.cs @@ -34,7 +34,7 @@ namespace LINGYUN.Abp.MessageService.Chat } [UnitOfWork] - public async Task StoreMessageAsync(ChatMessage chatMessage) + public virtual async Task StoreMessageAsync(ChatMessage chatMessage) { using (var unitOfWork = UnitOfWorkManager.Begin()) { @@ -54,7 +54,7 @@ namespace LINGYUN.Abp.MessageService.Chat } } - public async Task> GetGroupMessageAsync( + public virtual async Task> GetGroupMessageAsync( Guid? tenantId, long groupId, string filter = "", @@ -74,7 +74,7 @@ namespace LINGYUN.Abp.MessageService.Chat } } - public async Task> GetChatMessageAsync( + public virtual async Task> GetChatMessageAsync( Guid? tenantId, Guid sendUserId, Guid receiveUserId, @@ -95,6 +95,21 @@ namespace LINGYUN.Abp.MessageService.Chat } } + public virtual async Task> GetLastChatMessagesAsync( + Guid? tenantId, + Guid userId, + string sorting = nameof(LastChatMessage.SendTime), + bool reverse = true, + int maxResultCount = 10 + ) + { + using (CurrentTenant.Change(tenantId)) + { + return await MessageRepository + .GetLastMessagesByOneFriendAsync(userId, sorting, reverse, maxResultCount); + } + } + public virtual async Task GetGroupMessageCountAsync( Guid? tenantId, long groupId, @@ -130,15 +145,18 @@ namespace LINGYUN.Abp.MessageService.Chat throw new BusinessException(MessageServiceErrorCodes.UserHasBlack); } var userChatSetting = await UserChatSettingRepository.GetByUserIdAsync(chatMessage.ToUserId.Value); - if (!userChatSetting.AllowReceiveMessage) + if (userChatSetting != null) { - // 当前发送的用户不接收消息 - throw new BusinessException(MessageServiceErrorCodes.UserHasRejectAllMessage); - } - if (chatMessage.IsAnonymous && !userChatSetting.AllowAnonymous) - { - // 当前用户不允许匿名发言 - throw new BusinessException(MessageServiceErrorCodes.UserNotAllowedToSpeakAnonymously); + if (!userChatSetting.AllowReceiveMessage) + { + // 当前发送的用户不接收消息 + throw new BusinessException(MessageServiceErrorCodes.UserHasRejectAllMessage); + } + if (chatMessage.IsAnonymous && !userChatSetting.AllowAnonymous) + { + // 当前用户不允许匿名发言 + throw new BusinessException(MessageServiceErrorCodes.UserNotAllowedToSpeakAnonymously); + } } var messageId = SnowflakeIdGenerator.Create(); var message = new UserMessage(messageId, chatMessage.FormUserId, chatMessage.FormUserName, chatMessage.Content, chatMessage.MessageType); diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriendGroup.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriendGroup.cs new file mode 100644 index 000000000..622758140 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriendGroup.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public class UserChatFriendGroup : CreationAuditedEntity, IMultiTenant + { + /// + /// 租户 + /// + public virtual Guid? TenantId { get; protected set; } + /// + /// 用户标识 + /// + public virtual Guid UserId { get; protected set; } + /// + /// 分组标识 + /// + public virtual long GroupId { get; protected set; } + /// + /// 显示名称 + /// + public virtual string DisplayName { get; protected set; } + } +} 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 index 4571524e1..5ff282bdb 100644 --- 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 @@ -1,12 +1,13 @@ { "culture": "en", "texts": { - "Messages:Group:1001": "The current group is not allowed to speak", - "Messages:Group:1002": "The current group is not allowed to speak anonymously", - "Messages:Group:1003": "The administrator has banned you from speaking!", - "Messages:User:1001": "Users do not receive anonymous comments!", - "Messages:User:1002": "The user has rejected all messages!", - "Messages:User:1003": "The user rejects the message you sent!", + "Messages.Group:1001": "The current group is not allowed to speak", + "Messages.Group:1002": "The current group is not allowed to speak anonymously", + "Messages.Group:1003": "The administrator has banned you from speaking!", + "Messages.User:1001": "Users do not receive anonymous comments!", + "Messages.User:1002": "The user has rejected all messages!", + "Messages.User:1003": "The user rejects the message you sent!", + "Messages.UserFriend:1001": "You have added each other as friends, can not be repeated!", "WelcomeToApplicationNotification": "User Welcome Notice", "NewTenantRegisterdNotification": "Tenants create notification", "WelcomeToApplicationFormUser": "User :{0} welcome to join us!" 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 index bfc60566f..76b653478 100644 --- 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 @@ -1,12 +1,13 @@ { "culture": "zh-Hans", "texts": { - "Messages:Group:1001": "管理员已开启全员禁言!", - "Messages:Group:1002": "管理员不允许匿名发言!", - "Messages:Group:1003": "管理员已禁止您发言!", - "Messages:User:1001": "用户不接收匿名发言!", - "Messages:User:1002": "用户已拒接所有消息!", - "Messages:User:1003": "用户拒绝您发送的消息!", + "Messages.Group:1001": "管理员已开启全员禁言!", + "Messages.Group:1002": "管理员不允许匿名发言!", + "Messages.Group:1003": "管理员已禁止您发言!", + "Messages.User:1001": "用户不接收匿名发言!", + "Messages.User:1002": "用户已拒接所有消息!", + "Messages.User:1003": "用户拒绝您发送的消息!", + "Messages.UserFriend:1001": "您已经添加对方为好友,不能重复添加!", "WelcomeToApplicationNotification": "用户欢迎通知", "NewTenantRegisterdNotification": "租户创建通知", "WelcomeToApplicationFormUser": "用户:{0} 欢迎您的加入!" diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs index 4be5af133..8afedf49d 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs @@ -54,6 +54,17 @@ namespace LINGYUN.Abp.MessageService.Mapper .ForMember(dto => dto.MessageType, map => map.MapFrom(src => src.Type)) .ForMember(dto => dto.IsAnonymous, map => map.Ignore()) .ForMember(dto => dto.GroupId, map => map.Ignore()); + + CreateMap() + .ForMember(dto => dto.Content, map => map.MapFrom(src => src.Content)) + .ForMember(dto => dto.ToUserId, map => map.MapFrom(src => src.ReceiveUserId)) + .ForMember(dto => dto.MessageId, map => map.MapFrom(src => src.MessageId.ToString())) + .ForMember(dto => dto.FormUserId, map => map.MapFrom(src => src.CreatorId)) + .ForMember(dto => dto.FormUserName, map => map.MapFrom(src => src.SendUserName)) + .ForMember(dto => dto.SendTime, map => map.MapFrom(src => src.CreationTime)) + .ForMember(dto => dto.MessageType, map => map.MapFrom(src => src.Type)) + .ForMember(dto => dto.IsAnonymous, map => map.Ignore()) + .ForMember(dto => dto.GroupId, map => map.Ignore()); } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs index 939c0ed1b..f57f907fa 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs @@ -132,7 +132,8 @@ namespace LINGYUN.Abp.MessageService.Chat CancellationToken cancellationToken = default) { return await DbContext.Set() - .Where(x => x.ReceiveUserId.Equals(receiveUserId) && x.CreatorId.Equals(sendUserId)) + .Where(x => (x.CreatorId.Equals(sendUserId) && x.ReceiveUserId.Equals(receiveUserId)) || + x.CreatorId.Equals(receiveUserId) && x.ReceiveUserId.Equals(sendUserId)) .WhereIf(type != null, x => x.Type.Equals(type)) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Content.Contains(filter) || x.SendUserName.Contains(filter)) .LongCountAsync(GetCancellationToken(cancellationToken)); @@ -148,6 +149,46 @@ namespace LINGYUN.Abp.MessageService.Chat .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } + public virtual async Task> GetLastMessagesByOneFriendAsync( + Guid userId, + string sorting = nameof(LastChatMessage.SendTime), + bool reverse = true, + int maxResultCount = 10, + CancellationToken cancellationToken = default) + { + sorting ??= nameof(LastChatMessage.SendTime); + sorting = reverse ? sorting + " DESC" : sorting; + + var groupMsgQuery = DbContext.Set() + .Where(msg => msg.ReceiveUserId == userId || msg.CreatorId == userId) + .GroupBy(msg => msg.CreatorId) + .Select(msg => new + { + msg.Key, + MessageId = msg.Max(x => x.MessageId) + }); + + var userMessageQuery = from msg in DbContext.Set() + join gMsg in groupMsgQuery + on msg.MessageId equals gMsg.MessageId + select new LastChatMessage + { + Content = msg.Content, + SendTime = msg.CreationTime, + FormUserId = msg.CreatorId.Value, + FormUserName = msg.SendUserName, + MessageId = msg.MessageId.ToString(), + MessageType = msg.Type, + TenantId = msg.TenantId, + ToUserId = msg.ReceiveUserId + }; + + return await userMessageQuery + .OrderBy(sorting) + .Take(maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task> GetUserMessagesAsync( Guid sendUserId, Guid receiveUserId, @@ -159,13 +200,14 @@ namespace LINGYUN.Abp.MessageService.Chat int maxResultCount = 10, CancellationToken cancellationToken = default) { + sorting ??= nameof(UserMessage.MessageId); sorting = reverse ? sorting + " desc" : sorting; var userMessages = await DbContext.Set() - .Where(x => (x.CreatorId.Equals(sendUserId) && x.ReceiveUserId.Equals(receiveUserId)) | + .Where(x => (x.CreatorId.Equals(sendUserId) && x.ReceiveUserId.Equals(receiveUserId)) || x.CreatorId.Equals(receiveUserId) && x.ReceiveUserId.Equals(sendUserId)) .WhereIf(type != null, x => x.Type.Equals(type)) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Content.Contains(filter) || x.SendUserName.Contains(filter)) - .OrderBy(sorting ?? nameof(GroupMessage.MessageId)) + .OrderBy(sorting) .PageBy(skipCount, maxResultCount) .AsNoTracking() .ToListAsync(GetCancellationToken(cancellationToken)); @@ -181,7 +223,7 @@ namespace LINGYUN.Abp.MessageService.Chat CancellationToken cancellationToken = default) { var userMessagesCount = await DbContext.Set() - .Where(x => (x.CreatorId.Equals(sendUserId) && x.ReceiveUserId.Equals(receiveUserId)) | + .Where(x => (x.CreatorId.Equals(sendUserId) && x.ReceiveUserId.Equals(receiveUserId)) || x.CreatorId.Equals(receiveUserId) && x.ReceiveUserId.Equals(sendUserId)) .WhereIf(type != null, x => x.Type.Equals(type)) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Content.Contains(filter) || x.SendUserName.Contains(filter)) diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs index a656d9977..b3da8b1f7 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs @@ -27,6 +27,41 @@ namespace LINGYUN.Abp.MessageService.Chat .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } + public virtual async Task> GetAllMembersAsync( + Guid userId, + string sorting = nameof(UserChatFriend.RemarkName), + bool reverse = false, + CancellationToken cancellationToken = default) + { + sorting = reverse ? sorting + " DESC" : sorting; + var userFriendQuery = from ucf in DbContext.Set() + join ucc in DbContext.Set() + on ucf.FrientId equals ucc.UserId + where ucf.UserId == userId + select new UserFriend + { + Age = ucc.Age, + AvatarUrl = ucc.AvatarUrl, + Birthday = ucc.Birthday, + Black = ucf.Black, + Description = ucc.Description, + DontDisturb = ucf.DontDisturb, + FriendId = ucf.FrientId, + NickName = ucc.NickName, + RemarkName = ucf.RemarkName ?? ucc.NickName, + Sex = ucc.Sex, + Sign = ucc.Sign, + SpecialFocus = ucf.SpecialFocus, + TenantId = ucf.TenantId, + UserId = ucf.UserId, + UserName = ucc.UserName + }; + + return await userFriendQuery + .OrderBy(sorting ?? $"{nameof(UserChatFriend.RemarkName)} DESC") + .ToListAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task GetMemberAsync(Guid userId, Guid friendId, CancellationToken cancellationToken = default) { var userFriendQuery = from ucf in DbContext.Set() @@ -58,6 +93,7 @@ namespace LINGYUN.Abp.MessageService.Chat public virtual async Task> GetMembersAsync(Guid userId, string filter = "", string sorting = nameof(UserChatFriend.UserId), bool reverse = false, int skipCount = 0, int maxResultCount = 10, CancellationToken cancellationToken = default) { + sorting = reverse ? sorting + " desc" : sorting; // 过滤用户资料 var userChatCardQuery = DbContext.Set() .WhereIf(!filter.IsNullOrWhiteSpace(), ucc => ucc.UserName.Contains(filter) || ucc.NickName.Contains(filter)); diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/ChatController.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/ChatController.cs index 374b8631a..24c790083 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/ChatController.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/ChatController.cs @@ -21,30 +21,37 @@ namespace LINGYUN.Abp.MessageService.Chat [HttpPost] [Route("groups/join")] - public virtual async Task ApplyJoinGroupAsync(UserJoinGroupDto userJoinGroup) + public virtual async Task ApplyJoinGroupAsync(UserJoinGroupDto input) { - await _chatAppService.ApplyJoinGroupAsync(userJoinGroup); + await _chatAppService.ApplyJoinGroupAsync(input); } [HttpGet] - [Route("messages/group")] - public virtual async Task> GetGroupMessageAsync(GroupMessageGetByPagedDto groupMessageGetByPaged) + [Route("group/messages")] + public virtual async Task> GetGroupMessageAsync(GroupMessageGetByPagedDto input) { - return await _chatAppService.GetGroupMessageAsync(groupMessageGetByPaged); + return await _chatAppService.GetGroupMessageAsync(input); } [HttpGet] [Route("groups/users")] - public virtual async Task> GetGroupUsersAsync(GroupUserGetByPagedDto groupUserGetByPaged) + public virtual async Task> GetGroupUsersAsync(GroupUserGetByPagedDto input) { - return await _chatAppService.GetGroupUsersAsync(groupUserGetByPaged); + return await _chatAppService.GetGroupUsersAsync(input); } [HttpGet] - [Route("messages/me")] - public virtual async Task> GetMyChatMessageAsync(UserMessageGetByPagedDto userMessageGetByPaged) + [Route("my-messages")] + public virtual async Task> GetMyChatMessageAsync(UserMessageGetByPagedDto input) { - return await _chatAppService.GetMyChatMessageAsync(userMessageGetByPaged); + return await _chatAppService.GetMyChatMessageAsync(input); + } + + [HttpGet] + [Route("my-last-messages")] + public virtual async Task> GetMyLastChatMessageAsync(GetUserLastMessageDto input) + { + return await _chatAppService.GetMyLastChatMessageAsync(input); } [HttpGet] @@ -56,23 +63,23 @@ namespace LINGYUN.Abp.MessageService.Chat [HttpPost] [Route("groups/users/accept")] - public virtual async Task GroupAcceptUserAsync(GroupAcceptUserDto groupAcceptUser) + public virtual async Task GroupAcceptUserAsync(GroupAcceptUserDto input) { - await _chatAppService.GroupAcceptUserAsync(groupAcceptUser); + await _chatAppService.GroupAcceptUserAsync(input); } [HttpDelete] [Route("groups/users/remove")] - public virtual async Task GroupRemoveUserAsync(GroupRemoveUserDto groupRemoveUser) + public virtual async Task GroupRemoveUserAsync(GroupRemoveUserDto input) { - await _chatAppService.GroupRemoveUserAsync(groupRemoveUser); + await _chatAppService.GroupRemoveUserAsync(input); } [HttpGet] - [Route("messages/send")] - public virtual async Task SendMessageAsync(ChatMessage chatMessage) + [Route("send-message")] + public virtual async Task SendMessageAsync(ChatMessage input) { - return await _chatAppService.SendMessageAsync(chatMessage); + return await _chatAppService.SendMessageAsync(input); } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/MyFriendController.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/MyFriendController.cs index fafcf3531..bbb24a1e5 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/MyFriendController.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/MyFriendController.cs @@ -31,16 +31,16 @@ namespace LINGYUN.Abp.MessageService.Chat } [HttpGet] - [Route("last-contacts")] - public virtual async Task> GetLastContactFriendsAsync(PagedResultRequestDto input) + [Route("all")] + public virtual async Task> GetAllListAsync(GetMyFriendsDto input) { - return await MyFriendAppService.GetLastContactFriendsAsync(input); + return await MyFriendAppService.GetAllListAsync(input); } [HttpGet] - public virtual async Task> GetMyFriendsAsync(MyFriendGetByPagedDto input) + public virtual async Task> GetListAsync(MyFriendGetByPagedDto input) { - return await MyFriendAppService.GetMyFriendsAsync(input); + return await MyFriendAppService.GetListAsync(input); } } } diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db index 87685da6af7d5afcf08444e168eb8ba40fcd4e6d..40ba6aaa23602db89128097f1b4125fac886eb9f 100644 GIT binary patch delta 822 zcmZXSzi-n(6vr=aR-6taNCQ0wl!yYtxt2nDHaDkPvRl%>D2WMWB$#1922 zDl65oLm4X}gd#B)iJ?Q6MrGh1U^eOk8|T_dOc*?T-}|2LbKm!RhgR>hEXI`?^=%Ed!MvAaEZz_YgVPC#7CqHkb+k1E$~Cs-R!?VRP z9x^HvWn4<>35f6t<`xm4A26Z!YgeK-Oqn)1k0QXtqVIFb(tx8Dr+`w4 z6ku)&@cWAiAoY<_PbkI|rzt=cm^ck!6dT8;!cAjpE>DqwCx? zhU=9F?>@b}6B65q%SLRz&4#2nV`t)Z4M`yu(Q0s)1&XM6;2Kp(!$A? zt)u8p@QqM%i_m?)m&buq7_@Bc6b?+M-x*@9eZ%yRF^1=k!Xc@~Q|2o3kmoSzUc|eBGVa-j-1qfl3?A z-RXSC{l2_7xwZXlqbi<^A2bZCWXAoeG;7^P5RPw5|HF-sCY)KV889*J3=^g;HvnU2 zgajXQj{8H7kKb4NZh7r>WQ|qQfY2zFIx|?#A3=0m>kCsMlZFu!G+?+E1H+5wnTcRr z$SF7D8Ekt diff --git a/vueJs/src/api/instant-message.ts b/vueJs/src/api/instant-message.ts index 29ff4eb55..f95129b1e 100644 --- a/vueJs/src/api/instant-message.ts +++ b/vueJs/src/api/instant-message.ts @@ -1,9 +1,14 @@ import ApiService from './serviceBase' -import { PagedResultDto, PagedAndSortedResultRequestDto, PagedResultRequestDto } from './types' +import { PagedResultDto, PagedAndSortedResultRequestDto, ListResultDto } from './types' const serviceUrl = process.env.VUE_APP_BASE_API export default class ImApiService { + public static addFriend(payload: AddUserFriend) { + const _url = '/api/im/my-friends' + return ApiService.Post(_url, payload, serviceUrl) + } + public static getMyFriends(payload: MyFriendGetByPaged) { let _url = '/api/im/my-friends' _url += '?filter=' + payload.filter @@ -14,8 +19,23 @@ export default class ImApiService { return ApiService.Get>(_url, serviceUrl) } + public static getMyAllFriends(payload: MyFrientGetAll) { + let _url = '/api/im/my-friends/all' + _url += '?sorting=' + payload.sorting + _url += '&reverse=' + payload.reverse + return ApiService.Get>(_url, serviceUrl) + } + + public static getMyLastMessages(payload: GetUserLastMessage) { + let _url = '/api/im/chat/my-last-messages' + _url += '?sorting=' + payload.sorting + _url += '&reverse=' + payload.reverse + _url += '&maxResultCount=' + payload.maxResultCount + return ApiService.Get>(_url, serviceUrl) + } + public static getMyChatMessages(payload: UserMessageGetByPaged) { - let _url = '/api/im/chat/messages/me' + let _url = '/api/im/chat/my-messages' _url += '?receiveUserId=' + payload.receiveUserId _url += '&messageType=' + payload.messageType _url += '&filter=' + payload.filter @@ -27,6 +47,19 @@ export default class ImApiService { } } +export class AddUserFriend { + friendId!: string + remarkName!: string + + constructor( + friendId: string, + remarkName: string + ) { + this.friendId = friendId + this.remarkName = remarkName + } +} + export enum Sex { Male, @@ -62,6 +95,17 @@ export class MyFriendGetByPaged extends PagedAndSortedResultRequestDto { reverse = false } +export class MyFrientGetAll { + sorting = 'UserName' + reverse = false +} + +export class GetUserLastMessage { + sorting = 'SendTime' + reverse = false + maxResultCount = 10 +} + export class UserMessageGetByPaged extends PagedAndSortedResultRequestDto { filter = '' messageType = MessageType.Text diff --git a/vueJs/src/api/user-lookup.ts b/vueJs/src/api/user-lookup.ts new file mode 100644 index 000000000..645fe10ad --- /dev/null +++ b/vueJs/src/api/user-lookup.ts @@ -0,0 +1,16 @@ +import ApiService from './serviceBase' +import { ListResultDto } from './types' +import { User } from './users' + +const IdentityServiceUrl = process.env.VUE_APP_BASE_API + +export default class UserLookupApiService { + public static searchUsers(filter = '', sorting = 'UserName', skipCount = 0, maxResultCount = 10) { + let _url = '/api/identity/users/lookup/search' + _url += '?filter=' + filter + _url += '&sorting=' + sorting + _url += '&skipCount=' + skipCount + _url += '&maxResultCount=' + maxResultCount + return ApiService.Get>(_url, IdentityServiceUrl) + } +} diff --git a/vueJs/src/components/InstantMessage/components/AddFriend.vue b/vueJs/src/components/InstantMessage/components/AddFriend.vue new file mode 100644 index 000000000..fe02efacd --- /dev/null +++ b/vueJs/src/components/InstantMessage/components/AddFriend.vue @@ -0,0 +1,182 @@ + + + + + diff --git a/vueJs/src/components/InstantMessage/index.vue b/vueJs/src/components/InstantMessage/index.vue index 1236c44bc..64f2568fa 100644 --- a/vueJs/src/components/InstantMessage/index.vue +++ b/vueJs/src/components/InstantMessage/index.vue @@ -1,48 +1,40 @@ diff --git a/vueJs/src/mixins/EventBusMiXin.ts b/vueJs/src/mixins/EventBusMiXin.ts index af6fb439e..547765407 100644 --- a/vueJs/src/mixins/EventBusMiXin.ts +++ b/vueJs/src/mixins/EventBusMiXin.ts @@ -61,6 +61,6 @@ export default class EventBusMiXin extends Vue { * @param args 事件参数列表 */ protected trigger(name: string, ...args: any[]) { - this.$events.emit(name, args) + this.$events.emit(name, ...args) } } From 689d126c3e78b11fa2301559087a7f6372f27b8b Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Thu, 29 Oct 2020 11:50:52 +0800 Subject: [PATCH 06/10] Optimize instant messaging module --- aspnet-core/LINGYUN.MicroService.sln | 9 +- .../Abp/IM/SignalR/AbpIMSignalRModule.cs | 4 +- .../Abp/IM/SignalR/Hubs/MessagesHub.cs | 90 ++++-- .../SignalR/Messages/SignalRMessageSender.cs | 79 ++--- .../LINGYUN/Abp/IM/Contract/IFriendStore.cs | 16 +- .../Abp/IM/Contract/UserAddFriendResult.cs | 12 + .../Abp/IM/Contract/UserFriendStatus.cs | 14 + .../LINGYUN/Abp/IM/Group/IUserGroupStore.cs | 8 + .../LINGYUN/Abp/IM/Messages/ChatMessage.cs | 70 +++- .../Abp/IM/Messages/MessageSenderBase.cs | 47 +++ .../LINGYUN/Abp/IM/Messages/MessageType.cs | 22 +- .../Abp/IM/Messages/NullMessageSender.cs | 26 ++ .../SignalR/AbpNotificationsSignalRModule.cs | 4 +- .../SignalR/Hubs/NotificationsHub.cs | 24 +- .../SignalR/OnlineClientHubBase.cs | 82 ----- .../SignalRNotificationPublishProvider.cs | 51 ++- .../Abp/Notifications/NotificationData.cs | 11 +- .../LINGYUN.Abp.RealTime.SignalR/Class1.cs | 8 + .../LINGYUN.Abp.RealTime.SignalR.csproj | 18 ++ .../SignalR/AbpRealTimeSignalRModule.cs | 11 + .../SignalR/Hubs}/OnlineClientHubBase.cs | 31 +- ...essageService.Application.Contracts.csproj | 4 + .../MessageService/Chat/IChatAppService.cs | 63 ++-- .../Abp/MessageService/Chat/ChatAppService.cs | 124 ++++--- .../MessageService/Chat/MyFriendAppService.cs | 2 +- .../MessageService/Chat/UserChatFriendEto.cs | 23 ++ .../{Chat => Group}/ChatGroupConsts.cs | 2 +- .../MessageServiceErrorCodes.cs | 87 ++++- .../LINGYUN.Abp.MessageService.Domain.csproj | 1 + .../AbpMessageServiceDomainModule.cs | 2 + .../Chat/ChatNotificationNames.cs | 14 + .../Abp/MessageService/Chat/FriendStore.cs | 83 ++++- .../MessageService/Chat/IMessageRepository.cs | 1 + .../Chat/IUserChatSettingRepository.cs | 10 +- .../Abp/MessageService/Chat/MessageStore.cs | 39 ++- .../Abp/MessageService/Chat/UserChatBlack.cs | 32 -- .../Abp/MessageService/Chat/UserChatFriend.cs | 25 +- .../Chat/UserChatFriendGroup.cs | 2 - .../Chat/UserFriendCacheItem.cs | 27 ++ .../MessageService/Chat/UserSpecialFocus.cs | 32 -- .../Local/UserChatFriendEventHandler.cs | 84 +++++ .../{Chat => Group}/ChatGroup.cs | 2 +- .../{Chat => Group}/GroupChatBlack.cs | 2 +- .../{Chat => Group}/GroupMessage.cs | 3 +- .../{Chat => Group}/IGroupRepository.cs | 4 +- .../Group/IGroupRepositoryExtensions.cs | 19 ++ .../IUserChatGroupRepository.cs | 6 +- .../{Chat => Group}/UserChatGroup.cs | 2 +- .../{Chat => Group}/UserGroupCard.cs | 2 +- .../{Chat => Group}/UserGroupStore.cs | 14 +- .../Localization/Resources/en.json | 24 +- .../Localization/Resources/zh-Hans.json | 24 +- .../Chat/EfCoreMessageRepository.cs | 6 +- .../Chat/EfCoreUserChatFriendRepository.cs | 14 +- .../Chat/EfCoreUserChatGroupRepository.cs | 305 ------------------ .../Chat/EfCoreUserChatSettingRepository.cs | 8 +- ...ServiceDbContextModelCreatingExtensions.cs | 25 +- .../{Chat => Group}/EfCoreGroupRepository.cs | 4 +- .../Group/EfCoreUserChatGroupRepository.cs | 166 ++++++++++ .../Abp/MessageService/Chat/ChatController.cs | 42 +-- .../LINGYUN.ApiGateway.Host/event-bus-cap.db | Bin 40960 -> 40960 bytes ...eatures.LimitValidation.Redis.Tests.csproj | 2 +- ....Abp.Features.LimitValidation.Tests.csproj | 2 +- vueJs/src/components/InstantMessage/index.vue | 81 +++-- vueJs/src/components/Notification/index.vue | 3 + 65 files changed, 1210 insertions(+), 844 deletions(-) create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserAddFriendResult.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserFriendStatus.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSenderBase.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/NullMessageSender.cs delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/OnlineClientHubBase.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/Class1.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN.Abp.RealTime.SignalR.csproj create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN/Abp/RealTime/SignalR/AbpRealTimeSignalRModule.cs rename aspnet-core/modules/common/{LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR => LINGYUN.Abp.RealTime.SignalR/LINGYUN/Abp/RealTime/SignalR/Hubs}/OnlineClientHubBase.cs (72%) create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Chat/UserChatFriendEto.cs rename aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/{Chat => Group}/ChatGroupConsts.cs (86%) create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatNotificationNames.cs delete mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatBlack.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserFriendCacheItem.cs delete mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserSpecialFocus.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserChatFriendEventHandler.cs rename aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/{Chat => Group}/ChatGroup.cs (97%) rename aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/{Chat => Group}/GroupChatBlack.cs (95%) rename aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/{Chat => Group}/GroupMessage.cs (87%) rename aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/{Chat => Group}/IGroupRepository.cs (90%) create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/IGroupRepositoryExtensions.cs rename aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/{Chat => Group}/IUserChatGroupRepository.cs (94%) rename aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/{Chat => Group}/UserChatGroup.cs (94%) rename aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/{Chat => Group}/UserGroupCard.cs (97%) rename aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/{Chat => Group}/UserGroupStore.cs (86%) delete mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatGroupRepository.cs rename aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/{Chat => Group}/EfCoreGroupRepository.cs (95%) create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Group/EfCoreUserChatGroupRepository.cs diff --git a/aspnet-core/LINGYUN.MicroService.sln b/aspnet-core/LINGYUN.MicroService.sln index 358dab774..8c07c2fe9 100644 --- a/aspnet-core/LINGYUN.MicroService.sln +++ b/aspnet-core/LINGYUN.MicroService.sln @@ -251,7 +251,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.PermissionManag EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Account.Web", "modules\account\LINGYUN.Abp.Account.Web\LINGYUN.Abp.Account.Web.csproj", "{5F43141B-6C63-4547-B9D6-D69EC3D7CA7E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.AspNetCore.SignalR.JwtToken", "modules\common\LINGYUN.Abp.AspNetCore.SignalR\LINGYUN.Abp.AspNetCore.SignalR.JwtToken.csproj", "{A66D48C9-F141-4111-9169-CEB64AFFF61D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.AspNetCore.SignalR.JwtToken", "modules\common\LINGYUN.Abp.AspNetCore.SignalR\LINGYUN.Abp.AspNetCore.SignalR.JwtToken.csproj", "{A66D48C9-F141-4111-9169-CEB64AFFF61D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.RealTime.SignalR", "modules\common\LINGYUN.Abp.RealTime.SignalR\LINGYUN.Abp.RealTime.SignalR.csproj", "{524276E1-053D-4191-ABF7-4CDA01BFFBC3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -671,6 +673,10 @@ Global {A66D48C9-F141-4111-9169-CEB64AFFF61D}.Debug|Any CPU.Build.0 = Debug|Any CPU {A66D48C9-F141-4111-9169-CEB64AFFF61D}.Release|Any CPU.ActiveCfg = Release|Any CPU {A66D48C9-F141-4111-9169-CEB64AFFF61D}.Release|Any CPU.Build.0 = Release|Any CPU + {524276E1-053D-4191-ABF7-4CDA01BFFBC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {524276E1-053D-4191-ABF7-4CDA01BFFBC3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {524276E1-053D-4191-ABF7-4CDA01BFFBC3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {524276E1-053D-4191-ABF7-4CDA01BFFBC3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -798,6 +804,7 @@ Global {2D377D3A-70EC-4BB3-9F4C-6C933693DA98} = {52B5D4F7-237B-4E0A-A167-68442164F70A} {5F43141B-6C63-4547-B9D6-D69EC3D7CA7E} = {9E72FEB9-A626-4312-892B-CDD043879758} {A66D48C9-F141-4111-9169-CEB64AFFF61D} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} + {524276E1-053D-4191-ABF7-4CDA01BFFBC3} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/AbpIMSignalRModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/AbpIMSignalRModule.cs index 1708965fd..4eaf55790 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/AbpIMSignalRModule.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/AbpIMSignalRModule.cs @@ -1,12 +1,12 @@ using LINGYUN.Abp.AspNetCore.SignalR.JwtToken; -using LINGYUN.Abp.RealTime; +using LINGYUN.Abp.RealTime.SignalR; using Volo.Abp.AspNetCore.SignalR; using Volo.Abp.Modularity; namespace LINGYUN.Abp.IM.SignalR { [DependsOn( - typeof(AbpRealTimeModule), + typeof(AbpRealTimeSignalRModule), typeof(AbpAspNetCoreSignalRModule), typeof(AbpAspNetCoreSignalRJwtTokenModule))] public class AbpIMSignalRModule : AbpModule 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 3d1d255b8..014a9032e 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 @@ -1,11 +1,16 @@ using LINGYUN.Abp.IM.Contract; +using LINGYUN.Abp.IM.Group; using LINGYUN.Abp.IM.Messages; using LINGYUN.Abp.RealTime.Client; +using LINGYUN.Abp.RealTime.SignalR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.SignalR; using Microsoft.Extensions.Logging; using System; +using System.Collections.Immutable; +using System.Linq; using System.Threading.Tasks; +using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Users; @@ -16,13 +21,72 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs { protected IFriendStore FriendStore { get; } protected IMessageStore MessageStore { get; } + protected IUserGroupStore UserGroupStore { get; } public MessagesHub( IFriendStore friendStore, - IMessageStore messageStore) + IMessageStore messageStore, + IUserGroupStore userGroupStore) { FriendStore = friendStore; MessageStore = messageStore; + UserGroupStore = userGroupStore; + } + + protected override async Task OnClientConnectedAsync(IOnlineClient client) + { + // 加入通讯组 + 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); + if (groupClient != null) + { + // 发送用户上线通知 + await groupClient.SendAsync("onUserOnlined", client.TenantId, client.UserId.Value); + } + } + + // 发送好友上线通知 + var userFriends = await FriendStore.GetListAsync(client.TenantId, client.UserId.Value); + if (userFriends.Count > 0) + { + var friendClientIds = userFriends.Select(friend => friend.FriendId.ToString()).ToImmutableArray(); + var userClients = Clients.Users(friendClientIds); + if (userClients != null) + { + await userClients.SendAsync("onUserOnlined", client.TenantId, client.UserId.Value); + } + } + } + + protected override async Task OnClientDisconnectedAsync(IOnlineClient client) + { + // 从通讯组断开会话 + var userGroups = await UserGroupStore.GetUserGroupsAsync(client.TenantId, client.UserId.Value); + foreach (var group in userGroups) + { + await Groups.RemoveFromGroupAsync(client.ConnectionId, group.Name); + var groupClient = Clients.Group(group.Name); + if (groupClient != null) + { + // 发送用户下线指令 + await groupClient.SendAsync("onUserOfflined", client.TenantId, client.UserId.Value); + } + } + + // 发送好友下线通知 + var userFriends = await FriendStore.GetListAsync(client.TenantId, client.UserId.Value); + if (userFriends.Count > 0) + { + var friendClientIds = userFriends.Select(friend => friend.FriendId.ToString()).ToImmutableArray(); + var userClients = Clients.Users(friendClientIds); + if (userClients != null) + { + await userClients.SendAsync("onUserOfflined", client.TenantId, client.UserId.Value); + } + } } [HubMethodName("LastContactFriends")] @@ -116,23 +180,13 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs // 持久化 await MessageStore.StoreMessageAsync(chatMessage); - try + if (!chatMessage.GroupId.IsNullOrWhiteSpace()) { - if (!chatMessage.GroupId.IsNullOrWhiteSpace()) - { - await SendMessageToGroupAsync(chatMessage); - } - else - { - await SendMessageToUserAsync(chatMessage); - } + await SendMessageToGroupAsync(chatMessage); } - catch (Exception ex) + else { - Logger.LogWarning("Could not send message, group: {0}, formUser: {1}, toUser: {2}", - chatMessage.GroupId, chatMessage.FormUserName, - chatMessage.ToUserId.HasValue ? chatMessage.ToUserId.ToString() : "None"); - Logger.LogWarning("Send group message error: {0}", ex.Message); + await SendMessageToUserAsync(chatMessage); } } @@ -153,11 +207,6 @@ 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 @@ -172,6 +221,7 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs } catch (Exception ex) { + // 发送异常记录就行了,因为消息已经持久化 Logger.LogWarning("Could not send message to user: {0}", chatMessage.ToUserId); Logger.LogWarning("Send to user message error: {0}", ex.Message); } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSender.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSender.cs index dc804e5c6..705649860 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSender.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSender.cs @@ -2,66 +2,36 @@ using LINGYUN.Abp.IM.SignalR.Hubs; using LINGYUN.Abp.RealTime.Client; using Microsoft.AspNetCore.SignalR; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; using System; +using System.Collections.Immutable; +using System.Linq; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; namespace LINGYUN.Abp.IM.SignalR.Messages { - public class SignalRMessageSender : IMessageSender, ITransientDependency + [Dependency(ServiceLifetime.Transient, ReplaceServices = true)] + [ExposeServices(typeof(IMessageSender))] + public class SignalRMessageSender : MessageSenderBase { - public ILogger Logger { protected get; set; } - private readonly IOnlineClientManager _onlineClientManager; private readonly IHubContext _hubContext; - private readonly IMessageStore _messageStore; - public SignalRMessageSender( IOnlineClientManager onlineClientManager, IHubContext hubContext, - IMessageStore messageStore) + IMessageStore messageStore, + ILogger logger) + : base(messageStore, logger) { _hubContext = hubContext; - _messageStore = messageStore; _onlineClientManager = onlineClientManager; - - Logger = NullLogger.Instance; } - /// - /// 服务端调用发送消息方法 - /// - /// - /// - public async Task SendMessageAsync(ChatMessage chatMessage) - { - // 持久化 - await _messageStore.StoreMessageAsync(chatMessage); - try - { - if (!chatMessage.GroupId.IsNullOrWhiteSpace()) - { - await SendMessageToGroupAsync(chatMessage); - } - else - { - await SendMessageToUserAsync(chatMessage); - } - } - catch (Exception ex) - { - Logger.LogWarning("Could not send message, group: {0}, formUser: {1}, toUser: {2}", - chatMessage.GroupId, chatMessage.FormUserName, - chatMessage.ToUserId.HasValue ? chatMessage.ToUserId.ToString() : "None"); - Logger.LogWarning("Send group message error: {0}", ex.Message); - } - } - - protected virtual async Task SendMessageToGroupAsync(ChatMessage chatMessage) + protected override async Task SendMessageToGroupAsync(ChatMessage chatMessage) { var signalRClient = _hubContext.Clients.Group(chatMessage.GroupId); if (signalRClient == null) @@ -73,28 +43,25 @@ namespace LINGYUN.Abp.IM.SignalR.Messages await signalRClient.SendAsync("getChatMessage", chatMessage); } - protected virtual async Task SendMessageToUserAsync(ChatMessage chatMessage) + protected override async Task SendMessageToUserAsync(ChatMessage chatMessage) { var onlineClientContext = new OnlineClientContext(chatMessage.TenantId, chatMessage.ToUserId.Value); var onlineClients = _onlineClientManager.GetAllByContext(onlineClientContext); - foreach (var onlineClient in onlineClients) + try { - try + var onlineClientConnectionIds = onlineClients.Select(client => client.ConnectionId).ToImmutableArray(); + var signalRClients = _hubContext.Clients.Clients(onlineClientConnectionIds); + if (signalRClients == null) { - var signalRClient = _hubContext.Clients.Client(onlineClient.ConnectionId); - if (signalRClient == null) - { - Logger.LogDebug("Can not get user " + onlineClientContext.UserId + " with connectionId " + onlineClient.ConnectionId + " from SignalR hub!"); - continue; - } - - await signalRClient.SendAsync("getChatMessage", chatMessage); - } - catch (Exception ex) - { - Logger.LogWarning("Could not send message to user: {0}", chatMessage.ToUserId); - Logger.LogWarning("Send to user message error: {0}", ex.Message); + Logger.LogDebug("Can not get user " + onlineClientContext.UserId + " connection from SignalR hub!"); + return; } + await signalRClients.SendAsync("getChatMessage", chatMessage); + } + catch (Exception ex) + { + Logger.LogWarning("Could not send message to user: {0}", chatMessage.ToUserId); + Logger.LogWarning("Send to user message error: {0}", ex.Message); } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/IFriendStore.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/IFriendStore.cs index 98722ee80..8f0aae9ef 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/IFriendStore.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/IFriendStore.cs @@ -7,6 +7,18 @@ namespace LINGYUN.Abp.IM.Contract public interface IFriendStore { /// + /// 是否是好友关系 + /// + /// + /// + /// + /// + Task IsFriendAsync( + Guid? tenantId, + Guid userId, + Guid friendId + ); + /// /// 查询好友列表 /// /// @@ -42,7 +54,7 @@ namespace LINGYUN.Abp.IM.Contract /// /// /// - Task> GetListAsync( + Task> GetPagedListAsync( Guid? tenantId, Guid userId, string filter = "", @@ -82,7 +94,7 @@ namespace LINGYUN.Abp.IM.Contract /// /// /// - Task AddMemberAsync( + Task AddMemberAsync( Guid? tenantId, Guid userId, Guid friendId, diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserAddFriendResult.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserAddFriendResult.cs new file mode 100644 index 000000000..70d1c00ba --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserAddFriendResult.cs @@ -0,0 +1,12 @@ +namespace LINGYUN.Abp.IM.Contract +{ + public class UserAddFriendResult + { + public bool Successed => Status == UserFriendStatus.Added; + public UserFriendStatus Status { get; } + public UserAddFriendResult(UserFriendStatus status) + { + Status = status; + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserFriendStatus.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserFriendStatus.cs new file mode 100644 index 000000000..b9b7843d5 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/UserFriendStatus.cs @@ -0,0 +1,14 @@ +namespace LINGYUN.Abp.IM.Contract +{ + public enum UserFriendStatus : byte + { + /// + /// 需要验证 + /// + NeedValidation, + /// + /// 已添加 + /// + Added + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/IUserGroupStore.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/IUserGroupStore.cs index 670f55eba..d46dbf9ef 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/IUserGroupStore.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/IUserGroupStore.cs @@ -6,6 +6,14 @@ namespace LINGYUN.Abp.IM.Group { public interface IUserGroupStore { + /// + /// 成员是否在群组 + /// + /// + /// + /// + /// + Task MemberHasInGroupAsync(Guid? tenantId, long groupId, Guid userId); /// /// 获取群组用户身份 /// diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/ChatMessage.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/ChatMessage.cs index e5b51f37e..28a4aa492 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/ChatMessage.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/ChatMessage.cs @@ -1,29 +1,79 @@ using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using Volo.Abp.Auditing; +using Volo.Abp.ObjectExtending; namespace LINGYUN.Abp.IM.Messages { - public class ChatMessage + public class ChatMessage : ExtensibleObject { + /// + /// 租户 + /// public Guid? TenantId { get; set; } - + /// + /// 群组标识 + /// public string GroupId { get; set; } - + /// + /// 消息标识 + /// + /// + /// 调用者无需关注此字段,将由服务自动生成 + /// public string MessageId { get; set; } - + /// + /// 发送者标识 + /// public Guid FormUserId { get; set; } - + /// + /// 发送者名称 + /// public string FormUserName { get; set; } - + /// + /// 接收用户标识 + /// + /// + /// 设计为可空是为了兼容群聊消息 + /// /remarks> public Guid? ToUserId { get; set; } - + /// + /// 消息内容 + /// [DisableAuditing] public string Content { get; set; } - + /// + /// 发送时间 + /// public DateTime SendTime { get; set; } + /// + /// 是否匿名发送 + /// + public bool IsAnonymous { get; set; } + /// + /// 消息类型 + /// + public MessageType MessageType { get; set; } = MessageType.Text; - public bool IsAnonymous { get; set; } = false; + public override IEnumerable Validate(ValidationContext validationContext) + { + var results = ExtensibleObjectValidator.GetValidationErrors(this, validationContext); - public MessageType MessageType { get; set; } = MessageType.Text; + foreach (var result in ValidateReceiver(validationContext)) + { + results.Add(result); + } + + return results; + } + + protected virtual IEnumerable ValidateReceiver(ValidationContext validationContext) + { + if (GroupId.IsNullOrWhiteSpace() && !ToUserId.HasValue) + { + yield return new ValidationResult(""); + } + } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSenderBase.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSenderBase.cs new file mode 100644 index 000000000..f39a4c428 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSenderBase.cs @@ -0,0 +1,47 @@ +using Microsoft.Extensions.Logging; +using System; +using System.Threading.Tasks; + +namespace LINGYUN.Abp.IM.Messages +{ + public abstract class MessageSenderBase : IMessageSender + { + protected IMessageStore Store { get; } + protected ILogger Logger { get; } + protected MessageSenderBase( + IMessageStore store, + ILogger logger) + { + Store = store; + Logger = logger; + } + + public virtual async Task SendMessageAsync(ChatMessage chatMessage) + { + // 持久化 + await Store.StoreMessageAsync(chatMessage); + + try + { + if (!chatMessage.GroupId.IsNullOrWhiteSpace()) + { + await SendMessageToGroupAsync(chatMessage); + } + else + { + await SendMessageToUserAsync(chatMessage); + } + } + catch (Exception ex) + { + Logger.LogWarning("Could not send message, group: {0}, formUser: {1}, toUser: {2}", + chatMessage.GroupId, chatMessage.FormUserName, + chatMessage.ToUserId.HasValue ? chatMessage.ToUserId.ToString() : "None"); + Logger.LogWarning("Send group message error: {0}", ex.Message); + } + } + + protected abstract Task SendMessageToGroupAsync(ChatMessage chatMessage); + protected abstract Task SendMessageToUserAsync(ChatMessage chatMessage); + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageType.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageType.cs index eb9e6fb9f..f247d2d57 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageType.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageType.cs @@ -2,9 +2,29 @@ { public enum MessageType { + /// + /// 文本消息 + /// Text = 0, + /// + /// 图片消息 + /// Image = 10, + /// + /// 链接 + /// Link = 20, - Video = 30 + /// + /// 视频 + /// + Video = 30, + /// + /// 音频 + /// + Voice = 40, + /// + /// 文件 + /// + File = 50 } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/NullMessageSender.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/NullMessageSender.cs new file mode 100644 index 000000000..dd1469d1f --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/NullMessageSender.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.Logging; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace LINGYUN.Abp.IM.Messages +{ + public class NullMessageSender : MessageSenderBase, ITransientDependency + { + public NullMessageSender(IMessageStore store, ILogger logger) + : base(store, logger) + { + } + + protected override Task SendMessageToGroupAsync(ChatMessage chatMessage) + { + Logger.LogWarning("No IMessageSender Interface implementation!"); + return Task.CompletedTask; + } + + protected override Task SendMessageToUserAsync(ChatMessage chatMessage) + { + Logger.LogWarning("No IMessageSender Interface implementation!"); + return Task.CompletedTask; + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/AbpNotificationsSignalRModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/AbpNotificationsSignalRModule.cs index 130a9fd30..b75e6d564 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/AbpNotificationsSignalRModule.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/AbpNotificationsSignalRModule.cs @@ -1,12 +1,12 @@ using LINGYUN.Abp.AspNetCore.SignalR.JwtToken; -using LINGYUN.Abp.RealTime; +using LINGYUN.Abp.RealTime.SignalR; using Volo.Abp.AspNetCore.SignalR; using Volo.Abp.Modularity; namespace LINGYUN.Abp.Notifications.SignalR { [DependsOn( - typeof(AbpRealTimeModule), + typeof(AbpRealTimeSignalRModule), typeof(AbpNotificationModule), typeof(AbpAspNetCoreSignalRModule), typeof(AbpAspNetCoreSignalRJwtTokenModule))] diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/Hubs/NotificationsHub.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/Hubs/NotificationsHub.cs index 67f7c60e5..0b89ef241 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/Hubs/NotificationsHub.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/Hubs/NotificationsHub.cs @@ -1,4 +1,6 @@ -using Microsoft.AspNetCore.Authorization; +using LINGYUN.Abp.RealTime.Client; +using LINGYUN.Abp.RealTime.SignalR; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.SignalR; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; @@ -12,6 +14,24 @@ namespace LINGYUN.Abp.Notifications.SignalR.Hubs private INotificationStore _notificationStore; protected INotificationStore NotificationStore => LazyGetRequiredService(ref _notificationStore); + protected override async Task OnClientConnectedAsync(IOnlineClient client) + { + if (client.TenantId.HasValue) + { + // 以租户为分组,将用户加入租户通讯组 + await Groups.AddToGroupAsync(client.ConnectionId, client.TenantId.Value.ToString()); + } + } + + protected override async Task OnClientDisconnectedAsync(IOnlineClient client) + { + if (client.TenantId.HasValue) + { + // 以租户为分组,将移除租户通讯组 + await Groups.RemoveFromGroupAsync(client.ConnectionId, client.TenantId.Value.ToString()); + } + } + [HubMethodName("GetNotification")] public virtual async Task> GetNotificationAsync( NotificationReadState readState = NotificationReadState.UnRead, int maxResultCount = 10) @@ -26,7 +46,5 @@ namespace LINGYUN.Abp.Notifications.SignalR.Hubs { await NotificationStore.ChangeUserNotificationReadStateAsync(CurrentTenant.Id, CurrentUser.GetId(), long.Parse(id), readState); } - - } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/OnlineClientHubBase.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/OnlineClientHubBase.cs deleted file mode 100644 index f091ecf06..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/OnlineClientHubBase.cs +++ /dev/null @@ -1,82 +0,0 @@ -using LINGYUN.Abp.RealTime.Client; -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.Logging; -using System; -using System.Threading.Tasks; -using Volo.Abp.AspNetCore.SignalR; -using Volo.Abp.Security.Claims; - -namespace LINGYUN.Abp.Notifications.SignalR -{ - public abstract class OnlineClientHubBase : AbpHub - { - private ICurrentPrincipalAccessor _currentPrincipalAccessor; - protected ICurrentPrincipalAccessor CurrentPrincipalAccessor => LazyGetRequiredService(ref _currentPrincipalAccessor); - - private IOnlineClientManager _onlineClientManager; - protected IOnlineClientManager OnlineClientManager => LazyGetRequiredService(ref _onlineClientManager); - - private IHttpContextAccessor _httpContextAccessor; - protected IHttpContextAccessor HttpContextAccessor => LazyGetRequiredService(ref _httpContextAccessor); - - public override async Task OnConnectedAsync() - { - await base.OnConnectedAsync(); - IOnlineClient onlineClient = CreateClientForCurrentConnection(); - Logger.LogDebug("A client is connected: " + onlineClient.ToString()); - OnlineClientManager.Add(onlineClient); - if (onlineClient.TenantId.HasValue) - { - // 以租户为分组,将用户加入租户通讯组 - await Groups.AddToGroupAsync(onlineClient.ConnectionId, onlineClient.TenantId.Value.ToString()); - } - } - - public override async Task OnDisconnectedAsync(Exception exception) - { - await base.OnDisconnectedAsync(exception); - Logger.LogDebug("A client is disconnected: " + Context.ConnectionId); - try - { - // 从通讯组移除 - var onlineClient = OnlineClientManager.GetByConnectionIdOrNull(Context.ConnectionId); - if(onlineClient != null) - { - // 移除在线客户端 - OnlineClientManager.Remove(Context.ConnectionId); - } - } - catch (Exception ex) - { - Logger.LogWarning(ex.ToString(), ex); - } - } - - protected virtual IOnlineClient CreateClientForCurrentConnection() - { - // abp框架没有处理,需要切换一下用户身份令牌.否则无法获取用户信息 - using (CurrentPrincipalAccessor.Change(Context.User)) - { - return new OnlineClient(Context.ConnectionId, GetClientIpAddress(), - CurrentTenant.Id, CurrentUser.Id) - { - ConnectTime = Clock.Now, - UserName = CurrentUser.UserName - }; - } - } - - protected virtual string GetClientIpAddress() - { - try - { - return HttpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(); - } - catch (Exception ex) - { - Logger.LogException(ex, LogLevel.Warning); - return null; - } - } - } -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/SignalRNotificationPublishProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/SignalRNotificationPublishProvider.cs index 0bfa29e70..505af781c 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/SignalRNotificationPublishProvider.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/SignalRNotificationPublishProvider.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.SignalR; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using System.Threading.Tasks; @@ -53,26 +54,44 @@ namespace LINGYUN.Abp.Notifications.SignalR Logger.LogDebug($"Find online client with user {identifier.UserId} - {identifier.UserName}"); var onlineClientContext = new OnlineClientContext(notification.TenantId, identifier.UserId); var onlineClients = _onlineClientManager.GetAllByContext(onlineClientContext); - foreach (var onlineClient in onlineClients) + var onlineClientConnectionIds = onlineClients.Select(client => client.ConnectionId).ToImmutableArray(); + try { - try + var signalRClients = _hubContext.Clients.Clients(onlineClientConnectionIds); + if (signalRClients == null) { - Logger.LogDebug($"Find online client {onlineClient.UserId} - {onlineClient.ConnectionId}"); - var signalRClient = _hubContext.Clients.Client(onlineClient.ConnectionId); - if (signalRClient == null) - { - Logger.LogDebug("Can not get user " + onlineClientContext.UserId + " with connectionId " + onlineClient.ConnectionId + " from SignalR hub!"); - continue; - } - Logger.LogDebug($"Found a singalr client, begin senging notifications"); - await signalRClient.SendAsync("getNotification", notification); - } - catch (Exception ex) - { - Logger.LogWarning("Could not send notifications to user: {0}", identifier.UserId); - Logger.LogWarning("Send to user notifications error: {0}", ex.Message); + Logger.LogDebug("Can not get user " + onlineClientContext.UserId + " connection from SignalR hub!"); + return; } + Logger.LogDebug($"Found a singalr client, begin senging notifications"); + await signalRClients.SendAsync("getNotification", notification); } + catch (Exception ex) + { + Logger.LogWarning("Could not send notifications to user: {0}", identifier.UserId); + Logger.LogWarning("Send to user notifications error: {0}", ex.Message); + } + + //foreach (var onlineClient in onlineClients) + //{ + // try + // { + // Logger.LogDebug($"Find online client {onlineClient.UserId} - {onlineClient.ConnectionId}"); + // var signalRClient = _hubContext.Clients.Client(onlineClient.ConnectionId); + // if (signalRClient == null) + // { + // Logger.LogDebug("Can not get user " + onlineClientContext.UserId + " with connectionId " + onlineClient.ConnectionId + " from SignalR hub!"); + // continue; + // } + // Logger.LogDebug($"Found a singalr client, begin senging notifications"); + // await signalRClient.SendAsync("getNotification", notification); + // } + // catch (Exception ex) + // { + // Logger.LogWarning("Could not send notifications to user: {0}", identifier.UserId); + // Logger.LogWarning("Send to user notifications error: {0}", ex.Message); + // } + //} } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationData.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationData.cs index c9955adba..7548d8d0b 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationData.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationData.cs @@ -3,6 +3,13 @@ using System.Collections.Generic; namespace LINGYUN.Abp.Notifications { + /// + /// 通知数据 + /// + /// + /// TODO: 2020-10-29 针对不同语言的用户,如果在发布时期就本地化语言是错误的设计 + /// 把通知的标题和内容设计为 让客户端自行本地化 + /// public class NotificationData { public const string NotificationKey = "N:G"; @@ -153,14 +160,14 @@ namespace LINGYUN.Abp.Notifications public bool HasUserNotification(out Guid userId, out string userName) { + userName = ""; if (Properties.TryGetValue(UserIdNotificationKey, out object userKey)) { userId = (Guid)userKey; var name = TryGetData(UserNameNotificationKey); - userName = name != null ? name.ToString() : ""; + userName = name?.ToString() ?? userName; return true; } - userName = ""; return false; } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/Class1.cs b/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/Class1.cs new file mode 100644 index 000000000..06fc047ee --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/Class1.cs @@ -0,0 +1,8 @@ +using System; + +namespace LINGYUN.Abp.RealTime.SignalR +{ + public class Class1 + { + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN.Abp.RealTime.SignalR.csproj b/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN.Abp.RealTime.SignalR.csproj new file mode 100644 index 000000000..a9ebaa946 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN.Abp.RealTime.SignalR.csproj @@ -0,0 +1,18 @@ + + + + + + netcoreapp3.1 + + + + + + + + + + + + diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN/Abp/RealTime/SignalR/AbpRealTimeSignalRModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN/Abp/RealTime/SignalR/AbpRealTimeSignalRModule.cs new file mode 100644 index 000000000..3e8995e8d --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN/Abp/RealTime/SignalR/AbpRealTimeSignalRModule.cs @@ -0,0 +1,11 @@ +using Volo.Abp.AspNetCore.SignalR; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.RealTime.SignalR +{ + [DependsOn( + typeof(AbpAspNetCoreSignalRModule))] + public class AbpRealTimeSignalRModule : AbpModule + { + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/OnlineClientHubBase.cs b/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN/Abp/RealTime/SignalR/Hubs/OnlineClientHubBase.cs similarity index 72% rename from aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/OnlineClientHubBase.cs rename to aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN/Abp/RealTime/SignalR/Hubs/OnlineClientHubBase.cs index 0d9d2aac9..c8d6f3307 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/OnlineClientHubBase.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN/Abp/RealTime/SignalR/Hubs/OnlineClientHubBase.cs @@ -1,18 +1,14 @@ -using LINGYUN.Abp.IM.Group; -using LINGYUN.Abp.RealTime.Client; +using LINGYUN.Abp.RealTime.Client; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using System; using System.Threading.Tasks; using Volo.Abp.AspNetCore.SignalR; -namespace LINGYUN.Abp.IM.SignalR +namespace LINGYUN.Abp.RealTime.SignalR { public abstract class OnlineClientHubBase : AbpHub { - private IUserGroupStore _userGroupStore; - protected IUserGroupStore UserGroupStore => LazyGetRequiredService(ref _userGroupStore); - private IOnlineClientManager _onlineClientManager; protected IOnlineClientManager OnlineClientManager => LazyGetRequiredService(ref _onlineClientManager); @@ -25,12 +21,7 @@ namespace LINGYUN.Abp.IM.SignalR IOnlineClient onlineClient = CreateClientForCurrentConnection(); Logger.LogDebug("A client is connected: " + onlineClient.ToString()); OnlineClientManager.Add(onlineClient); - // 加入通讯组 - var userGroups = await UserGroupStore.GetUserGroupsAsync(onlineClient.TenantId, onlineClient.UserId.Value); - foreach(var group in userGroups) - { - await Groups.AddToGroupAsync(onlineClient.ConnectionId, group.Name); - } + await OnClientConnectedAsync(onlineClient); } public override async Task OnDisconnectedAsync(Exception exception) @@ -43,13 +34,9 @@ namespace LINGYUN.Abp.IM.SignalR var onlineClient = OnlineClientManager.GetByConnectionIdOrNull(Context.ConnectionId); if(onlineClient != null) { - var userGroups = await UserGroupStore.GetUserGroupsAsync(onlineClient.TenantId, onlineClient.UserId.Value); - foreach (var group in userGroups) - { - await Groups.RemoveFromGroupAsync(onlineClient.ConnectionId, group.Name); - } // 移除在线客户端 OnlineClientManager.Remove(Context.ConnectionId); + await OnClientDisconnectedAsync(onlineClient); } } catch (Exception ex) @@ -79,5 +66,15 @@ namespace LINGYUN.Abp.IM.SignalR return null; } } + + protected virtual Task OnClientConnectedAsync(IOnlineClient client) + { + return Task.CompletedTask; + } + + protected virtual Task OnClientDisconnectedAsync(IOnlineClient client) + { + return Task.CompletedTask; + } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN.Abp.MessageService.Application.Contracts.csproj b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN.Abp.MessageService.Application.Contracts.csproj index c6e46ad83..553cb00b1 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN.Abp.MessageService.Application.Contracts.csproj +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN.Abp.MessageService.Application.Contracts.csproj @@ -28,4 +28,8 @@ + + + + diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IChatAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IChatAppService.cs index f49837302..29425cf45 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IChatAppService.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IChatAppService.cs @@ -1,5 +1,4 @@ -using LINGYUN.Abp.IM.Group; -using LINGYUN.Abp.IM.Messages; +using LINGYUN.Abp.IM.Messages; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; @@ -14,41 +13,41 @@ namespace LINGYUN.Abp.MessageService.Chat /// /// Task SendMessageAsync(ChatMessage input); - /// - /// 申请加入群组 - /// - /// - /// - Task ApplyJoinGroupAsync(UserJoinGroupDto input); - /// - /// 获取我的群组 - /// - /// - Task> GetMyGroupsAsync(); - /// - /// 获取群组用户 - /// - /// - /// - Task> GetGroupUsersAsync(GroupUserGetByPagedDto input); - /// - /// 处理用户群组申请 - /// - /// - /// - Task GroupAcceptUserAsync(GroupAcceptUserDto input); - /// - /// 群组移除用户 - /// - /// - /// - Task GroupRemoveUserAsync(GroupRemoveUserDto input); + ///// + ///// 申请加入群组 + ///// + ///// + ///// + //Task ApplyJoinGroupAsync(UserJoinGroupDto input); + ///// + ///// 获取我的群组 + ///// + ///// + //Task> GetMyGroupsAsync(); + ///// + ///// 获取群组用户 + ///// + ///// + ///// + //Task> GetGroupUsersAsync(GroupUserGetByPagedDto input); + ///// + ///// 处理用户群组申请 + ///// + ///// + ///// + //Task GroupAcceptUserAsync(GroupAcceptUserDto input); + ///// + ///// 群组移除用户 + ///// + ///// + ///// + //Task GroupRemoveUserAsync(GroupRemoveUserDto input); /// /// 获取群组消息 /// /// /// - Task> GetGroupMessageAsync(GroupMessageGetByPagedDto input); + Task> GetMyGroupMessageAsync(GroupMessageGetByPagedDto input); /// /// 获取我的消息 /// diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/ChatAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/ChatAppService.cs index f3434c2f0..8883332ec 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/ChatAppService.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/ChatAppService.cs @@ -1,7 +1,6 @@ using LINGYUN.Abp.IM.Group; using LINGYUN.Abp.IM.Messages; using Microsoft.AspNetCore.Authorization; -using System.Collections.Immutable; using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Application.Dtos; @@ -50,9 +49,12 @@ namespace LINGYUN.Abp.MessageService.Chat return new ListResultDto(chatMessages); } - public virtual async Task> GetGroupMessageAsync(GroupMessageGetByPagedDto input) + public virtual async Task> GetMyGroupMessageAsync(GroupMessageGetByPagedDto input) { - // TODO: 增加验证,用户不在群组却来查询这个群组消息,是非法客户端操作 + if (! await _userGroupStore.MemberHasInGroupAsync(CurrentTenant.Id, input.GroupId, CurrentUser.GetId())) + { + throw new BusinessException(MessageServiceErrorCodes.YouHaveNotJoinedGroup); + } var groupMessageCount = await _messageStore .GetGroupMessageCountAsync(CurrentTenant.Id, input.GroupId, @@ -66,61 +68,61 @@ namespace LINGYUN.Abp.MessageService.Chat return new PagedResultDto(groupMessageCount, groupMessages); } - public virtual async Task> GetGroupUsersAsync(GroupUserGetByPagedDto input) - { - var groupUserCardCount = await _userGroupStore - .GetMembersCountAsync(CurrentTenant.Id, input.GroupId); - - var groupUserCards = await _userGroupStore.GetMembersAsync(CurrentTenant.Id, - input.GroupId, input.Sorting, input.Reverse, - input.SkipCount, input.MaxResultCount); - - return new PagedResultDto(groupUserCardCount, groupUserCards); - } - - [Authorize] - public virtual async Task> GetMyGroupsAsync() - { - var myGroups = await _userGroupStore.GetUserGroupsAsync(CurrentTenant.Id, CurrentUser.GetId()); - - return new ListResultDto(myGroups.ToImmutableList()); - } - - public virtual async Task GroupAcceptUserAsync(GroupAcceptUserDto input) - { - var myGroupCard = await _userGroupStore - .GetUserGroupCardAsync(CurrentTenant.Id, input.GroupId, CurrentUser.GetId()); - if (myGroupCard == null) - { - // 当前登录用户不再用户组 - throw new UserFriendlyException(""); - } - if (!myGroupCard.IsAdmin) - { - // 当前登录用户没有加人权限 - throw new UserFriendlyException(""); - } - await _userGroupStore - .AddUserToGroupAsync(CurrentTenant.Id, input.UserId, input.GroupId, CurrentUser.GetId()); - } - - public virtual async Task GroupRemoveUserAsync(GroupRemoveUserDto input) - { - var myGroupCard = await _userGroupStore - .GetUserGroupCardAsync(CurrentTenant.Id, input.GroupId, CurrentUser.GetId()); - if (myGroupCard == null) - { - // 当前登录用户不再用户组 - throw new UserFriendlyException(""); - } - if (!myGroupCard.IsAdmin) - { - // 当前登录用户没有踢人权限 - throw new UserFriendlyException(""); - } - await _userGroupStore - .RemoveUserFormGroupAsync(CurrentTenant.Id, input.UserId, input.GroupId); - } + //public virtual async Task> GetGroupUsersAsync(GroupUserGetByPagedDto input) + //{ + // var groupUserCardCount = await _userGroupStore + // .GetMembersCountAsync(CurrentTenant.Id, input.GroupId); + + // var groupUserCards = await _userGroupStore.GetMembersAsync(CurrentTenant.Id, + // input.GroupId, input.Sorting, input.Reverse, + // input.SkipCount, input.MaxResultCount); + + // return new PagedResultDto(groupUserCardCount, groupUserCards); + //} + + //[Authorize] + //public virtual async Task> GetMyGroupsAsync() + //{ + // var myGroups = await _userGroupStore.GetUserGroupsAsync(CurrentTenant.Id, CurrentUser.GetId()); + + // return new ListResultDto(myGroups.ToImmutableList()); + //} + + //public virtual async Task GroupAcceptUserAsync(GroupAcceptUserDto input) + //{ + // var myGroupCard = await _userGroupStore + // .GetUserGroupCardAsync(CurrentTenant.Id, input.GroupId, CurrentUser.GetId()); + // if (myGroupCard == null) + // { + // // 当前登录用户不再用户组 + // throw new UserFriendlyException(""); + // } + // if (!myGroupCard.IsAdmin) + // { + // // 当前登录用户没有加人权限 + // throw new UserFriendlyException(""); + // } + // await _userGroupStore + // .AddUserToGroupAsync(CurrentTenant.Id, input.UserId, input.GroupId, CurrentUser.GetId()); + //} + + //public virtual async Task GroupRemoveUserAsync(GroupRemoveUserDto input) + //{ + // var myGroupCard = await _userGroupStore + // .GetUserGroupCardAsync(CurrentTenant.Id, input.GroupId, CurrentUser.GetId()); + // if (myGroupCard == null) + // { + // // 当前登录用户不再用户组 + // throw new UserFriendlyException(""); + // } + // if (!myGroupCard.IsAdmin) + // { + // // 当前登录用户没有踢人权限 + // throw new UserFriendlyException(""); + // } + // await _userGroupStore + // .RemoveUserFormGroupAsync(CurrentTenant.Id, input.UserId, input.GroupId); + //} public virtual async Task SendMessageAsync(ChatMessage input) { @@ -131,11 +133,5 @@ namespace LINGYUN.Abp.MessageService.Chat return new ChatMessageSendResultDto(input.MessageId); } - - public virtual Task ApplyJoinGroupAsync(UserJoinGroupDto input) - { - // TOTO 发送通知? - return Task.CompletedTask; - } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/MyFriendAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/MyFriendAppService.cs index d76bb4be7..d8254233a 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/MyFriendAppService.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/MyFriendAppService.cs @@ -41,7 +41,7 @@ namespace LINGYUN.Abp.MessageService.Chat var myFrientCount = await FriendStore.GetCountAsync(CurrentTenant.Id, CurrentUser.GetId()); var myFriends = await FriendStore - .GetListAsync(CurrentTenant.Id, CurrentUser.GetId(), + .GetPagedListAsync(CurrentTenant.Id, CurrentUser.GetId(), input.Filter, input.Sorting, input.Reverse, input.SkipCount, input.MaxResultCount); diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Chat/UserChatFriendEto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Chat/UserChatFriendEto.cs new file mode 100644 index 000000000..795336f55 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Chat/UserChatFriendEto.cs @@ -0,0 +1,23 @@ +using LINGYUN.Abp.IM.Contract; +using System; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Abp.MessageService.Chat +{ + public class UserChatFriendEto : IMultiTenant + { + public Guid? TenantId { get; set; } + /// + /// 用户标识 + /// + public Guid UserId { get; set; } + /// + /// 好友标识 + /// + public Guid FrientId { get; set; } + /// + /// 状态 + /// + public UserFriendStatus Status { get; set; } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Chat/ChatGroupConsts.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Group/ChatGroupConsts.cs similarity index 86% rename from aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Chat/ChatGroupConsts.cs rename to aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Group/ChatGroupConsts.cs index c84bcd637..1cb2174a4 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Chat/ChatGroupConsts.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Group/ChatGroupConsts.cs @@ -1,4 +1,4 @@ -namespace LINGYUN.Abp.MessageService.Chat +namespace LINGYUN.Abp.MessageService.Group { public class ChatGroupConsts { diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/MessageServiceErrorCodes.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/MessageServiceErrorCodes.cs index 574b5cd52..f804cc102 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/MessageServiceErrorCodes.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/MessageServiceErrorCodes.cs @@ -1,34 +1,99 @@ namespace LINGYUN.Abp.MessageService { + /// + /// 消息系统错误码设计 + /// 状态码分为两部分 前2位领域 后3位状态 + /// + /// + /// 领域部分: + /// 01 输入 + /// 02 群组 + /// 03 用户 + /// 04 应用 + /// 05 内部 + /// 10 输出 + /// + /// + /// + /// 状态部分: + /// 200-299 成功 + /// 300-399 成功但有后续操作 + /// 400-499 业务异常 + /// 500-599 内部异常 + /// 900-999 输入输出异常 + /// + /// + /// public class MessageServiceErrorCodes { + public const string Namespace = "LINGYUN.Abp.Message"; /// - /// 管理员已开启全员禁言 + /// 消息不完整 /// - public const string GroupNotAllowedToSpeak = "Messages.Group:1001"; + public const string MessageIncomplete = Namespace + ":01400"; /// - /// 管理员不允许匿名发言 + /// 您还未加入群组,不能进行操作 + /// + public const string YouHaveNotJoinedGroup = Namespace + ":01401"; + /// + /// 已发送群组申请,等待管理员同意 /// - public const string GroupNotAllowedToSpeakAnonymously = "Messages.Group:1002"; + public const string YouHaveAddingToGroup = Namespace + ":02301"; + /// + /// 你需要验证问题才能加入群聊 + /// + public const string YouNeedValidationQuestingByAddGroup = Namespace + ":02302"; + /// + /// 管理员已开启全员禁言 + /// + public const string GroupNotAllowedToSpeak = Namespace + ":02400"; /// /// 管理员已禁止用户发言 /// - public const string GroupUserHasBlack = "Messages.Group:1003"; + public const string GroupUserHasBlack = Namespace + ":02403"; /// - /// 用户已将发信人拉黑 + /// 管理员不允许匿名发言 + /// + public const string GroupNotAllowedToSpeakAnonymously = Namespace + ":02401"; + /// + /// 群组不存在或已解散 /// - public const string UserHasBlack = "Messages.User:1003"; + public const string GroupNotFount = Namespace + ":02404"; /// /// 用户已拒接所有消息 /// - public const string UserHasRejectAllMessage = "Messages.User:1001"; + public const string UserHasRejectAllMessage = Namespace + ":03400"; + /// + /// 用户已将发信人拉黑 + /// + public const string UserHasBlack = Namespace + ":03401"; /// /// 用户不允许匿名发言 /// - public const string UserNotAllowedToSpeakAnonymously = "Messages.User:1002"; + public const string UserNotAllowedToSpeakAnonymously = Namespace + ":03402"; + /// + /// 用户不接收非好友发言 + /// + public const string UserHasRejectNotFriendMessage = Namespace + ":03403"; + /// + /// 接收消息用户不存在或已注销 + /// + public const string UseNotFount = Namespace + ":03404"; + /// + /// 用户拒绝添加好友 + /// + public const string UseRefuseToAddFriend = Namespace + ":03410"; + /// + /// 对方已是您的好友或已发送验证请求,不能重复操作 + /// + public const string UseHasBeenAddedTheFriendOrSendAuthorization = Namespace + ":03411"; + /// + /// 已发送好友申请,等待对方同意 + /// + public const string YouHaveAddingTheUserToFriend = Namespace + ":03301"; /// - /// 已经添加对方为好友 + /// 你需要验证问题才能添加好友 /// - public const string YouHaveAddedTheUserToFriend = "Messages.UserFriend:1001"; + public const string YouNeedValidationQuestingByAddFriend = Namespace + ":03302"; } } 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 6877ef0ce..1e5430533 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 @@ -18,6 +18,7 @@ + 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 e5006dd94..bf0a3429c 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,6 +1,7 @@ using LINGYUN.Abp.MessageService.Localization; using LINGYUN.Abp.MessageService.Mapper; using Volo.Abp.AutoMapper; +using Volo.Abp.Caching; using Volo.Abp.Localization; using Volo.Abp.Localization.ExceptionHandling; using Volo.Abp.Modularity; @@ -10,6 +11,7 @@ namespace LINGYUN.Abp.MessageService { [DependsOn( typeof(AbpAutoMapperModule), + typeof(AbpCachingModule), typeof(AbpMessageServiceDomainSharedModule))] public class AbpMessageServiceDomainModule : AbpModule { diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatNotificationNames.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatNotificationNames.cs new file mode 100644 index 000000000..c1518c28f --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatNotificationNames.cs @@ -0,0 +1,14 @@ +namespace LINGYUN.Abp.MessageService.Chat +{ + public static class ChatNotificationNames + { + public const string GroupName = "LINGYUN.Abp.IM.Chat"; + + public static class UserFriend + { + public const string Default = GroupName + ".UserFriend"; + + public const string NeedValidation = Default + ".NeedValidation"; + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/FriendStore.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/FriendStore.cs index aee590089..8690a36b1 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/FriendStore.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/FriendStore.cs @@ -1,8 +1,10 @@ using LINGYUN.Abp.IM.Contract; +using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp; +using Volo.Abp.Caching; using Volo.Abp.Domain.Services; using Volo.Abp.Uow; @@ -10,31 +12,65 @@ namespace LINGYUN.Abp.MessageService.Chat { public class FriendStore : DomainService, IFriendStore { + protected IDistributedCache Cache { get; } protected IUserChatFriendRepository UserChatFriendRepository { get; } + protected IUserChatSettingRepository UserChatSettingRepository { get; } public FriendStore( - IUserChatFriendRepository userChatFriendRepository) + IDistributedCache cache, + IUserChatFriendRepository userChatFriendRepository, + IUserChatSettingRepository userChatSettingRepository) { + Cache = cache; UserChatFriendRepository = userChatFriendRepository; + UserChatSettingRepository = userChatSettingRepository; + } + + public virtual async Task IsFriendAsync( + Guid? tenantId, + Guid userId, + Guid friendId + ) + { + using (CurrentTenant.Change(tenantId)) + { + return await UserChatFriendRepository.IsAddedAsync(userId, friendId); + } } [UnitOfWork] - public virtual async Task AddMemberAsync(Guid? tenantId, Guid userId, Guid friendId, string remarkName = "") + public virtual async Task AddMemberAsync(Guid? tenantId, Guid userId, Guid friendId, string remarkName = "") { using (CurrentTenant.Change(tenantId)) { if (await UserChatFriendRepository.IsAddedAsync(userId, friendId)) { - throw new BusinessException(MessageServiceErrorCodes.YouHaveAddedTheUserToFriend); - + throw new BusinessException(MessageServiceErrorCodes.UseHasBeenAddedTheFriendOrSendAuthorization); } - var userChatFriend = new UserChatFriend(userId, friendId, remarkName, tenantId) + + var status = UserFriendStatus.NeedValidation; + var userChatSetting = await UserChatSettingRepository.FindByUserIdAsync(friendId); + if (userChatSetting != null) + { + if (!userChatSetting.AllowAddFriend) + { + throw new BusinessException(MessageServiceErrorCodes.UseRefuseToAddFriend); + } + + status = userChatSetting.RequireAddFriendValition + ? UserFriendStatus.NeedValidation + : UserFriendStatus.Added; + } + + var userChatFriend = new UserChatFriend(userId, friendId, remarkName, status, tenantId) { CreationTime = Clock.Now, CreatorId = userId }; await UserChatFriendRepository.InsertAsync(userChatFriend); + + return new UserAddFriendResult(status); } } @@ -51,11 +87,7 @@ namespace LINGYUN.Abp.MessageService.Chat bool reverse = false ) { - using (CurrentTenant.Change(tenantId)) - { - return await UserChatFriendRepository - .GetAllMembersAsync(userId, sorting, reverse); - } + return await GetAllFriendByCacheItemAsync(tenantId, userId, sorting, reverse); } public virtual async Task GetCountAsync(Guid? tenantId, Guid userId, string filter = "") @@ -67,7 +99,7 @@ namespace LINGYUN.Abp.MessageService.Chat } } - public virtual async Task> GetListAsync(Guid? tenantId, Guid userId, string filter = "", string sorting = nameof(UserFriend.UserId), bool reverse = false, int skipCount = 0, int maxResultCount = 10) + public virtual async Task> GetPagedListAsync(Guid? tenantId, Guid userId, string filter = "", string sorting = nameof(UserFriend.UserId), bool reverse = false, int skipCount = 0, int maxResultCount = 10) { using (CurrentTenant.Change(tenantId)) { @@ -132,5 +164,34 @@ namespace LINGYUN.Abp.MessageService.Chat } } } + + protected virtual async Task> GetAllFriendByCacheItemAsync( + Guid? tenantId, + Guid userId, + string sorting = nameof(UserFriend.UserId), + bool reverse = false + ) + { + var cacheKey = UserFriendCacheItem.CalculateCacheKey(userId.ToString()); + Logger.LogDebug($"FriendStore.GetCacheItemAsync: {cacheKey}"); + + var cacheItem = await Cache.GetAsync(cacheKey); + if (cacheItem != null) + { + Logger.LogDebug($"Found in the cache: {cacheKey}"); + return cacheItem.Friends; + } + + Logger.LogDebug($"Not found in the cache: {cacheKey}"); + using (CurrentTenant.Change(tenantId)) + { + var friends = await UserChatFriendRepository + .GetAllMembersAsync(userId, sorting, reverse); + cacheItem = new UserFriendCacheItem(friends); + Logger.LogDebug($"Set item in the cache: {cacheKey}"); + await Cache.SetAsync(cacheKey, cacheItem); + return friends; + } + } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IMessageRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IMessageRepository.cs index 095124290..43b45d938 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IMessageRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IMessageRepository.cs @@ -1,4 +1,5 @@ using LINGYUN.Abp.IM.Messages; +using LINGYUN.Abp.MessageService.Group; using System; using System.Collections.Generic; using System.Threading; diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatSettingRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatSettingRepository.cs index 7f7cdbaa7..6ad18ae70 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatSettingRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatSettingRepository.cs @@ -7,14 +7,6 @@ namespace LINGYUN.Abp.MessageService.Chat public interface IUserChatSettingRepository : IBasicRepository { Task UserHasOpendImAsync(Guid userId); - /// - /// 用户是否已被拉黑 - /// - /// - /// - /// - Task UserHasBlackedAsync(Guid formUserId, Guid toUserId); - - Task GetByUserIdAsync(Guid userId); + Task FindByUserIdAsync(Guid userId); } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/MessageStore.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/MessageStore.cs index 870cfe537..42a64f200 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/MessageStore.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/MessageStore.cs @@ -1,4 +1,6 @@ -using LINGYUN.Abp.IM.Messages; +using LINGYUN.Abp.IM.Contract; +using LINGYUN.Abp.IM.Messages; +using LINGYUN.Abp.MessageService.Group; using LINGYUN.Abp.MessageService.Utils; using System; using System.Collections.Generic; @@ -12,6 +14,9 @@ namespace LINGYUN.Abp.MessageService.Chat { public class MessageStore : DomainService, IMessageStore { + private IFriendStore _friendStore; + protected IFriendStore FriendStore => LazyGetRequiredService(ref _friendStore); + private IObjectMapper _objectMapper; protected IObjectMapper ObjectMapper => LazyGetRequiredService(ref _objectMapper); @@ -137,14 +142,15 @@ namespace LINGYUN.Abp.MessageService.Chat protected virtual async Task StoreUserMessageAsync(ChatMessage chatMessage) { - var userHasBlacked = await UserChatSettingRepository - .UserHasBlackedAsync(chatMessage.ToUserId.Value, chatMessage.FormUserId); - if (userHasBlacked) + // 检查接收用户 + if (!chatMessage.ToUserId.HasValue) { - // 当前发送的用户已被拉黑 - throw new BusinessException(MessageServiceErrorCodes.UserHasBlack); + throw new BusinessException(MessageServiceErrorCodes.UseNotFount); } - var userChatSetting = await UserChatSettingRepository.GetByUserIdAsync(chatMessage.ToUserId.Value); + + var myFriend = await FriendStore.GetMemberAsync(chatMessage.TenantId, chatMessage.ToUserId.Value, chatMessage.FormUserId); + + var userChatSetting = await UserChatSettingRepository.FindByUserIdAsync(chatMessage.ToUserId.Value); if (userChatSetting != null) { if (!userChatSetting.AllowReceiveMessage) @@ -152,12 +158,29 @@ namespace LINGYUN.Abp.MessageService.Chat // 当前发送的用户不接收消息 throw new BusinessException(MessageServiceErrorCodes.UserHasRejectAllMessage); } + + if (myFriend == null && !chatMessage.IsAnonymous) + { + throw new BusinessException(MessageServiceErrorCodes.UserHasRejectNotFriendMessage); + } + if (chatMessage.IsAnonymous && !userChatSetting.AllowAnonymous) { // 当前用户不允许匿名发言 throw new BusinessException(MessageServiceErrorCodes.UserNotAllowedToSpeakAnonymously); } } + else + { + if (myFriend == null) + { + throw new BusinessException(MessageServiceErrorCodes.UserHasRejectNotFriendMessage); + } + } + if (myFriend?.Black == true) + { + throw new BusinessException(MessageServiceErrorCodes.UserHasBlack); + } var messageId = SnowflakeIdGenerator.Create(); var message = new UserMessage(messageId, chatMessage.FormUserId, chatMessage.FormUserName, chatMessage.Content, chatMessage.MessageType); message.SendToUser(chatMessage.ToUserId.Value); @@ -188,7 +211,7 @@ namespace LINGYUN.Abp.MessageService.Chat } var messageId = SnowflakeIdGenerator.Create(); var message = new GroupMessage(messageId, chatMessage.FormUserId, chatMessage.FormUserName, chatMessage.Content, chatMessage.MessageType); - // TODO: 需要压测 高并发场景下的装箱性能影响 + message.SendToGroup(groupId); await MessageRepository.InsertGroupMessageAsync(message); diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatBlack.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatBlack.cs deleted file mode 100644 index 0d3e07975..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatBlack.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using Volo.Abp.Domain.Entities.Auditing; -using Volo.Abp.MultiTenancy; - -namespace LINGYUN.Abp.MessageService.Chat -{ - /// - /// 用户黑名单 - /// - public class UserChatBlack : CreationAuditedEntity, IMultiTenant - { - /// - /// 租户 - /// - public virtual Guid? TenantId { get; protected set; } - /// - /// 用户标识 - /// - public virtual Guid UserId { get; protected set; } - /// - /// 拉黑的用户 - /// - public virtual Guid ShieldUserId { get; protected set; } - protected UserChatBlack() { } - public UserChatBlack(Guid userId, Guid shieldUserId, Guid? tenantId) - { - UserId = userId; - ShieldUserId = shieldUserId; - TenantId = tenantId; - } - } -} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriend.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriend.cs index 1392955d3..d964aa0cc 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriend.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriend.cs @@ -1,10 +1,11 @@ -using System; +using LINGYUN.Abp.IM.Contract; +using System; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.MultiTenancy; namespace LINGYUN.Abp.MessageService.Chat { - public class UserChatFriend : CreationAuditedEntity, IMultiTenant + public class UserChatFriend : CreationAuditedAggregateRoot, IMultiTenant { /// /// 租户 @@ -35,6 +36,8 @@ namespace LINGYUN.Abp.MessageService.Chat /// public virtual string RemarkName { get; set; } + public virtual UserFriendStatus Status { get; protected set; } + protected UserChatFriend() { } @@ -43,12 +46,30 @@ namespace LINGYUN.Abp.MessageService.Chat Guid userId, Guid friendId, string remarkName = "", + UserFriendStatus status = UserFriendStatus.NeedValidation, Guid? tenantId = null) { UserId = userId; FrientId = friendId; RemarkName = remarkName; + Status = status; TenantId = tenantId; } + + public void SetStatus(UserFriendStatus status = UserFriendStatus.NeedValidation) + { + if (Status == UserFriendStatus.NeedValidation && status == UserFriendStatus.NeedValidation) + { + // 如果是后续验证通过的需要单独的事件 + AddLocalEvent(new UserChatFriendEto + { + TenantId = TenantId, + UserId = UserId, + FrientId = FrientId, + Status = UserFriendStatus.Added + }); + } + Status = status; + } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriendGroup.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriendGroup.cs index 622758140..f6d811721 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriendGroup.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriendGroup.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.MultiTenancy; diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserFriendCacheItem.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserFriendCacheItem.cs new file mode 100644 index 000000000..97082ace3 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserFriendCacheItem.cs @@ -0,0 +1,27 @@ +using LINGYUN.Abp.IM.Contract; +using System; +using System.Collections.Generic; + +namespace LINGYUN.Abp.MessageService.Chat +{ + [Serializable] + public class UserFriendCacheItem + { + public List Friends { get; set; } + + public UserFriendCacheItem() + { + Friends = new List(); + } + + public UserFriendCacheItem(List friends) + { + Friends = friends; + } + + public static string CalculateCacheKey(string userId) + { + return "uid:" + userId; + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserSpecialFocus.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserSpecialFocus.cs deleted file mode 100644 index fbf538d53..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserSpecialFocus.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using Volo.Abp.Domain.Entities.Auditing; -using Volo.Abp.MultiTenancy; - -namespace LINGYUN.Abp.MessageService.Chat -{ - /// - /// 用户特别关注 - /// - public class UserSpecialFocus : CreationAuditedEntity, IMultiTenant - { - /// - /// 租户 - /// - public virtual Guid? TenantId { get; protected set; } - /// - /// 用户标识 - /// - public virtual Guid UserId { get; protected set; } - /// - /// 关注的用户 - /// - public virtual Guid FocusUserId { get; protected set; } - protected UserSpecialFocus() { } - public UserSpecialFocus(Guid userId, Guid focusUserId, Guid? tenantId) - { - UserId = userId; - FocusUserId = focusUserId; - TenantId = tenantId; - } - } -} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserChatFriendEventHandler.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserChatFriendEventHandler.cs new file mode 100644 index 000000000..5af42b75a --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserChatFriendEventHandler.cs @@ -0,0 +1,84 @@ +using LINGYUN.Abp.IM.Messages; +using LINGYUN.Abp.MessageService.Chat; +using LINGYUN.Abp.Notifications; +using Microsoft.Extensions.Logging; +using System; +using System.Threading.Tasks; +using Volo.Abp.Caching; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities.Events; +using Volo.Abp.EventBus; + +namespace LINGYUN.Abp.MessageService.EventBus.Local +{ + public class UserChatFriendEventHandler : + ILocalEventHandler>, + ILocalEventHandler>, + ILocalEventHandler>, + ILocalEventHandler, + ITransientDependency + { + private ILogger _logger; + private IMessageSender _messageSender; + private INotificationDispatcher _dispatcher; + private IDistributedCache _cache; + + public UserChatFriendEventHandler( + IMessageSender messageSender, + INotificationDispatcher dispatcher, + ILogger logger) + { + _logger = logger; + _dispatcher = dispatcher; + _messageSender = messageSender; + } + + public virtual async Task HandleEventAsync(EntityCreatedEventData eventData) + { + switch (eventData.Entity.Status) + { + case IM.Contract.UserFriendStatus.Added: + await SendFriendAddedMessageAsync(eventData.Entity.UserId, eventData.Entity.FrientId, eventData.Entity.TenantId); + break; + case IM.Contract.UserFriendStatus.NeedValidation: + await SendFriendValidationNotiferAsync(eventData.Entity.UserId, eventData.Entity.FrientId, eventData.Entity.TenantId); + break; + } + await RemoveUserFriendCacheItemAsync(eventData.Entity.UserId); + } + + public virtual async Task HandleEventAsync(EntityDeletedEventData eventData) + { + await RemoveUserFriendCacheItemAsync(eventData.Entity.UserId); + } + + public virtual async Task HandleEventAsync(EntityUpdatedEventData eventData) + { + await RemoveUserFriendCacheItemAsync(eventData.Entity.UserId); + } + + public virtual async Task HandleEventAsync(UserChatFriendEto eventData) + { + if (eventData.Status == IM.Contract.UserFriendStatus.Added) + { + await SendFriendAddedMessageAsync(eventData.UserId, eventData.FrientId, eventData.TenantId); + } + } + + protected virtual async Task SendFriendAddedMessageAsync(Guid userId, Guid friendId, Guid? tenantId = null) + { + // 发送添加好友的第一条消息 + } + + protected virtual async Task SendFriendValidationNotiferAsync(Guid userId, Guid friendId, Guid? tenantId = null) + { + // 发送好友验证通知 + } + + protected virtual async Task RemoveUserFriendCacheItemAsync(Guid userId) + { + // 移除好友缓存 + await _cache.RemoveAsync(UserFriendCacheItem.CalculateCacheKey(userId.ToString())); + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatGroup.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/ChatGroup.cs similarity index 97% rename from aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatGroup.cs rename to aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/ChatGroup.cs index ee22667ba..66f9382e4 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/ChatGroup.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/ChatGroup.cs @@ -2,7 +2,7 @@ using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.MultiTenancy; -namespace LINGYUN.Abp.MessageService.Chat +namespace LINGYUN.Abp.MessageService.Group { /// /// 聊天群组 diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/GroupChatBlack.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/GroupChatBlack.cs similarity index 95% rename from aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/GroupChatBlack.cs rename to aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/GroupChatBlack.cs index 22cfaef08..8d07295c8 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/GroupChatBlack.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/GroupChatBlack.cs @@ -2,7 +2,7 @@ using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.MultiTenancy; -namespace LINGYUN.Abp.MessageService.Chat +namespace LINGYUN.Abp.MessageService.Group { /// /// 用户黑名单 diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/GroupMessage.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/GroupMessage.cs similarity index 87% rename from aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/GroupMessage.cs rename to aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/GroupMessage.cs index 14fe37678..b38cd50a3 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/GroupMessage.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/GroupMessage.cs @@ -1,7 +1,8 @@ using LINGYUN.Abp.IM.Messages; +using LINGYUN.Abp.MessageService.Chat; using System; -namespace LINGYUN.Abp.MessageService.Chat +namespace LINGYUN.Abp.MessageService.Group { public class GroupMessage : Message { diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IGroupRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/IGroupRepository.cs similarity index 90% rename from aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IGroupRepository.cs rename to aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/IGroupRepository.cs index 568845459..58fa823e6 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IGroupRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/IGroupRepository.cs @@ -4,7 +4,7 @@ using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; -namespace LINGYUN.Abp.MessageService.Chat +namespace LINGYUN.Abp.MessageService.Group { public interface IGroupRepository : IBasicRepository { @@ -19,7 +19,7 @@ namespace LINGYUN.Abp.MessageService.Chat Guid formUserId, CancellationToken cancellationToken = default); - Task GetByIdAsync( + Task FindByIdAsync( long id, CancellationToken cancellationToken = default); diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/IGroupRepositoryExtensions.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/IGroupRepositoryExtensions.cs new file mode 100644 index 000000000..b33056b57 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/IGroupRepositoryExtensions.cs @@ -0,0 +1,19 @@ +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp; + +namespace LINGYUN.Abp.MessageService.Group +{ + public static class IGroupRepositoryExtensions + { + public static async Task GetByIdAsync( + this IGroupRepository repository, + long id, + CancellationToken cancellationToken = default) + { + var group = await repository.FindByIdAsync(id, cancellationToken); + + return group ?? throw new BusinessException(MessageServiceErrorCodes.GroupNotFount); + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatGroupRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/IUserChatGroupRepository.cs similarity index 94% rename from aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatGroupRepository.cs rename to aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/IUserChatGroupRepository.cs index f7f04df57..7f687e70b 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatGroupRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/IUserChatGroupRepository.cs @@ -5,7 +5,7 @@ using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; -namespace LINGYUN.Abp.MessageService.Chat +namespace LINGYUN.Abp.MessageService.Group { public interface IUserChatGroupRepository : IBasicRepository { @@ -51,7 +51,7 @@ namespace LINGYUN.Abp.MessageService.Chat /// Task> GetMembersAsync( long groupId, - string sorting = nameof(UserChatCard.UserId), + string sorting = nameof(GroupUserCard.UserId), bool reverse = false, int skipCount = 0, int maxResultCount = 10, @@ -62,7 +62,7 @@ namespace LINGYUN.Abp.MessageService.Chat /// /// /// - Task> GetMemberGroupsAsync( + Task> GetMemberGroupsAsync( Guid userId, CancellationToken cancellationToken = default); /// diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatGroup.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/UserChatGroup.cs similarity index 94% rename from aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatGroup.cs rename to aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/UserChatGroup.cs index 9cf6b06b4..1208e03c7 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatGroup.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/UserChatGroup.cs @@ -2,7 +2,7 @@ using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.MultiTenancy; -namespace LINGYUN.Abp.MessageService.Chat +namespace LINGYUN.Abp.MessageService.Group { /// /// 用户群组 diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserGroupCard.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/UserGroupCard.cs similarity index 97% rename from aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserGroupCard.cs rename to aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/UserGroupCard.cs index a1732631f..63ec38b92 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserGroupCard.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/UserGroupCard.cs @@ -3,7 +3,7 @@ using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.MultiTenancy; using Volo.Abp.Timing; -namespace LINGYUN.Abp.MessageService.Chat +namespace LINGYUN.Abp.MessageService.Group { /// /// 用户群组卡片 diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserGroupStore.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/UserGroupStore.cs similarity index 86% rename from aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserGroupStore.cs rename to aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/UserGroupStore.cs index 1a7f935b9..af94512e6 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserGroupStore.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/UserGroupStore.cs @@ -6,7 +6,7 @@ using Volo.Abp.Domain.Services; using Volo.Abp.ObjectMapping; using Volo.Abp.Uow; -namespace LINGYUN.Abp.MessageService.Chat +namespace LINGYUN.Abp.MessageService.Group { public class UserGroupStore : DomainService, IUserGroupStore { @@ -24,8 +24,16 @@ namespace LINGYUN.Abp.MessageService.Chat UserChatGroupRepository = userChatGroupRepository; } + public virtual async Task MemberHasInGroupAsync(Guid? tenantId, long groupId, Guid userId) + { + using (CurrentTenant.Change(tenantId)) + { + return await UserChatGroupRepository.MemberHasInGroupAsync(groupId, userId); + } + } + [UnitOfWork] - public async Task AddUserToGroupAsync(Guid? tenantId, Guid userId, long groupId, Guid acceptUserId) + public virtual async Task AddUserToGroupAsync(Guid? tenantId, Guid userId, long groupId, Guid acceptUserId) { using (var unitOfWork = UnitOfWorkManager.Begin()) { @@ -62,7 +70,7 @@ namespace LINGYUN.Abp.MessageService.Chat } } - public async Task> GetUserGroupsAsync(Guid? tenantId, Guid userId) + public async Task> GetUserGroupsAsync(Guid? tenantId, Guid userId) { using (CurrentTenant.Change(tenantId)) { 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 index 5ff282bdb..3bb80c584 100644 --- 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 @@ -1,13 +1,23 @@ { "culture": "en", "texts": { - "Messages.Group:1001": "The current group is not allowed to speak", - "Messages.Group:1002": "The current group is not allowed to speak anonymously", - "Messages.Group:1003": "The administrator has banned you from speaking!", - "Messages.User:1001": "Users do not receive anonymous comments!", - "Messages.User:1002": "The user has rejected all messages!", - "Messages.User:1003": "The user rejects the message you sent!", - "Messages.UserFriend:1001": "You have added each other as friends, can not be repeated!", + "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!", "WelcomeToApplicationNotification": "User Welcome Notice", "NewTenantRegisterdNotification": "Tenants create notification", "WelcomeToApplicationFormUser": "User :{0} welcome to join us!" 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 index 76b653478..b6f29bbcb 100644 --- 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 @@ -1,13 +1,23 @@ { "culture": "zh-Hans", "texts": { - "Messages.Group:1001": "管理员已开启全员禁言!", - "Messages.Group:1002": "管理员不允许匿名发言!", - "Messages.Group:1003": "管理员已禁止您发言!", - "Messages.User:1001": "用户不接收匿名发言!", - "Messages.User:1002": "用户已拒接所有消息!", - "Messages.User:1003": "用户拒绝您发送的消息!", - "Messages.UserFriend:1001": "您已经添加对方为好友,不能重复添加!", + "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": "对方已是您的好友或已发送验证请求,不能重复操作!", "WelcomeToApplicationNotification": "用户欢迎通知", "NewTenantRegisterdNotification": "租户创建通知", "WelcomeToApplicationFormUser": "用户:{0} 欢迎您的加入!" diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs index f57f907fa..1a8a69d3b 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs @@ -1,5 +1,6 @@ using LINGYUN.Abp.IM.Messages; using LINGYUN.Abp.MessageService.EntityFrameworkCore; +using LINGYUN.Abp.MessageService.Group; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; @@ -161,10 +162,11 @@ namespace LINGYUN.Abp.MessageService.Chat var groupMsgQuery = DbContext.Set() .Where(msg => msg.ReceiveUserId == userId || msg.CreatorId == userId) - .GroupBy(msg => msg.CreatorId) + .GroupBy(msg => new { msg.CreatorId, msg.ReceiveUserId }) .Select(msg => new { - msg.Key, + msg.Key.CreatorId, + msg.Key.ReceiveUserId, MessageId = msg.Max(x => x.MessageId) }); diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs index b3da8b1f7..4a7dabe34 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs @@ -23,7 +23,7 @@ namespace LINGYUN.Abp.MessageService.Chat public virtual async Task FindByUserFriendIdAsync(Guid userId, Guid friendId, CancellationToken cancellationToken = default) { return await DbSet - .Where(ucf => ucf.UserId == userId && ucf.FrientId == friendId) + .Where(ucf => ucf.UserId == userId && ucf.FrientId == friendId && ucf.Status == UserFriendStatus.Added) .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } @@ -34,10 +34,12 @@ namespace LINGYUN.Abp.MessageService.Chat CancellationToken cancellationToken = default) { sorting = reverse ? sorting + " DESC" : sorting; + var userFriendQuery = from ucf in DbContext.Set() join ucc in DbContext.Set() - on ucf.FrientId equals ucc.UserId - where ucf.UserId == userId + // on ucf.FrientId equals ucc.UserId // 查询双向好友的 + on ucf.UserId equals ucc.UserId + where ucf.UserId == userId && ucf.Status == UserFriendStatus.Added select new UserFriend { Age = ucc.Age, @@ -67,7 +69,7 @@ namespace LINGYUN.Abp.MessageService.Chat var userFriendQuery = from ucf in DbContext.Set() join ucc in DbContext.Set() on ucf.FrientId equals ucc.UserId - where ucf.UserId == userId && ucf.FrientId == friendId + where ucf.UserId == userId && ucf.FrientId == friendId && ucf.Status == UserFriendStatus.Added select new UserFriend { Age = ucc.Age, @@ -100,6 +102,7 @@ namespace LINGYUN.Abp.MessageService.Chat // 过滤好友资料 var userChatFriendQuery = DbContext.Set() + .Where(ucf => ucf.Status == UserFriendStatus.Added) .WhereIf(!filter.IsNullOrWhiteSpace(), ucf => ucf.RemarkName.Contains(filter)); // 组合查询 @@ -146,7 +149,7 @@ namespace LINGYUN.Abp.MessageService.Chat on ucf.FrientId equals ucc.UserId join um in userReceiveMsgQuery on ucc.UserId equals um.CreatorId - where ucf.UserId == userId + where ucf.UserId == userId && ucf.Status == UserFriendStatus.Added orderby um.CreationTime descending // 消息创建时间倒序 select new UserFriend { @@ -178,6 +181,7 @@ namespace LINGYUN.Abp.MessageService.Chat .WhereIf(!filter.IsNullOrWhiteSpace(), ucc => ucc.UserName.Contains(filter) || ucc.NickName.Contains(filter)); var userChatFriendQuery = DbContext.Set() + .Where(ucf => ucf.Status == UserFriendStatus.Added) .WhereIf(!filter.IsNullOrWhiteSpace(), ucf => ucf.RemarkName.Contains(filter)); var userFriendQuery = from ucf in userChatFriendQuery diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatGroupRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatGroupRepository.cs deleted file mode 100644 index a234e3058..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatGroupRepository.cs +++ /dev/null @@ -1,305 +0,0 @@ -using LINGYUN.Abp.IM.Group; -using LINGYUN.Abp.MessageService.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Internal; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Dynamic.Core; -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Repositories.EntityFrameworkCore; -using Volo.Abp.EntityFrameworkCore; - -namespace LINGYUN.Abp.MessageService.Chat -{ - public class EfCoreUserChatGroupRepository : EfCoreRepository, - IUserChatGroupRepository, ITransientDependency - { - public EfCoreUserChatGroupRepository( - IDbContextProvider dbContextProvider) : base(dbContextProvider) - { - } - - public virtual async Task GetMemberAsync( - long groupId, - Guid userId, - CancellationToken cancellationToken = default) - { - var cardQuery = from gp in DbContext.Set() - join ucg in DbContext.Set() - on gp.GroupId equals ucg.GroupId - join ugc in DbContext.Set() - on ucg.UserId equals ugc.UserId - join uc in DbContext.Set() - on ugc.UserId equals uc.UserId - where gp.GroupId == groupId && ugc.UserId == userId - select new GroupUserCard - { - TenantId = uc.TenantId, - UserId = uc.UserId, - UserName = uc.UserName, - Age = uc.Age, - AvatarUrl = uc.AvatarUrl, - IsAdmin = ugc.IsAdmin, - IsSuperAdmin = gp.AdminUserId == uc.UserId, - GroupId = gp.GroupId, - Birthday = uc.Birthday, - Description = uc.Description, - NickName = ugc.NickName ?? uc.NickName, - Sex = uc.Sex, - Sign = uc.Sign - }; - - return await cardQuery - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); - } - - public virtual async Task> GetMembersAsync( - long groupId, - string sorting = nameof(UserChatCard.UserId), - bool reverse = false, - int skipCount = 0, - int maxResultCount = 10, - CancellationToken cancellationToken = default) - { - sorting ??= nameof(UserChatCard.UserId); - sorting = reverse ? sorting + " desc" : sorting; - var cardQuery = from gp in DbContext.Set() - join ucg in DbContext.Set() - on gp.GroupId equals ucg.GroupId - join ugc in DbContext.Set() - on ucg.UserId equals ugc.UserId - join uc in DbContext.Set() - on ugc.UserId equals uc.UserId - where gp.GroupId == groupId - select new GroupUserCard - { - TenantId = uc.TenantId, - UserId = uc.UserId, - UserName = uc.UserName, - Age = uc.Age, - AvatarUrl = uc.AvatarUrl, - IsAdmin = ugc.IsAdmin, - IsSuperAdmin = gp.AdminUserId == uc.UserId, - GroupId = gp.GroupId, - Birthday = uc.Birthday, - Description = uc.Description, - NickName = ugc.NickName ?? uc.NickName, - Sex = uc.Sex, - Sign = uc.Sign - }; - - return await cardQuery - .OrderBy(sorting ?? nameof(UserChatCard.UserId)) - .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); - } - - public virtual async Task GetMembersCountAsync( - long groupId, - CancellationToken cancellationToken = default) - { - var cardQuery = from gp in DbContext.Set() - join ucg in DbContext.Set() - on gp.GroupId equals ucg.GroupId - join ugc in DbContext.Set() - on ucg.UserId equals ugc.UserId - join uc in DbContext.Set() - on ugc.UserId equals uc.UserId - where gp.GroupId == groupId - select ucg; - - return await cardQuery - .CountAsync(GetCancellationToken(cancellationToken)); - } - - public virtual async Task MemberHasInGroupAsync( - long groupId, - Guid userId, - CancellationToken cancellationToken = default) - { - return await DbContext.Set() - .AnyAsync(ucg => ucg.GroupId == groupId && ucg.UserId == userId, - GetCancellationToken(cancellationToken)); - } - - public virtual async Task> GetMemberGroupsAsync( - Guid userId, - CancellationToken cancellationToken = default) - { - var groupQuery = from gp in DbContext.Set() - join ucg in DbContext.Set() - on gp.GroupId equals ucg.GroupId - where ucg.UserId.Equals(userId) - group ucg by new - { - gp.AllowAnonymous, - gp.AllowSendMessage, - gp.MaxUserCount, - gp.Name - } - into cg - select new Group - { - AllowAnonymous = cg.Key.AllowAnonymous, - AllowSendMessage = cg.Key.AllowSendMessage, - MaxUserLength = cg.Key.MaxUserCount, - Name = cg.Key.Name, - GroupUserCount = cg.Count() - }; - - return await groupQuery - .ToListAsync(GetCancellationToken(cancellationToken)); - } - - public virtual async Task RemoveMemberFormGroupAsync( - long groupId, - Guid userId, - CancellationToken cancellationToken = default) - { - await DeleteAsync(ucg => ucg.GroupId == groupId && ucg.UserId == userId); - } - - //public virtual async Task> GetGroupUsersAsync( - // long groupId, - // CancellationToken cancellationToken = default) - //{ - // // TODO: 急需单元测试,对这段代码不是太自信... - // var groupUsers = await (from cg in DbContext.Set() - // join ucg in DbContext.Set() - // on cg.GroupId equals ucg.GroupId - // join ugc in DbContext.Set() - // on ucg.UserId equals ugc.UserId - // where cg.GroupId.Equals(groupId) - // select new GroupUserCard - // { - // GroupId = ucg.GroupId, - // IsSuperAdmin = ugc.UserId == cg.AdminUserId, - // IsAdmin = ugc.IsAdmin, - // TenantId = ucg.TenantId, - // UserId = ucg.UserId - // }) - // .Distinct() - // .AsNoTracking() - // .ToListAsync(GetCancellationToken(cancellationToken)); - // return groupUsers; - //} - - //public virtual async Task GetMemberAsync( - // long groupId, - // Guid userId, - // CancellationToken cancellationToken = default) - //{ - // var groupUserCard = await (from cg in DbContext.Set() - // join ucg in DbContext.Set().DefaultIfEmpty() - // on cg.GroupId equals ucg.GroupId - // join ucc in DbContext.Set().DefaultIfEmpty() - // on ucg.UserId equals ucc.UserId - // join cga in DbContext.Set().DefaultIfEmpty() - // on cg.GroupId equals cga.GroupId - // where ucg.GroupId.Equals(groupId) && cga.UserId.Equals(userId) - // select new GroupUserCard - // { - // IsSuperAdmin = cga != null && cga.IsSuperAdmin, - // IsAdmin = cga != null,//能查到数据就是管理员 - // GroupId = ucg.GroupId, - // UserId = ucg.UserId, - // TenantId = ucg.TenantId, - // Permissions = new Dictionary - // { - // { nameof(ChatGroupAdmin.AllowAddPeople), cga != null && cga.AllowAddPeople }, - // { nameof(ChatGroupAdmin.AllowDissolveGroup), cga != null && cga.AllowDissolveGroup }, - // { nameof(ChatGroupAdmin.AllowKickPeople), cga != null && cga.AllowKickPeople }, - // { nameof(ChatGroupAdmin.AllowSendNotice), cga != null && cga.AllowSendNotice }, - // { nameof(ChatGroupAdmin.AllowSilence), cga != null && cga.AllowSilence }, - // { nameof(ChatGroupAdmin.IsSuperAdmin), cga != null && cga.IsSuperAdmin } - // } - // }) - // .AsNoTracking() - // .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); - - // return groupUserCard; - //} - - //public virtual Task> GetUsersAsync( - // long groupId, - // string filter = "", - // string sorting = nameof(UserGroup.UserId), - // bool reverse = false, - // int skipCount = 0, - // int maxResultCount = 10, - // CancellationToken cancellationToken = default) - //{ - // sorting = reverse ? sorting + " desc" : sorting; - // // TODO: 复杂的实现,暂时无关紧要,后期再说 :) - // throw new NotImplementedException(); - //} - - //public virtual Task GetMembersCountAsync( - // long groupId, - // string filter = "", - // CancellationToken cancellationToken = default) - //{ - // var ss = (from ucg in DbContext.Set() - // join cg in DbContext.Set() on ucg.GroupId equals cg.GroupId - // select cg) - // .WhereIf(!filter.IsNullOrWhiteSpace(),) - - // // TODO: 复杂的实现,暂时无关紧要,后期再说 :) - // //throw new NotImplementedException(); - //} - - //public virtual async Task GetUserGroupAsync( - // long groupId, - // Guid userId, - // CancellationToken cancellationToken = default) - //{ - // return await DbSet.Where(x => x.GroupId.Equals(groupId) && x.UserId.Equals(userId)) - // .AsNoTracking() - // .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); - //} - - //public virtual async Task> GetUserGroupsAsync( - // Guid userId, - // CancellationToken cancellationToken = default) - //{ - // // TODO: 急需单元测试,对这段代码不是太自信... - // var userGroups = await (from ucg in DbSet - // join cg in DbContext.Set() - // on ucg.GroupId equals cg.GroupId - // group cg by new - // { - // cg.GroupId, - // cg.Name, - // cg.AllowAnonymous, - // cg.AllowSendMessage, - // cg.MaxUserCount - // } - // into ug - // orderby ug.Key.GroupId descending - // select new Group - // { - // AllowAnonymous = ug.Key.AllowAnonymous, - // AllowSendMessage = ug.Key.AllowSendMessage, - // GroupUserCount = ug.Count(), - // MaxUserLength = ug.Key.MaxUserCount, - // Name = ug.Key.Name - // }) - // .Distinct() - // .ToListAsync(GetCancellationToken(cancellationToken)); - - // return userGroups; - //} - - //public virtual async Task MemberHasInGroupAsync( - // long groupId, - // Guid userId, - // CancellationToken cancellationToken = default) - //{ - // return await DbSet - // .AnyAsync(x => x.GroupId.Equals(groupId) && x.UserId.Equals(userId), GetCancellationToken(cancellationToken)); - //} - } -} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatSettingRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatSettingRepository.cs index d2784e0af..69b23a8fd 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatSettingRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatSettingRepository.cs @@ -18,19 +18,13 @@ namespace LINGYUN.Abp.MessageService.Chat { } - public async Task GetByUserIdAsync(Guid userId) + public async Task FindByUserIdAsync(Guid userId) { return await DbSet.Where(x => x.UserId.Equals(userId)) .AsNoTracking() .FirstOrDefaultAsync(); } - public async Task UserHasBlackedAsync(Guid formUserId, Guid toUserId) - { - return await DbContext.Set() - .AnyAsync(x => x.UserId.Equals(toUserId) && x.ShieldUserId.Equals(formUserId)); - } - public async Task UserHasOpendImAsync(Guid userId) { return await DbSet.AnyAsync(x => x.UserId.Equals(userId)); diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContextModelCreatingExtensions.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContextModelCreatingExtensions.cs index c3307fff8..8fa22cf9b 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContextModelCreatingExtensions.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContextModelCreatingExtensions.cs @@ -1,4 +1,5 @@ using LINGYUN.Abp.MessageService.Chat; +using LINGYUN.Abp.MessageService.Group; using LINGYUN.Abp.MessageService.Notifications; using LINGYUN.Abp.MessageService.Subscriptions; using Microsoft.EntityFrameworkCore; @@ -137,23 +138,23 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore b.HasIndex(p => new { p.TenantId, p.UserId }); }); - builder.Entity(b => - { - b.ToTable(options.TablePrefix + "UserSpecialFocuss", options.Schema); + //builder.Entity(b => + //{ + // b.ToTable(options.TablePrefix + "UserSpecialFocuss", options.Schema); - b.ConfigureMultiTenant(); + // b.ConfigureMultiTenant(); - b.HasIndex(p => new { p.TenantId, p.UserId }); - }); + // b.HasIndex(p => new { p.TenantId, p.UserId }); + //}); - builder.Entity(b => - { - b.ToTable(options.TablePrefix + "UserChatBlacks", options.Schema); + //builder.Entity(b => + //{ + // b.ToTable(options.TablePrefix + "UserChatBlacks", options.Schema); - b.ConfigureMultiTenant(); + // b.ConfigureMultiTenant(); - b.HasIndex(p => new { p.TenantId, p.UserId }); - }); + // b.HasIndex(p => new { p.TenantId, p.UserId }); + //}); builder.Entity(b => { diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreGroupRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Group/EfCoreGroupRepository.cs similarity index 95% rename from aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreGroupRepository.cs rename to aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Group/EfCoreGroupRepository.cs index 5d5bac6b8..0a3a5ec85 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreGroupRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Group/EfCoreGroupRepository.cs @@ -9,7 +9,7 @@ using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; -namespace LINGYUN.Abp.MessageService.Chat +namespace LINGYUN.Abp.MessageService.Group { public class EfCoreGroupRepository : EfCoreRepository, IGroupRepository, ITransientDependency @@ -20,7 +20,7 @@ namespace LINGYUN.Abp.MessageService.Chat { } - public virtual async Task GetByIdAsync( + public virtual async Task FindByIdAsync( long id, CancellationToken cancellationToken = default) { 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 new file mode 100644 index 000000000..6b274be28 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Group/EfCoreUserChatGroupRepository.cs @@ -0,0 +1,166 @@ +using LINGYUN.Abp.IM.Group; +using LINGYUN.Abp.MessageService.Chat; +using LINGYUN.Abp.MessageService.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Internal; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Dynamic.Core; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Abp.MessageService.Group +{ + public class EfCoreUserChatGroupRepository : EfCoreRepository, + IUserChatGroupRepository, ITransientDependency + { + public EfCoreUserChatGroupRepository( + IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + + public virtual async Task GetMemberAsync( + long groupId, + Guid userId, + CancellationToken cancellationToken = default) + { + var cardQuery = from gp in DbContext.Set() + join ucg in DbContext.Set() + on gp.GroupId equals ucg.GroupId + join ugc in DbContext.Set() + on ucg.UserId equals ugc.UserId + join uc in DbContext.Set() + on ugc.UserId equals uc.UserId + where gp.GroupId == groupId && ugc.UserId == userId + select new GroupUserCard + { + TenantId = uc.TenantId, + UserId = uc.UserId, + UserName = uc.UserName, + Age = uc.Age, + AvatarUrl = uc.AvatarUrl, + IsAdmin = ugc.IsAdmin, + IsSuperAdmin = gp.AdminUserId == uc.UserId, + GroupId = gp.GroupId, + Birthday = uc.Birthday, + Description = uc.Description, + NickName = ugc.NickName ?? uc.NickName, + Sex = uc.Sex, + Sign = uc.Sign + }; + + return await cardQuery + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetMembersAsync( + long groupId, + string sorting = nameof(UserChatCard.UserId), + bool reverse = false, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default) + { + sorting ??= nameof(UserChatCard.UserId); + sorting = reverse ? sorting + " desc" : sorting; + var cardQuery = from gp in DbContext.Set() + join ucg in DbContext.Set() + on gp.GroupId equals ucg.GroupId + join ugc in DbContext.Set() + on ucg.UserId equals ugc.UserId + join uc in DbContext.Set() + on ugc.UserId equals uc.UserId + where gp.GroupId == groupId + select new GroupUserCard + { + TenantId = uc.TenantId, + UserId = uc.UserId, + UserName = uc.UserName, + Age = uc.Age, + AvatarUrl = uc.AvatarUrl, + IsAdmin = ugc.IsAdmin, + IsSuperAdmin = gp.AdminUserId == uc.UserId, + GroupId = gp.GroupId, + Birthday = uc.Birthday, + Description = uc.Description, + NickName = ugc.NickName ?? uc.NickName, + Sex = uc.Sex, + Sign = uc.Sign + }; + + return await cardQuery + .OrderBy(sorting ?? nameof(UserChatCard.UserId)) + .PageBy(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task GetMembersCountAsync( + long groupId, + CancellationToken cancellationToken = default) + { + var cardQuery = from gp in DbContext.Set() + join ucg in DbContext.Set() + on gp.GroupId equals ucg.GroupId + join ugc in DbContext.Set() + on ucg.UserId equals ugc.UserId + join uc in DbContext.Set() + on ugc.UserId equals uc.UserId + where gp.GroupId == groupId + select ucg; + + return await cardQuery + .CountAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task MemberHasInGroupAsync( + long groupId, + Guid userId, + CancellationToken cancellationToken = default) + { + return await DbContext.Set() + .AnyAsync(ucg => ucg.GroupId == groupId && ucg.UserId == userId, + GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetMemberGroupsAsync( + Guid userId, + CancellationToken cancellationToken = default) + { + var groupQuery = from gp in DbContext.Set() + join ucg in DbContext.Set() + on gp.GroupId equals ucg.GroupId + where ucg.UserId.Equals(userId) + group ucg by new + { + gp.AllowAnonymous, + gp.AllowSendMessage, + gp.MaxUserCount, + gp.Name + } + into cg + select new IM.Group.Group + { + AllowAnonymous = cg.Key.AllowAnonymous, + AllowSendMessage = cg.Key.AllowSendMessage, + MaxUserLength = cg.Key.MaxUserCount, + Name = cg.Key.Name, + GroupUserCount = cg.Count() + }; + + return await groupQuery + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task RemoveMemberFormGroupAsync( + long groupId, + Guid userId, + CancellationToken cancellationToken = default) + { + await DeleteAsync(ucg => ucg.GroupId == groupId && ucg.UserId == userId); + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/ChatController.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/ChatController.cs index 24c790083..75be01a94 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/ChatController.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/ChatController.cs @@ -1,5 +1,4 @@ -using LINGYUN.Abp.IM.Group; -using LINGYUN.Abp.IM.Messages; +using LINGYUN.Abp.IM.Messages; using Microsoft.AspNetCore.Mvc; using System.Threading.Tasks; using Volo.Abp; @@ -19,25 +18,11 @@ namespace LINGYUN.Abp.MessageService.Chat _chatAppService = chatAppService; } - [HttpPost] - [Route("groups/join")] - public virtual async Task ApplyJoinGroupAsync(UserJoinGroupDto input) - { - await _chatAppService.ApplyJoinGroupAsync(input); - } - [HttpGet] [Route("group/messages")] - public virtual async Task> GetGroupMessageAsync(GroupMessageGetByPagedDto input) + public virtual async Task> GetMyGroupMessageAsync(GroupMessageGetByPagedDto input) { - return await _chatAppService.GetGroupMessageAsync(input); - } - - [HttpGet] - [Route("groups/users")] - public virtual async Task> GetGroupUsersAsync(GroupUserGetByPagedDto input) - { - return await _chatAppService.GetGroupUsersAsync(input); + return await _chatAppService.GetMyGroupMessageAsync(input); } [HttpGet] @@ -54,27 +39,6 @@ namespace LINGYUN.Abp.MessageService.Chat return await _chatAppService.GetMyLastChatMessageAsync(input); } - [HttpGet] - [Route("groups/me")] - public virtual async Task> GetMyGroupsAsync() - { - return await _chatAppService.GetMyGroupsAsync(); - } - - [HttpPost] - [Route("groups/users/accept")] - public virtual async Task GroupAcceptUserAsync(GroupAcceptUserDto input) - { - await _chatAppService.GroupAcceptUserAsync(input); - } - - [HttpDelete] - [Route("groups/users/remove")] - public virtual async Task GroupRemoveUserAsync(GroupRemoveUserDto input) - { - await _chatAppService.GroupRemoveUserAsync(input); - } - [HttpGet] [Route("send-message")] public virtual async Task SendMessageAsync(ChatMessage input) diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db index 40ba6aaa23602db89128097f1b4125fac886eb9f..e31aebbf53c0f08566e37e0a15f9dd035601480f 100644 GIT binary patch delta 1629 zcmeHI&r4KM7=1pc(a{<2IELWQULjcvU-$Qqw}?upGz(=4%7P3PqD8wTD9s6R6G8GI zTC@cD6xzLUyQc z7eq)y!ky+TL;D}}1yzh1LovmD1ou(B_np3$QYotQkH*I*CnqK+<^~#L^m4;JRrIK2 zTnS~Ep$F(;W9gNDLUqr*2e(j#A2vSaScGKys;sbsJ;sH?QXFCjB~7@dnC-DEZnmCI z9f!Fl(+%jmQ-@|8^c8(VtLQy?gI=JS@)descZj`2@vL_aJxkXnYhcXp-Y$7gHUck~ zdprk4;O;h5nj&x^KjAr<2-u@>(h;zOa2iV>|NF_)xt-G4_vZ4OKQ95WB4`KjZ5lv5 zfDC{y%b$yX&Lq5+RJT*>22NQFZeXvK!pZ+~_*Xd$xd~9icJV~pW&4zPU3}P4dU6Mg zAG)a6lR8Dt*cbd1E#IYGho8~ zo{-$U6IswU_=Iq&NjN-Jv0!IXhw2+Gqq(yCctC_NIhT~NaAayQiih&HP)w_MJU~hML}FvA3^+H?6ys*i zvo|;_jMfS`9!xJ5(9+;a{Hl6vdPV$fi?5^*1V+Bkue_~{P&^(GP%=K2(oj}CyG)Fq z^>c+EF%W}{X{sfzK3E!v62DS>9q57hiU`^spBtrti6wZgl3=hc;9NKmiRUYnw6X`U d_7V(o!M$vj*nErnjs`*9Jmrp1h@dDwz|fHpQM5+CS7L2FG$ zM%$W*DaVCiYwAWyp-33xPDr$%i!PcpE?m`>LRV9|s2i#Oz4N#;GjJCF`Tld~JKz8P z|5@A!EpCKX2ID)HW%a;{!0NiVM|SM2oxGBGG!9|d-nQaDMdu?~dpnY~hA-~#EALMB zg$@y($I`{ZWzu0-39dCk1nt9U9}xj0vE)k0!|$CsH8(dqH)~n;bvsq;#Gjq$9v#i4 zUs`?btFT!ZJl{(+QA#kTB}WLGTgh`_?h<9L3=Jh(F=1xrkC{6uJL)Akf)RSO)GIf@pt0S#7$Ublh0=j z%E!vjQk4hD*ry6YEe;$HJE%@Us1l_gZ_iH!G|2-AX_eJNe zuF&4jNY1_;Uk{%R?X_>O75hWw<4fO%AG54bsgQ~_>o#%s=&0HJVmZbT2e}Z^NGY?G zTIR+)RHsn8KPc-IC)o0+>7S2UG~3(F>$; z4E7~c7?U`S>=6A0}EZTN0BHwoMQJc=N`*|o3TDle^>pWk$11@&SWt1q6?h2z2A-(V!U$+(x$VteE~|z7=`;mZ)+y&rR>1w%Qtf#@g^`RC3cZ?!01GIL$JZ>puZ1V35>n`9SO{aSjoup&e&MTyd0A9;#(pgOH4u=;R-!y+(^Bsfe6Gui*5U&HE- zgimPIRzrZ4*E5 - net5.0 + netcoreapp3.1 false diff --git a/aspnet-core/tests/LINGYUN.Abp.Features.LimitValidation.Tests/LINGYUN.Abp.Features.LimitValidation.Tests.csproj b/aspnet-core/tests/LINGYUN.Abp.Features.LimitValidation.Tests/LINGYUN.Abp.Features.LimitValidation.Tests.csproj index 3b0dad961..bce9ca44e 100644 --- a/aspnet-core/tests/LINGYUN.Abp.Features.LimitValidation.Tests/LINGYUN.Abp.Features.LimitValidation.Tests.csproj +++ b/aspnet-core/tests/LINGYUN.Abp.Features.LimitValidation.Tests/LINGYUN.Abp.Features.LimitValidation.Tests.csproj @@ -1,7 +1,7 @@ - net5.0 + netcoreapp3.1 false diff --git a/vueJs/src/components/InstantMessage/index.vue b/vueJs/src/components/InstantMessage/index.vue index 64f2568fa..e68c4f149 100644 --- a/vueJs/src/components/InstantMessage/index.vue +++ b/vueJs/src/components/InstantMessage/index.vue @@ -39,7 +39,7 @@ import { User } from '@/api/users' class MyContract { id = '' displayName = '' - avatar = '' + avatar = 'http://upload.qqbodys.com/allimg/1710/1035512943-0.jpg' type = '' index = 'A' unread = 0 @@ -92,10 +92,20 @@ class Message { this.content = chatMessage.content this.fromUser.id = chatMessage.formUserId this.fromUser.displayName = chatMessage.formUserName + this.fromUser.avatar = 'http://upload.qqbodys.com/allimg/1710/1035512943-0.jpg' this.toContactId = chatMessage.toUserId this.type = ChatMessage.getType(chatMessage.messageType) this.sendTime = new Date(chatMessage.sendTime).getTime() } + + public toChatMessage() { + const chatMessage = new ChatMessage() + chatMessage.formUserId = this.fromUser.id + chatMessage.formUserName = this.fromUser.displayName + chatMessage.toUserId = this.toContactId + chatMessage.content = this.content + return chatMessage + } } @Component({ @@ -129,6 +139,7 @@ export default class InstantMessage extends mixins(EventBusMiXin) { this.unSubscribeAll() this.subscribe('onShowImDialog', this.onShowImDialog) this.subscribe('onUserFriendAdded', this.onUserFriendAdded) + this.subscribe('onReceivedChatMessage', this.onReceivedChatMessage) this.handleInitDefaultMenus() this.handleStartConnection() } @@ -270,8 +281,7 @@ export default class InstantMessage extends mixins(EventBusMiXin) { next(messages, isEnd) }) .catch(() => { - next(new Array(), true) - imui.messageViewToBottom() + next([], true) }) } @@ -279,38 +289,41 @@ export default class InstantMessage extends mixins(EventBusMiXin) { console.log('Event:menu-avatar-click') } - private handleMessageClick(e: any, key: any, message: any) { + private handleMessageClick(e: any, key: any, message: Message) { console.log(e) console.log(key) console.log(message) - } - - private handleReceiveMessage(chatMessage: ChatMessage) { - const message = new Message() - message.fromChatMessage(chatMessage) const imui = this.$refs.IMUI as any - imui.appendMessage(message, chatMessage.formUserId) - const currentContact = imui.currentContact - if (currentContact && currentContact.id === chatMessage.formUserId) { - currentContact.lastContent = chatMessage.content - currentContact.lastSendTime = new Date(chatMessage.sendTime).getTime() - } else { - imui.updateContact(chatMessage.formUserId, { - unread: '+1', - lastSendTime: new Date(chatMessage.sendTime).getTime(), - lastContent: chatMessage.content + if (key === 'status') { + imui.updateMessage(message.id, message.toContactId, { + status: 'going' }) + const chatMessage = message.toChatMessage() + this.connection + .invoke('SendMessage', chatMessage) + .then(() => { + imui + .updateMessage(message.id, message.toContactId, { + status: 'succeed' + }) + }) + .catch(() => { + imui + .updateMessage(message.id, message.toContactId, { + status: 'failed' + }) + }) } } + private handleReceiveMessage(chatMessage: ChatMessage) { + this.trigger('onReceivedChatMessage', chatMessage) + } + private handleSendMessage(message: Message, next: any, file: any) { console.log(message, next, file) const imui = this.$refs.IMUI as any - const chatMessage = new ChatMessage() - chatMessage.formUserId = message.fromUser.id - chatMessage.formUserName = message.fromUser.displayName - chatMessage.toUserId = message.toContactId - chatMessage.content = message.content + const chatMessage = message.toChatMessage() this.connection .invoke('SendMessage', chatMessage) .then(() => { @@ -326,12 +339,32 @@ export default class InstantMessage extends mixins(EventBusMiXin) { }) } + private onReceivedChatMessage(chatMessage: ChatMessage) { + const message = new Message() + message.fromChatMessage(chatMessage) + const imui = this.$refs.IMUI as any + imui.appendMessage(message, chatMessage.formUserId) + const currentContact = imui.currentContact + if (currentContact && currentContact.id === chatMessage.formUserId) { + currentContact.lastContent = chatMessage.content + currentContact.lastSendTime = new Date(chatMessage.sendTime).getTime() + } else { + imui.updateContact(chatMessage.formUserId, { + unread: '+1', + lastSendTime: new Date(chatMessage.sendTime).getTime(), + lastContent: chatMessage.content + }) + } + } + private onChangeContract(contract: any) { const imui = this.$refs.IMUI as any imui.updateContact(contract.id, { unread: 0 }) imui.closeDrawer() + imui.forceUpdateMessage() + console.log(imui.contacts) } private onUserFriendAdded(user: User) { diff --git a/vueJs/src/components/Notification/index.vue b/vueJs/src/components/Notification/index.vue index 09339c7c9..73a217b4a 100644 --- a/vueJs/src/components/Notification/index.vue +++ b/vueJs/src/components/Notification/index.vue @@ -53,6 +53,9 @@ export default class extends mixins(EventBusMiXin) { this.subscribe('onNotificationReadChanged', () => { this.notificationCount -= 1 }) + this.subscribe('onReceivedChatMessage', () => { + this.notificationCount += 1 + }) } } From faf7e87074b6e5fc4322da1bc335bab60fa2c1d9 Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Thu, 29 Oct 2020 11:51:23 +0800 Subject: [PATCH 07/10] Optimize instant messaging module --- .../common/LINGYUN.Abp.IM.SignalR/LINGYUN.Abp.IM.SignalR.csproj | 2 +- .../LINGYUN.Abp.Notifications.SignalR.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN.Abp.IM.SignalR.csproj b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN.Abp.IM.SignalR.csproj index f7a1552f9..5133bac5e 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN.Abp.IM.SignalR.csproj +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN.Abp.IM.SignalR.csproj @@ -15,7 +15,7 @@ - + diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN.Abp.Notifications.SignalR.csproj b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN.Abp.Notifications.SignalR.csproj index 624125a8a..dd13d27ba 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN.Abp.Notifications.SignalR.csproj +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN.Abp.Notifications.SignalR.csproj @@ -15,7 +15,7 @@ - + From fce050f1ea25adead76f980e9584d8ce278092a8 Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Sun, 1 Nov 2020 11:57:29 +0800 Subject: [PATCH 08/10] Enhance IM functionality --- aspnet-core/LINGYUN.MicroService.sln | 23 +- .../database/ApiGateway-Init-SqlServer.sql | 20 +- aspnet-core/database/ApiGateway-Init.sql | 98 ++- ...bp.AspNetCore.SignalR.Protocol.Json.csproj | 15 + .../AbpAspNetCoreSignalRProtocolJsonModule.cs | 22 + ...Abp.ExceptionHandling.Notifications.csproj | 15 + ...nHandlingNotificationDefinitionProvider.cs | 22 +- .../AbpExceptionHandlingNotificationNames.cs | 3 +- ...AbpNotificationsExceptionHandlingModule.cs | 19 +- .../AbpNotificationsExceptionSubscriber.cs | 29 +- .../Localization/Resources/en.json | 7 + .../Localization/Resources/zh-Hans.json | 7 + .../LINGYUN.Abp.ExceptionHandling.csproj | 2 +- .../AbpExceptionHandlingModule.cs | 12 +- .../Localization/ExceptionHandlingResource.cs | 9 + .../Abp/IM/SignalR/AbpIMSignalRModule.cs | 9 +- .../Abp/IM/SignalR/Hubs/MessagesHub.cs | 74 +- ...der.cs => SignalRMessageSenderProvider.cs} | 15 +- .../LINGYUN.Abp.IM/LINGYUN.Abp.IM.csproj | 1 + .../LINGYUN/Abp/IM/AbpIMModule.cs | 10 + .../LINGYUN/Abp/IM/AbpIMOptions.cs | 15 + .../LINGYUN/Abp/IM/Contract/IFriendStore.cs | 47 +- .../LINGYUN/Abp/IM/Group/IUserGroupStore.cs | 44 +- .../LINGYUN/Abp/IM/Messages/ChatMessage.cs | 2 +- .../Abp/IM/Messages/IMessageSenderProvider.cs | 10 + .../Messages/IMessageSenderProviderManager.cs | 9 + .../LINGYUN/Abp/IM/Messages/IMessageStore.cs | 20 +- .../LINGYUN/Abp/IM/Messages/MessageSender.cs | 26 + .../Abp/IM/Messages/MessageSenderBase.cs | 47 -- .../IM/Messages/MessageSenderProviderBase.cs | 70 ++ .../Messages/MessageSenderProviderManager.cs | 33 + .../Abp/IM/Messages/NullMessageSender.cs | 26 - .../SignalR/Hubs/NotificationsHub.cs | 41 +- .../SignalRNotificationPublishProvider.cs | 71 +- ...GYUN.Abp.Notifications.WeChat.WeApp.csproj | 1 + .../WeChatWeAppFeatureDefinitionProvider.cs | 54 ++ .../WeApp/Features/WeChatWeAppFeatures.cs | 30 + .../WeApp/IWeChatWeAppNotificationSender.cs | 5 +- .../WeChatWeAppNotificationPublishProvider.cs | 58 +- .../WeApp/WeChatWeAppNotificationSender.cs | 21 +- .../Notifications/AbpNotificationModule.cs | 5 - .../INotificationDefinitionContext.cs | 15 +- .../INotificationDefinitionManager.cs | 6 +- .../Notifications/INotificationDispatcher.cs | 41 +- .../Abp/Notifications/INotificationSender.cs | 41 + .../Abp/Notifications/INotificationStore.cs | 151 +++- .../INotificationSubscriptionManager.cs | 53 +- .../Internal/DefaultNotificationDispatcher.cs | 220 ----- .../Internal/NotificationSender.cs | 78 ++ .../NotificationSubscriptionManager.cs | 72 +- .../Notifications/LocalizableStringInfo.cs | 23 + .../Abp/Notifications/NotificationData.cs | 91 +-- .../NotificationDataConverter.cs | 31 + .../NotificationDataMappingDictionary.cs | 14 +- .../Notifications/NotificationDefinition.cs | 27 +- .../NotificationDefinitionContext.cs | 46 +- .../NotificationDefinitionManager.cs | 78 +- .../Notifications/NotificationEventData.cs | 30 +- .../NotificationGroupDefinition.cs | 70 ++ .../Abp/Notifications/NotificationInfo.cs | 30 +- .../Abp/Notifications/NotificationName.cs | 14 - .../NotificationNameNormalizer.cs | 15 - .../Notifications/NotificationPublishJob.cs | 4 +- .../NotificationPublishProvider.cs | 12 +- .../Notifications/NullNotificationStore.cs | 123 ++- .../LINGYUN.Abp.RealTime.SignalR/Class1.cs | 8 - .../SignalR/AbpRealTimeSignalRModule.cs | 1 + .../SignalR/Hubs/OnlineClientHubBase.cs | 86 +- .../LINGYUN/Abp/RealTime/Client/IClient.cs | 10 + .../Abp/RealTime/Client/IOnlineClient.cs | 6 +- .../RealTime/Client/IOnlineClientManager.cs | 3 + .../Abp/RealTime/Client/IOnlineClientStore.cs | 6 +- .../Client/InMemoryOnlineClientStore.cs | 12 +- .../Abp/RealTime/Client/OnlineClient.cs | 11 +- .../RealTime/Client/OnlineClientManager.cs | 11 +- .../LINGYUN.Abp.WeChat.Authorization.csproj | 4 + .../AbpWeChatAuthorizationModule.cs | 5 +- .../OpenId/IUserWeChatCodeFinder.cs | 12 + .../OpenId/IWeChatOpenIdFinder.cs | 7 +- .../OpenId/NullUserWeChatCodeFinder.cs | 19 + .../OpenId/WeChatOpenIdCacheItem.cs | 6 +- .../OpenId/WeChatOpenIdFinder.cs | 27 +- .../Token/IWeChatTokenProvider.cs | 5 +- .../Token/WeChatTokenProvider.cs | 13 +- .../WeChatAuthorizationConsts.cs | 22 + .../Abp/Identity/IIdentityUserAppService.cs | 1 - .../WeChatTokenGrantValidator.cs | 8 +- .../Authorization/UserWeChatCodeFinder.cs | 40 + .../Chat/Dto/MyFriendAddRequestDto.cs | 7 + .../Chat/Dto/MyFriendCreateDto.cs | 1 - .../Chat/IMyFriendAppService.cs | 2 + .../Localization/ApplicationContracts/en.json | 4 +- .../ApplicationContracts/zh-Hans.json | 4 +- .../Notifications/Dto/NotificationDto.cs | 28 + .../Notifications/Dto/NotificationGroupDto.cs | 11 + .../Notifications/Dto/NotificationSendDto.cs | 22 + .../Dto/UserNotificationGetByPagedDto.cs | 2 + .../IMyNotificationAppService.cs | 21 + .../Notifications/INotificationAppService.cs | 41 - .../Permissions/MessageServicePermissions.cs | 7 + ...ageServicePermissionsDefinitionProvider.cs | 3 + .../Dto/SubscriptionsGetByNameDto.cs | 2 +- .../Dto/UserSubscreNotificationDto.cs | 7 + .../Dto/UserSubscriptionsResult.cs | 22 + .../IMySubscriptionAppService.cs | 39 + .../Subscriptions/ISubscriptionAppService.cs | 35 - .../MessageService/Chat/MyFriendAppService.cs | 19 +- .../Notifications/MyNotificationAppService.cs | 119 +++ .../Notifications/NotificationAppService.cs | 68 -- .../Subscriptions/MySubscriptionAppService.cs | 76 ++ .../Subscriptions/SubscriptionAppService.cs | 65 -- ...UN.Abp.MessageService.Domain.Shared.csproj | 4 + .../Chat/UserChatFriendConsts.cs | 8 + ...sageServiceModuleExtensionConfiguration.cs | 17 + ...ensionConfigurationDictionaryExtensions.cs | 18 + .../MessageServiceModuleExtensionConsts.cs | 12 + .../AbpMessageServiceDomainModule.cs | 18 +- .../Abp/MessageService/Chat/FriendStore.cs | 213 +++-- .../Chat/IUserChatFriendRepository.cs | 7 +- .../Chat/IUserChatSettingRepository.cs | 5 +- .../Abp/MessageService/Chat/Message.cs | 3 +- .../Abp/MessageService/Chat/MessageStore.cs | 147 ++-- .../Abp/MessageService/Chat/UserCardFinder.cs | 24 +- .../Abp/MessageService/Chat/UserChatFriend.cs | 11 +- .../Local/UserChatFriendEventHandler.cs | 71 +- .../Local/UserCreateJoinIMEventHandler.cs | 35 +- .../UserCreateSendWelcomeEventHandler.cs | 131 +-- .../MessageService/Group/UserGroupStore.cs | 112 ++- .../Localization/Resources/en.json | 18 +- .../Localization/Resources/zh-Hans.json | 18 +- .../MessageServiceDomainAutoMapperProfile.cs | 83 +- .../Mapper/NotificationTypeConverter.cs | 39 + ...geServiceNotificationDefinitionProvider.cs | 71 +- .../Notifications/INotificationRepository.cs | 11 +- .../IUserNotificationRepository.cs | 43 +- .../MessageServiceNotificationNames.cs | 33 + .../Notifications/Notification.cs | 10 +- .../Notifications/NotificationStore.cs | 343 +++++--- .../Abp/MessageService/Packages/Emoji.cs | 29 + .../Subscriptions/IUserSubscribeRepository.cs | 56 +- .../Chat/EfCoreUserChatFriendRepository.cs | 12 +- .../Chat/EfCoreUserChatSettingRepository.cs | 9 +- ...MessageServiceEntityFrameworkCoreModule.cs | 1 + .../IMessageServiceDbContext.cs | 1 + .../MessageServiceDbContext.cs | 1 + ...ServiceDbContextModelCreatingExtensions.cs | 28 +- .../Group/EfCoreUserChatGroupRepository.cs | 2 +- .../EfCoreNotificationRepository.cs | 14 +- .../EfCoreUserNotificationRepository.cs | 119 ++- .../EfCoreUserSubscribeRepository.cs | 85 +- .../MessageService/Chat/MyFriendController.cs | 7 + .../Notifications/MyNotificationController.cs | 55 ++ .../Notifications/NotificationController.cs | 56 -- .../Subscriptions/MySubscriptionController.cs | 53 ++ .../Subscriptions/SubscriptionController.cs | 47 -- .../LINGYUN.Abp.WeChat.csproj | 24 + .../LINGYUN/Abp/WeChat/AbpWeChatModule.cs | 27 + .../WeChatFeatureDefinitionProvider.cs | 19 + .../Abp/WeChat/Features/WeChatFeatures.cs | 7 + .../Abp/WeChat/Localization/Resources/en.json | 6 + .../Localization/Resources/zh-Hans.json | 6 + .../Abp/WeChat/Localization/WeChatResource.cs | 9 + .../LINGYUN.ApiGateway.Host/event-bus-cap.db | Bin 40960 -> 40960 bytes .../ApiGatewayHttpApiHostModule.cs | 3 +- .../AbpMessageServiceHttpApiHostModule.cs | 2 + .../Distributed/ChatMessageEventHandler.cs | 52 ++ .../Distributed/NotificationEventHandler.cs | 129 ++- .../Distributed/TenantCreateEventHandler.cs | 24 +- .../Hangfire/HangfireDashboardRouteOptions.cs | 26 +- ...YUN.Abp.MessageService.HttpApi.Host.csproj | 1 + .../Localization/HttpApiHost/en.json | 6 +- .../Localization/HttpApiHost/zh-Hans.json | 6 +- ...rChatFriend-Column-Description.Designer.cs | 588 +++++++++++++ ...6_Add-UserChatFriend-Column-Description.cs | 116 +++ ...essage-Entity-To-AggregateRoot.Designer.cs | 612 ++++++++++++++ ...9_Based-Message-Entity-To-AggregateRoot.cs | 51 ++ ...iceHostMigrationsDbContextModelSnapshot.cs | 424 +++++----- .../MessageServiceDefinitionProvider.cs | 25 - ...sageServicePermissionDefinitionProvider.cs | 22 - .../AbpMessageServicePermissions.cs | 12 - vueJs/package-lock.json | 187 +---- vueJs/package.json | 1 - vueJs/src/api/instant-message.ts | 15 + vueJs/src/api/notification.ts | 116 +++ vueJs/src/assets/im-images/top-buttom.png | Bin 0 -> 5520 bytes vueJs/src/components/InstantMessage/index.vue | 465 ----------- .../components/AddFriend.vue | 7 +- .../Lemon-IMUI/components/Avatar.vue | 54 -- vueJs/src/components/Lemon-IMUI/index.vue | 773 ++++++++++++++++++ .../components/UserNofitications.vue | 115 ++- vueJs/src/components/Notification/index.vue | 4 +- vueJs/src/icons/components/im.ts | 12 + vueJs/src/icons/components/index.ts | 1 + vueJs/src/icons/svg/im.svg | 1 + vueJs/src/layout/index.vue | 50 +- vueJs/src/shims.d.ts | 4 + vueJs/src/views/dashboard/index.vue | 13 +- .../profile-setting/components/MyNotifier.vue | 79 ++ vueJs/src/views/profile-setting/index.vue | 6 +- 199 files changed, 6557 insertions(+), 2883 deletions(-) create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json/LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json.csproj create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json/LINGYUN/Abp/AspNetCore/SignalR/Protocol/Json/AbpAspNetCoreSignalRProtocolJsonModule.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/Localization/Resources/en.json create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/Localization/Resources/zh-Hans.json create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling/LINGYUN/Abp/ExceptionHandling/Localization/ExceptionHandlingResource.cs rename aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/{SignalRMessageSender.cs => SignalRMessageSenderProvider.cs} (84%) create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/AbpIMModule.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/AbpIMOptions.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageSenderProvider.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageSenderProviderManager.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSender.cs delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSenderBase.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSenderProviderBase.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSenderProviderManager.cs delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/NullMessageSender.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/Features/WeChatWeAppFeatureDefinitionProvider.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/Features/WeChatWeAppFeatures.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationSender.cs delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/DefaultNotificationDispatcher.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/NotificationSender.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/LocalizableStringInfo.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDataConverter.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationGroupDefinition.cs delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationName.cs delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationNameNormalizer.cs delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/Class1.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/IClient.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/IUserWeChatCodeFinder.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/NullUserWeChatCodeFinder.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/WeChatAuthorizationConsts.cs create mode 100644 aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.WeChatValidator/LINGYUN/Abp/WeChat/Authorization/UserWeChatCodeFinder.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendAddRequestDto.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationDto.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationGroupDto.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationSendDto.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/IMyNotificationAppService.cs delete mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/INotificationAppService.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/Dto/UserSubscreNotificationDto.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/Dto/UserSubscriptionsResult.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/IMySubscriptionAppService.cs delete mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/ISubscriptionAppService.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Notifications/MyNotificationAppService.cs delete mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Notifications/NotificationAppService.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Subscriptions/MySubscriptionAppService.cs delete mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Subscriptions/SubscriptionAppService.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Chat/UserChatFriendConsts.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/ObjectExtending/MessageServiceModuleExtensionConfiguration.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/ObjectExtending/MessageServiceModuleExtensionConfigurationDictionaryExtensions.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/ObjectExtending/MessageServiceModuleExtensionConsts.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/NotificationTypeConverter.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/MessageServiceNotificationNames.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Packages/Emoji.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Notifications/MyNotificationController.cs delete mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Notifications/NotificationController.cs create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Subscriptions/MySubscriptionController.cs delete mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Subscriptions/SubscriptionController.cs create mode 100644 aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN.Abp.WeChat.csproj create mode 100644 aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/AbpWeChatModule.cs create mode 100644 aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Features/WeChatFeatureDefinitionProvider.cs create mode 100644 aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Features/WeChatFeatures.cs create mode 100644 aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/Resources/en.json create mode 100644 aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/Resources/zh-Hans.json create mode 100644 aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/WeChatResource.cs create mode 100644 aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Distributed/ChatMessageEventHandler.cs create mode 100644 aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201029102936_Add-UserChatFriend-Column-Description.Designer.cs create mode 100644 aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201029102936_Add-UserChatFriend-Column-Description.cs create mode 100644 aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201030032219_Based-Message-Entity-To-AggregateRoot.Designer.cs create mode 100644 aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201030032219_Based-Message-Entity-To-AggregateRoot.cs delete mode 100644 aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Notifications/MessageServiceDefinitionProvider.cs delete mode 100644 aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Permissions/AbpMessageServicePermissionDefinitionProvider.cs delete mode 100644 aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Permissions/AbpMessageServicePermissions.cs create mode 100644 vueJs/src/api/notification.ts create mode 100644 vueJs/src/assets/im-images/top-buttom.png delete mode 100644 vueJs/src/components/InstantMessage/index.vue rename vueJs/src/components/{InstantMessage => Lemon-IMUI}/components/AddFriend.vue (95%) delete mode 100644 vueJs/src/components/Lemon-IMUI/components/Avatar.vue create mode 100644 vueJs/src/icons/components/im.ts create mode 100644 vueJs/src/icons/svg/im.svg create mode 100644 vueJs/src/views/profile-setting/components/MyNotifier.vue diff --git a/aspnet-core/LINGYUN.MicroService.sln b/aspnet-core/LINGYUN.MicroService.sln index 8c07c2fe9..a2aaa2ce2 100644 --- a/aspnet-core/LINGYUN.MicroService.sln +++ b/aspnet-core/LINGYUN.MicroService.sln @@ -253,7 +253,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Account.Web", " EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.AspNetCore.SignalR.JwtToken", "modules\common\LINGYUN.Abp.AspNetCore.SignalR\LINGYUN.Abp.AspNetCore.SignalR.JwtToken.csproj", "{A66D48C9-F141-4111-9169-CEB64AFFF61D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.RealTime.SignalR", "modules\common\LINGYUN.Abp.RealTime.SignalR\LINGYUN.Abp.RealTime.SignalR.csproj", "{524276E1-053D-4191-ABF7-4CDA01BFFBC3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.RealTime.SignalR", "modules\common\LINGYUN.Abp.RealTime.SignalR\LINGYUN.Abp.RealTime.SignalR.csproj", "{524276E1-053D-4191-ABF7-4CDA01BFFBC3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json", "modules\common\LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json\LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json.csproj", "{43083268-74DE-4C68-824A-FB0CEC77358D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wechat", "wechat", "{DD9BE9E7-F6BF-4869-BCD2-82F5072BDA21}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.WeChat", "modules\wechat\LINGYUN.Abp.WeChat\LINGYUN.Abp.WeChat.csproj", "{BAE74ABC-1096-495F-A624-BEBFBC1896F2}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -677,6 +683,14 @@ Global {524276E1-053D-4191-ABF7-4CDA01BFFBC3}.Debug|Any CPU.Build.0 = Debug|Any CPU {524276E1-053D-4191-ABF7-4CDA01BFFBC3}.Release|Any CPU.ActiveCfg = Release|Any CPU {524276E1-053D-4191-ABF7-4CDA01BFFBC3}.Release|Any CPU.Build.0 = Release|Any CPU + {43083268-74DE-4C68-824A-FB0CEC77358D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {43083268-74DE-4C68-824A-FB0CEC77358D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {43083268-74DE-4C68-824A-FB0CEC77358D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {43083268-74DE-4C68-824A-FB0CEC77358D}.Release|Any CPU.Build.0 = Release|Any CPU + {BAE74ABC-1096-495F-A624-BEBFBC1896F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BAE74ABC-1096-495F-A624-BEBFBC1896F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BAE74ABC-1096-495F-A624-BEBFBC1896F2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BAE74ABC-1096-495F-A624-BEBFBC1896F2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -736,8 +750,8 @@ Global {0D1DB712-B48D-4FB7-9A47-694C668A62E3} = {608A3BD0-FC8D-48B0-B1C5-F3203A3BE99F} {9E12ADBF-713B-4FE7-B71F-52B5078A57CE} = {3CDBA2A6-DC8A-48C5-8A6C-AF207394B43D} {02043AD5-5E06-4EDD-8162-983E766C38EC} = {0439B173-F41E-4CE0-A44A-CCB70328F272} - {85EF4251-EFC4-4CC9-912B-EA5DB1E2E359} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} - {263A8A1C-69D0-4C3F-B33E-8F0831C146EB} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} + {85EF4251-EFC4-4CC9-912B-EA5DB1E2E359} = {DD9BE9E7-F6BF-4869-BCD2-82F5072BDA21} + {263A8A1C-69D0-4C3F-B33E-8F0831C146EB} = {DD9BE9E7-F6BF-4869-BCD2-82F5072BDA21} {47CC8F7A-681D-42B9-AE04-78453782C1B6} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} {F595CB9F-B117-4D62-A1AE-48599927DB36} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} {5CF403B2-47C9-4E4E-8856-0294BDD64884} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} @@ -805,6 +819,9 @@ Global {5F43141B-6C63-4547-B9D6-D69EC3D7CA7E} = {9E72FEB9-A626-4312-892B-CDD043879758} {A66D48C9-F141-4111-9169-CEB64AFFF61D} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} {524276E1-053D-4191-ABF7-4CDA01BFFBC3} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} + {43083268-74DE-4C68-824A-FB0CEC77358D} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} + {DD9BE9E7-F6BF-4869-BCD2-82F5072BDA21} = {C5CAD011-DF84-4914-939C-0C029DCEF26F} + {BAE74ABC-1096-495F-A624-BEBFBC1896F2} = {DD9BE9E7-F6BF-4869-BCD2-82F5072BDA21} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718} diff --git a/aspnet-core/database/ApiGateway-Init-SqlServer.sql b/aspnet-core/database/ApiGateway-Init-SqlServer.sql index 2948fa0a7..07fb68143 100644 --- a/aspnet-core/database/ApiGateway-Init-SqlServer.sql +++ b/aspnet-core/database/ApiGateway-Init-SqlServer.sql @@ -11,7 +11,7 @@ Target Server Version : 12000000 File Encoding : 65001 - Date: 23/10/2020 19:14:11 + Date: 31/10/2020 11:29:14 */ @@ -120,7 +120,7 @@ GO BEGIN TRANSACTION GO -INSERT INTO [apigateway].[appapigatewayauthoptions] VALUES (N'3', N'1261299170387169280', NULL, N''), (N'4', N'1261585859064872960', NULL, N''), (N'5', N'1261586605810368512', NULL, N''), (N'6', N'1261587558609436672', NULL, N''), (N'7', N'1261588213298348032', NULL, N''), (N'8', N'1261588367619375104', NULL, N''), (N'9', N'1261588628450557952', NULL, N''), (N'10', N'1261588881564221440', NULL, N''), (N'11', N'1261588983053795328', NULL, N''), (N'12', N'1261589139039961088', NULL, N''), (N'13', N'1261589197483393024', NULL, N''), (N'14', N'1261589278857084928', NULL, N''), (N'15', N'1261589420356124672', NULL, N''), (N'16', N'1261589960393736192', NULL, N''), (N'17', N'1261606600242085888', NULL, N''), (N'18', N'1261606689601732608', NULL, N''), (N'21', N'1262220447629058048', NULL, N''), (N'22', N'1262230734939758592', NULL, N''), (N'23', N'1262296916350869504', NULL, N''), (N'24', N'1262632376348594176', N'', N''), (N'25', N'1262632791869902848', N'', N''), (N'28', N'1262660336921235456', N'', N''), (N'29', N'1262660528277966848', N'', N''), (N'30', N'1262660706875625472', N'', N''), (N'31', N'1262660966393991168', N'', N''), (N'32', N'1262661109474283520', N'', N''), (N'33', N'1262663888804663296', N'', N''), (N'34', N'1262664024096133120', N'', N''), (N'35', N'1262664186252120064', N'', N''), (N'36', N'1262664357044178944', N'', N''), (N'37', N'1262664632928718848', N'', N''), (N'38', N'1262664751409418240', N'', N''), (N'39', N'1262664871274237952', N'', N''), (N'40', N'1262665026111164416', N'', N''), (N'41', N'1262665159905267712', N'', N''), (N'42', N'1262665329829105664', N'', N''), (N'43', N'1262665456471920640', N'', N''), (N'44', N'1262665628165754880', N'', N''), (N'45', N'1262666172682883072', N'', N''), (N'47', N'1262723402331885568', N'', N''), (N'48', N'1262935771746734080', N'', N''), (N'49', N'1262935906522304512', N'', N''), (N'52', N'1263074419073593344', N'', N''), (N'53', N'1263075249394790400', N'', N''), (N'54', N'1263075593499684864', N'', N''), (N'56', N'1263101898440146944', N'', N''), (N'57', N'1263303878648569856', N'', N''), (N'58', N'1263304204797648896', N'', N''), (N'59', N'1263304872891555840', N'', N''), (N'60', N'1263305106250047488', N'', N''), (N'61', N'1263305244594970624', N'', N''), (N'62', N'1263305430536855552', N'', N''), (N'63', N'1263639172959174656', N'', N''), (N'64', N'1264799968944640000', N'', N''), (N'65', N'1264800070161584128', N'', N''), (N'66', N'1267360794414161920', N'', N''), (N'67', N'1267383367629807616', N'', N''), (N'68', N'1267817055527632896', N'', N''), (N'69', N'1267817221286526976', N'', N''), (N'70', N'1268893687085518848', N'', N''), (N'94', N'1288657613998579712', N'', N''), (N'95', N'1288657941770854400', N'', N''), (N'96', N'1288658134067109888', N'', N''), (N'97', N'1288658305156964352', N'', N''), (N'98', N'1288658491216289792', N'', N''), (N'99', N'1288658638302142464', N'', N''), (N'100', N'1288658791784308736', N'', N''), (N'101', N'1290849478956199936', N'', N''), (N'102', N'1290849628051124224', N'', N''), (N'103', N'1290849798553776128', N'', N''), (N'105', N'1291259822512693248', N'', N''), (N'106', N'1292620505149145088', N'', N''), (N'107', N'1292620665505775616', N'', N''), (N'108', N'1292620843398791168', N'', N''), (N'109', N'1292621027574874112', N'', N''), (N'110', N'1292621363161137152', N'', N''), (N'111', N'1292621494837116928', N'', N''), (N'112', N'1292621629260365824', N'', N''), (N'113', N'1292622526073864192', N'', N''), (N'114', N'1293470838745821184', N'', N''), (N'115', N'1293471661785706496', N'', N''), (N'116', N'1293472678392721408', N'', N''), (N'117', N'1293472857510473728', N'', N''), (N'118', N'1299273336009359360', N'', N''), (N'119', N'1299273436282585088', N'', N''), (N'120', N'1299273618470567936', N'', N''), (N'121', N'1299273770182737920', N'', N''), (N'122', N'1299273978023084032', N'', N''), (N'123', N'1299274123225694208', N'', N''), (N'124', N'1299274222299348992', N'', N''), (N'125', N'1304238876758495232', N'', N''), (N'126', N'1304678610343383040', N'', N''), (N'127', N'1304679169305694208', N'', N''), (N'128', N'1310460417141817344', N'', N''), (N'129', N'1310502391475519488', N'', N''), (N'130', N'1310515546943569920', N'', N''), (N'131', N'1310515735292985344', N'', N''), (N'132', N'1316628769783480320', N'', N''), (N'133', N'1316628940663619584', N'', N''), (N'134', N'1316629112428756992', N'', N''), (N'135', N'1316652047017246720', N'', N''), (N'136', N'1316913899996737536', N'', N''), (N'137', N'1319200951383199744', N'', N''), (N'138', N'1319221929807024128', N'', N''), (N'139', N'1319554431134306304', N'', N''), (N'140', N'1319554550458060800', N'', N''), (N'141', N'1319554948434595840', N'', N''), (N'142', N'1319555067183730688', N'', N''), (N'143', N'1319555230765780992', N'', N''), (N'144', N'1319555333790470144', N'', N'') +INSERT INTO [apigateway].[appapigatewayauthoptions] VALUES (N'3', N'1261299170387169280', NULL, N''), (N'4', N'1261585859064872960', NULL, N''), (N'5', N'1261586605810368512', NULL, N''), (N'6', N'1261587558609436672', NULL, N''), (N'7', N'1261588213298348032', NULL, N''), (N'8', N'1261588367619375104', NULL, N''), (N'9', N'1261588628450557952', NULL, N''), (N'10', N'1261588881564221440', NULL, N''), (N'11', N'1261588983053795328', NULL, N''), (N'12', N'1261589139039961088', NULL, N''), (N'13', N'1261589197483393024', NULL, N''), (N'14', N'1261589278857084928', NULL, N''), (N'15', N'1261589420356124672', NULL, N''), (N'16', N'1261589960393736192', NULL, N''), (N'17', N'1261606600242085888', NULL, N''), (N'18', N'1261606689601732608', NULL, N''), (N'21', N'1262220447629058048', NULL, N''), (N'22', N'1262230734939758592', NULL, N''), (N'23', N'1262296916350869504', NULL, N''), (N'24', N'1262632376348594176', N'', N''), (N'25', N'1262632791869902848', N'', N''), (N'28', N'1262660336921235456', N'', N''), (N'29', N'1262660528277966848', N'', N''), (N'30', N'1262660706875625472', N'', N''), (N'31', N'1262660966393991168', N'', N''), (N'32', N'1262661109474283520', N'', N''), (N'33', N'1262663888804663296', N'', N''), (N'34', N'1262664024096133120', N'', N''), (N'35', N'1262664186252120064', N'', N''), (N'36', N'1262664357044178944', N'', N''), (N'37', N'1262664632928718848', N'', N''), (N'38', N'1262664751409418240', N'', N''), (N'39', N'1262664871274237952', N'', N''), (N'40', N'1262665026111164416', N'', N''), (N'41', N'1262665159905267712', N'', N''), (N'42', N'1262665329829105664', N'', N''), (N'43', N'1262665456471920640', N'', N''), (N'44', N'1262665628165754880', N'', N''), (N'45', N'1262666172682883072', N'', N''), (N'47', N'1262723402331885568', N'', N''), (N'48', N'1262935771746734080', N'', N''), (N'49', N'1262935906522304512', N'', N''), (N'52', N'1263074419073593344', N'', N''), (N'53', N'1263075249394790400', N'', N''), (N'54', N'1263075593499684864', N'', N''), (N'56', N'1263101898440146944', N'', N''), (N'57', N'1263303878648569856', N'', N''), (N'58', N'1263304204797648896', N'', N''), (N'59', N'1263304872891555840', N'', N''), (N'60', N'1263305106250047488', N'', N''), (N'61', N'1263305244594970624', N'', N''), (N'62', N'1263305430536855552', N'', N''), (N'63', N'1263639172959174656', N'', N''), (N'64', N'1264799968944640000', N'', N''), (N'65', N'1264800070161584128', N'', N''), (N'66', N'1267360794414161920', N'', N''), (N'67', N'1267383367629807616', N'', N''), (N'68', N'1267817055527632896', N'', N''), (N'69', N'1267817221286526976', N'', N''), (N'70', N'1268893687085518848', N'', N''), (N'94', N'1288657613998579712', N'', N''), (N'95', N'1288657941770854400', N'', N''), (N'96', N'1288658134067109888', N'', N''), (N'97', N'1288658305156964352', N'', N''), (N'98', N'1288658491216289792', N'', N''), (N'99', N'1288658638302142464', N'', N''), (N'100', N'1288658791784308736', N'', N''), (N'101', N'1290849478956199936', N'', N''), (N'102', N'1290849628051124224', N'', N''), (N'103', N'1290849798553776128', N'', N''), (N'105', N'1291259822512693248', N'', N''), (N'106', N'1292620505149145088', N'', N''), (N'107', N'1292620665505775616', N'', N''), (N'108', N'1292620843398791168', N'', N''), (N'109', N'1292621027574874112', N'', N''), (N'110', N'1292621363161137152', N'', N''), (N'111', N'1292621494837116928', N'', N''), (N'112', N'1292621629260365824', N'', N''), (N'113', N'1292622526073864192', N'', N''), (N'114', N'1293470838745821184', N'', N''), (N'115', N'1293471661785706496', N'', N''), (N'116', N'1293472678392721408', N'', N''), (N'117', N'1293472857510473728', N'', N''), (N'118', N'1299273336009359360', N'', N''), (N'119', N'1299273436282585088', N'', N''), (N'120', N'1299273618470567936', N'', N''), (N'121', N'1299273770182737920', N'', N''), (N'122', N'1299273978023084032', N'', N''), (N'123', N'1299274123225694208', N'', N''), (N'124', N'1299274222299348992', N'', N''), (N'125', N'1304238876758495232', N'', N''), (N'126', N'1304678610343383040', N'', N''), (N'127', N'1304679169305694208', N'', N''), (N'128', N'1310460417141817344', N'', N''), (N'129', N'1310502391475519488', N'', N''), (N'130', N'1310515546943569920', N'', N''), (N'131', N'1310515735292985344', N'', N''), (N'132', N'1316628769783480320', N'', N''), (N'133', N'1316628940663619584', N'', N''), (N'134', N'1316629112428756992', N'', N''), (N'135', N'1316652047017246720', N'', N''), (N'136', N'1316913899996737536', N'', N''), (N'137', N'1319200951383199744', N'', N''), (N'138', N'1319221929807024128', N'', N''), (N'139', N'1319554431134306304', N'', N''), (N'140', N'1319554550458060800', N'', N''), (N'141', N'1319554948434595840', N'', N''), (N'142', N'1319555067183730688', N'', N''), (N'143', N'1319555230765780992', N'', N''), (N'144', N'1319555333790470144', N'', N''), (N'145', N'1321001932510203904', N'', N''), (N'146', N'1321002059803136000', N'', N''), (N'147', N'1321002256440496128', N'', N''), (N'148', N'1321002350686507008', N'', N''), (N'149', N'1322190027988525056', N'', N'') GO COMMIT @@ -151,7 +151,7 @@ GO BEGIN TRANSACTION GO -INSERT INTO [apigateway].[appapigatewaybalanceroptions] VALUES (N'1', N'1260841964962947072', NULL, N'LeastConnection', NULL, NULL), (N'4', NULL, N'1261299170387169280', N'LeastConnection', NULL, N'60000'), (N'5', NULL, N'1261585859064872960', NULL, NULL, NULL), (N'6', NULL, N'1261586605810368512', NULL, NULL, NULL), (N'7', NULL, N'1261587558609436672', NULL, NULL, NULL), (N'8', NULL, N'1261588213298348032', NULL, NULL, NULL), (N'9', NULL, N'1261588367619375104', NULL, NULL, NULL), (N'10', NULL, N'1261588628450557952', NULL, NULL, NULL), (N'11', NULL, N'1261588881564221440', NULL, NULL, NULL), (N'12', NULL, N'1261588983053795328', NULL, NULL, NULL), (N'13', NULL, N'1261589139039961088', NULL, NULL, NULL), (N'14', NULL, N'1261589197483393024', NULL, NULL, NULL), (N'15', NULL, N'1261589278857084928', NULL, NULL, NULL), (N'16', NULL, N'1261589420356124672', NULL, NULL, NULL), (N'17', NULL, N'1261589960393736192', N'LeastConnection', NULL, N'60000'), (N'18', NULL, N'1261606600242085888', NULL, NULL, NULL), (N'19', NULL, N'1261606689601732608', NULL, NULL, NULL), (N'22', NULL, N'1262220447629058048', NULL, NULL, NULL), (N'23', NULL, N'1262230734939758592', NULL, NULL, NULL), (N'24', NULL, N'1262296916350869504', NULL, NULL, NULL), (N'25', NULL, N'1262632376348594176', N'', N'', N'0'), (N'26', NULL, N'1262632791869902848', N'', N'', N'0'), (N'29', NULL, N'1262660336921235456', N'', N'', N'0'), (N'30', NULL, N'1262660528277966848', N'', N'', N'0'), (N'31', NULL, N'1262660706875625472', N'', N'', N'0'), (N'32', NULL, N'1262660966393991168', N'', N'', N'0'), (N'33', NULL, N'1262661109474283520', N'', N'', N'0'), (N'34', NULL, N'1262663888804663296', N'', N'', N'0'), (N'35', NULL, N'1262664024096133120', N'', N'', N'0'), (N'36', NULL, N'1262664186252120064', N'', N'', N'0'), (N'37', NULL, N'1262664357044178944', N'', N'', N'0'), (N'38', NULL, N'1262664632928718848', N'', N'', N'0'), (N'39', NULL, N'1262664751409418240', N'', N'', N'0'), (N'40', NULL, N'1262664871274237952', N'', N'', N'0'), (N'41', NULL, N'1262665026111164416', N'', N'', N'0'), (N'42', NULL, N'1262665159905267712', N'', N'', N'0'), (N'43', NULL, N'1262665329829105664', N'', N'', N'0'), (N'44', NULL, N'1262665456471920640', N'', N'', N'0'), (N'45', NULL, N'1262665628165754880', N'', N'', N'0'), (N'46', NULL, N'1262666172682883072', N'', N'', N'0'), (N'48', NULL, N'1262723402331885568', N'', N'', N'0'), (N'49', NULL, N'1262935771746734080', N'', N'', N'0'), (N'50', NULL, N'1262935906522304512', N'', N'', N'0'), (N'53', NULL, N'1263074419073593344', N'', N'', N'0'), (N'54', NULL, N'1263075249394790400', N'', N'', N'0'), (N'55', NULL, N'1263075593499684864', N'', N'', N'0'), (N'57', NULL, N'1263101898440146944', N'', N'', N'0'), (N'58', NULL, N'1263303878648569856', N'', N'', N'0'), (N'59', NULL, N'1263304204797648896', N'', N'', N'0'), (N'60', NULL, N'1263304872891555840', N'', N'', N'0'), (N'61', NULL, N'1263305106250047488', N'', N'', N'0'), (N'62', NULL, N'1263305244594970624', N'', N'', N'0'), (N'63', NULL, N'1263305430536855552', N'', N'', N'0'), (N'64', NULL, N'1263639172959174656', N'', N'', N'0'), (N'65', NULL, N'1264799968944640000', N'', N'', N'0'), (N'66', NULL, N'1264800070161584128', N'', N'', N'0'), (N'68', NULL, N'1267360794414161920', N'', N'', N'0'), (N'69', NULL, N'1267383367629807616', N'', N'', N'0'), (N'70', NULL, N'1267817055527632896', N'', N'', N'0'), (N'71', NULL, N'1267817221286526976', N'', N'', N'0'), (N'72', NULL, N'1268893687085518848', N'', N'', N'0'), (N'97', NULL, N'1288657613998579712', N'LeastConnection', N'', N'60000'), (N'98', NULL, N'1288657941770854400', N'', N'', N'0'), (N'99', NULL, N'1288658134067109888', N'', N'', N'0'), (N'100', NULL, N'1288658305156964352', N'', N'', N'0'), (N'101', NULL, N'1288658491216289792', N'', N'', N'0'), (N'102', NULL, N'1288658638302142464', N'', N'', N'0'), (N'103', NULL, N'1288658791784308736', N'', N'', N'0'), (N'104', NULL, N'1290849478956199936', N'', N'', N'0'), (N'105', NULL, N'1290849628051124224', N'', N'', N'0'), (N'106', NULL, N'1290849798553776128', N'', N'', N'0'), (N'108', NULL, N'1291259822512693248', N'', N'', N'0'), (N'109', NULL, N'1292620505149145088', N'', N'', N'0'), (N'110', NULL, N'1292620665505775616', N'', N'', N'0'), (N'111', NULL, N'1292620843398791168', N'', N'', N'0'), (N'112', NULL, N'1292621027574874112', N'', N'', N'0'), (N'113', NULL, N'1292621363161137152', N'', N'', N'0'), (N'114', NULL, N'1292621494837116928', N'', N'', N'0'), (N'115', NULL, N'1292621629260365824', N'', N'', N'0'), (N'116', NULL, N'1292622526073864192', N'', N'', N'0'), (N'117', NULL, N'1293470838745821184', N'', N'', N'0'), (N'118', NULL, N'1293471661785706496', N'', N'', N'0'), (N'119', NULL, N'1293472678392721408', N'', N'', N'0'), (N'120', NULL, N'1293472857510473728', N'', N'', N'0'), (N'121', NULL, N'1299273336009359360', N'', N'', N'0'), (N'122', NULL, N'1299273436282585088', N'', N'', N'0'), (N'123', NULL, N'1299273618470567936', N'', N'', N'0'), (N'124', NULL, N'1299273770182737920', N'', N'', N'0'), (N'125', NULL, N'1299273978023084032', N'', N'', N'0'), (N'126', NULL, N'1299274123225694208', N'', N'', N'0'), (N'127', NULL, N'1299274222299348992', N'', N'', N'0'), (N'128', NULL, N'1304238876758495232', N'', N'', N'0'), (N'129', NULL, N'1304678610343383040', N'', N'', N'0'), (N'130', NULL, N'1304679169305694208', N'', N'', N'0'), (N'131', NULL, N'1310460417141817344', N'', N'', N'0'), (N'132', NULL, N'1310502391475519488', N'', N'', N'0'), (N'133', NULL, N'1310515546943569920', N'', N'', N'0'), (N'134', NULL, N'1310515735292985344', N'', N'', N'0'), (N'135', NULL, N'1316628769783480320', N'', N'', N'0'), (N'136', NULL, N'1316628940663619584', N'', N'', N'0'), (N'137', NULL, N'1316629112428756992', N'', N'', N'0'), (N'138', NULL, N'1316652047017246720', N'', N'', N'0'), (N'139', NULL, N'1316913899996737536', N'', N'', N'0'), (N'140', NULL, N'1319200951383199744', N'', N'', N'0'), (N'141', NULL, N'1319221929807024128', N'', N'', N'0'), (N'142', NULL, N'1319554431134306304', N'', N'', N'0'), (N'143', NULL, N'1319554550458060800', N'', N'', N'0'), (N'144', NULL, N'1319554948434595840', N'', N'', N'0'), (N'145', NULL, N'1319555067183730688', N'', N'', N'0'), (N'146', NULL, N'1319555230765780992', N'', N'', N'0'), (N'147', NULL, N'1319555333790470144', N'', N'', N'0') +INSERT INTO [apigateway].[appapigatewaybalanceroptions] VALUES (N'1', N'1260841964962947072', NULL, N'LeastConnection', NULL, NULL), (N'4', NULL, N'1261299170387169280', N'LeastConnection', NULL, N'60000'), (N'5', NULL, N'1261585859064872960', NULL, NULL, NULL), (N'6', NULL, N'1261586605810368512', NULL, NULL, NULL), (N'7', NULL, N'1261587558609436672', NULL, NULL, NULL), (N'8', NULL, N'1261588213298348032', NULL, NULL, NULL), (N'9', NULL, N'1261588367619375104', NULL, NULL, NULL), (N'10', NULL, N'1261588628450557952', NULL, NULL, NULL), (N'11', NULL, N'1261588881564221440', NULL, NULL, NULL), (N'12', NULL, N'1261588983053795328', NULL, NULL, NULL), (N'13', NULL, N'1261589139039961088', NULL, NULL, NULL), (N'14', NULL, N'1261589197483393024', NULL, NULL, NULL), (N'15', NULL, N'1261589278857084928', NULL, NULL, NULL), (N'16', NULL, N'1261589420356124672', NULL, NULL, NULL), (N'17', NULL, N'1261589960393736192', N'LeastConnection', NULL, N'60000'), (N'18', NULL, N'1261606600242085888', NULL, NULL, NULL), (N'19', NULL, N'1261606689601732608', NULL, NULL, NULL), (N'22', NULL, N'1262220447629058048', NULL, NULL, NULL), (N'23', NULL, N'1262230734939758592', NULL, NULL, NULL), (N'24', NULL, N'1262296916350869504', NULL, NULL, NULL), (N'25', NULL, N'1262632376348594176', N'', N'', N'0'), (N'26', NULL, N'1262632791869902848', N'', N'', N'0'), (N'29', NULL, N'1262660336921235456', N'', N'', N'0'), (N'30', NULL, N'1262660528277966848', N'', N'', N'0'), (N'31', NULL, N'1262660706875625472', N'', N'', N'0'), (N'32', NULL, N'1262660966393991168', N'', N'', N'0'), (N'33', NULL, N'1262661109474283520', N'', N'', N'0'), (N'34', NULL, N'1262663888804663296', N'', N'', N'0'), (N'35', NULL, N'1262664024096133120', N'', N'', N'0'), (N'36', NULL, N'1262664186252120064', N'', N'', N'0'), (N'37', NULL, N'1262664357044178944', N'', N'', N'0'), (N'38', NULL, N'1262664632928718848', N'', N'', N'0'), (N'39', NULL, N'1262664751409418240', N'', N'', N'0'), (N'40', NULL, N'1262664871274237952', N'', N'', N'0'), (N'41', NULL, N'1262665026111164416', N'', N'', N'0'), (N'42', NULL, N'1262665159905267712', N'', N'', N'0'), (N'43', NULL, N'1262665329829105664', N'', N'', N'0'), (N'44', NULL, N'1262665456471920640', N'', N'', N'0'), (N'45', NULL, N'1262665628165754880', N'', N'', N'0'), (N'46', NULL, N'1262666172682883072', N'', N'', N'0'), (N'48', NULL, N'1262723402331885568', N'', N'', N'0'), (N'49', NULL, N'1262935771746734080', N'', N'', N'0'), (N'50', NULL, N'1262935906522304512', N'', N'', N'0'), (N'53', NULL, N'1263074419073593344', N'', N'', N'0'), (N'54', NULL, N'1263075249394790400', N'', N'', N'0'), (N'55', NULL, N'1263075593499684864', N'', N'', N'0'), (N'57', NULL, N'1263101898440146944', N'', N'', N'0'), (N'58', NULL, N'1263303878648569856', N'', N'', N'0'), (N'59', NULL, N'1263304204797648896', N'', N'', N'0'), (N'60', NULL, N'1263304872891555840', N'', N'', N'0'), (N'61', NULL, N'1263305106250047488', N'', N'', N'0'), (N'62', NULL, N'1263305244594970624', N'', N'', N'0'), (N'63', NULL, N'1263305430536855552', N'', N'', N'0'), (N'64', NULL, N'1263639172959174656', N'', N'', N'0'), (N'65', NULL, N'1264799968944640000', N'', N'', N'0'), (N'66', NULL, N'1264800070161584128', N'', N'', N'0'), (N'68', NULL, N'1267360794414161920', N'', N'', N'0'), (N'69', NULL, N'1267383367629807616', N'', N'', N'0'), (N'70', NULL, N'1267817055527632896', N'', N'', N'0'), (N'71', NULL, N'1267817221286526976', N'', N'', N'0'), (N'72', NULL, N'1268893687085518848', N'', N'', N'0'), (N'97', NULL, N'1288657613998579712', N'LeastConnection', N'', N'60000'), (N'98', NULL, N'1288657941770854400', N'', N'', N'0'), (N'99', NULL, N'1288658134067109888', N'', N'', N'0'), (N'100', NULL, N'1288658305156964352', N'', N'', N'0'), (N'101', NULL, N'1288658491216289792', N'', N'', N'0'), (N'102', NULL, N'1288658638302142464', N'', N'', N'0'), (N'103', NULL, N'1288658791784308736', N'', N'', N'0'), (N'104', NULL, N'1290849478956199936', N'', N'', N'0'), (N'105', NULL, N'1290849628051124224', N'', N'', N'0'), (N'106', NULL, N'1290849798553776128', N'', N'', N'0'), (N'108', NULL, N'1291259822512693248', N'', N'', N'0'), (N'109', NULL, N'1292620505149145088', N'', N'', N'0'), (N'110', NULL, N'1292620665505775616', N'', N'', N'0'), (N'111', NULL, N'1292620843398791168', N'', N'', N'0'), (N'112', NULL, N'1292621027574874112', N'', N'', N'0'), (N'113', NULL, N'1292621363161137152', N'', N'', N'0'), (N'114', NULL, N'1292621494837116928', N'', N'', N'0'), (N'115', NULL, N'1292621629260365824', N'', N'', N'0'), (N'116', NULL, N'1292622526073864192', N'', N'', N'0'), (N'117', NULL, N'1293470838745821184', N'', N'', N'0'), (N'118', NULL, N'1293471661785706496', N'', N'', N'0'), (N'119', NULL, N'1293472678392721408', N'', N'', N'0'), (N'120', NULL, N'1293472857510473728', N'', N'', N'0'), (N'121', NULL, N'1299273336009359360', N'', N'', N'0'), (N'122', NULL, N'1299273436282585088', N'', N'', N'0'), (N'123', NULL, N'1299273618470567936', N'', N'', N'0'), (N'124', NULL, N'1299273770182737920', N'', N'', N'0'), (N'125', NULL, N'1299273978023084032', N'', N'', N'0'), (N'126', NULL, N'1299274123225694208', N'', N'', N'0'), (N'127', NULL, N'1299274222299348992', N'', N'', N'0'), (N'128', NULL, N'1304238876758495232', N'', N'', N'0'), (N'129', NULL, N'1304678610343383040', N'', N'', N'0'), (N'130', NULL, N'1304679169305694208', N'', N'', N'0'), (N'131', NULL, N'1310460417141817344', N'', N'', N'0'), (N'132', NULL, N'1310502391475519488', N'', N'', N'0'), (N'133', NULL, N'1310515546943569920', N'', N'', N'0'), (N'134', NULL, N'1310515735292985344', N'', N'', N'0'), (N'135', NULL, N'1316628769783480320', N'', N'', N'0'), (N'136', NULL, N'1316628940663619584', N'', N'', N'0'), (N'137', NULL, N'1316629112428756992', N'', N'', N'0'), (N'138', NULL, N'1316652047017246720', N'', N'', N'0'), (N'139', NULL, N'1316913899996737536', N'', N'', N'0'), (N'140', NULL, N'1319200951383199744', N'', N'', N'0'), (N'141', NULL, N'1319221929807024128', N'', N'', N'0'), (N'142', NULL, N'1319554431134306304', N'', N'', N'0'), (N'143', NULL, N'1319554550458060800', N'', N'', N'0'), (N'144', NULL, N'1319554948434595840', N'', N'', N'0'), (N'145', NULL, N'1319555067183730688', N'', N'', N'0'), (N'146', NULL, N'1319555230765780992', N'', N'', N'0'), (N'147', NULL, N'1319555333790470144', N'', N'', N'0'), (N'148', NULL, N'1321001932510203904', N'', N'', N'0'), (N'149', NULL, N'1321002059803136000', N'', N'', N'0'), (N'150', NULL, N'1321002256440496128', N'', N'', N'0'), (N'151', NULL, N'1321002350686507008', N'', N'', N'0'), (N'152', NULL, N'1322190027988525056', N'', N'', N'0') GO COMMIT @@ -180,7 +180,7 @@ GO BEGIN TRANSACTION GO -INSERT INTO [apigateway].[appapigatewaycacheoptions] VALUES (N'3', N'1261299170387169280', NULL, NULL), (N'4', N'1261585859064872960', NULL, NULL), (N'5', N'1261586605810368512', NULL, NULL), (N'6', N'1261587558609436672', NULL, NULL), (N'7', N'1261588213298348032', NULL, NULL), (N'8', N'1261588367619375104', NULL, NULL), (N'9', N'1261588628450557952', NULL, NULL), (N'10', N'1261588881564221440', NULL, NULL), (N'11', N'1261588983053795328', NULL, NULL), (N'12', N'1261589139039961088', NULL, NULL), (N'13', N'1261589197483393024', NULL, NULL), (N'14', N'1261589278857084928', NULL, NULL), (N'15', N'1261589420356124672', NULL, NULL), (N'16', N'1261589960393736192', NULL, NULL), (N'17', N'1261606600242085888', NULL, NULL), (N'18', N'1261606689601732608', NULL, NULL), (N'21', N'1262220447629058048', NULL, NULL), (N'22', N'1262230734939758592', NULL, NULL), (N'23', N'1262296916350869504', NULL, NULL), (N'24', N'1262632376348594176', NULL, NULL), (N'25', N'1262632791869902848', NULL, NULL), (N'28', N'1262660336921235456', N'0', N''), (N'29', N'1262660528277966848', N'0', N''), (N'30', N'1262660706875625472', N'0', N''), (N'31', N'1262660966393991168', N'0', N''), (N'32', N'1262661109474283520', N'0', N''), (N'33', N'1262663888804663296', N'0', N''), (N'34', N'1262664024096133120', N'0', N''), (N'35', N'1262664186252120064', N'0', N''), (N'36', N'1262664357044178944', N'0', N''), (N'37', N'1262664632928718848', N'0', N''), (N'38', N'1262664751409418240', N'0', N''), (N'39', N'1262664871274237952', N'0', N''), (N'40', N'1262665026111164416', N'0', N''), (N'41', N'1262665159905267712', N'0', N''), (N'42', N'1262665329829105664', N'0', N''), (N'43', N'1262665456471920640', N'0', N''), (N'44', N'1262665628165754880', NULL, NULL), (N'45', N'1262666172682883072', NULL, NULL), (N'47', N'1262723402331885568', NULL, NULL), (N'48', N'1262935771746734080', NULL, NULL), (N'49', N'1262935906522304512', NULL, NULL), (N'52', N'1263074419073593344', NULL, NULL), (N'53', N'1263075249394790400', N'0', N''), (N'54', N'1263075593499684864', N'0', N''), (N'56', N'1263101898440146944', NULL, NULL), (N'57', N'1263303878648569856', NULL, NULL), (N'58', N'1263304204797648896', NULL, NULL), (N'59', N'1263304872891555840', NULL, NULL), (N'60', N'1263305106250047488', NULL, NULL), (N'61', N'1263305244594970624', NULL, NULL), (N'62', N'1263305430536855552', NULL, NULL), (N'63', N'1263639172959174656', NULL, NULL), (N'64', N'1264799968944640000', NULL, NULL), (N'65', N'1264800070161584128', NULL, NULL), (N'66', N'1267360794414161920', NULL, NULL), (N'67', N'1267383367629807616', NULL, NULL), (N'68', N'1267817055527632896', NULL, NULL), (N'69', N'1267817221286526976', NULL, NULL), (N'70', N'1268893687085518848', NULL, NULL), (N'94', N'1288657613998579712', NULL, NULL), (N'95', N'1288657941770854400', N'0', N''), (N'96', N'1288658134067109888', N'0', N''), (N'97', N'1288658305156964352', N'0', N''), (N'98', N'1288658491216289792', N'0', N''), (N'99', N'1288658638302142464', NULL, NULL), (N'100', N'1288658791784308736', NULL, NULL), (N'101', N'1290849478956199936', NULL, NULL), (N'102', N'1290849628051124224', NULL, NULL), (N'103', N'1290849798553776128', NULL, NULL), (N'105', N'1291259822512693248', N'0', N''), (N'106', N'1292620505149145088', N'0', N''), (N'107', N'1292620665505775616', N'0', N''), (N'108', N'1292620843398791168', NULL, NULL), (N'109', N'1292621027574874112', N'0', N''), (N'110', N'1292621363161137152', N'0', N''), (N'111', N'1292621494837116928', N'0', N''), (N'112', N'1292621629260365824', N'0', N''), (N'113', N'1292622526073864192', N'0', N''), (N'114', N'1293470838745821184', N'0', N''), (N'115', N'1293471661785706496', N'0', N''), (N'116', N'1293472678392721408', N'0', N''), (N'117', N'1293472857510473728', N'0', N''), (N'118', N'1299273336009359360', NULL, NULL), (N'119', N'1299273436282585088', NULL, NULL), (N'120', N'1299273618470567936', NULL, NULL), (N'121', N'1299273770182737920', NULL, NULL), (N'122', N'1299273978023084032', NULL, NULL), (N'123', N'1299274123225694208', NULL, NULL), (N'124', N'1299274222299348992', NULL, NULL), (N'125', N'1304238876758495232', N'0', N''), (N'126', N'1304678610343383040', NULL, NULL), (N'127', N'1304679169305694208', NULL, NULL), (N'128', N'1310460417141817344', N'0', N''), (N'129', N'1310502391475519488', N'0', N''), (N'130', N'1310515546943569920', NULL, NULL), (N'131', N'1310515735292985344', NULL, NULL), (N'132', N'1316628769783480320', N'0', N''), (N'133', N'1316628940663619584', N'0', N''), (N'134', N'1316629112428756992', N'0', N''), (N'135', N'1316652047017246720', N'0', N''), (N'136', N'1316913899996737536', N'0', N''), (N'137', N'1319200951383199744', N'0', N''), (N'138', N'1319221929807024128', N'0', N''), (N'139', N'1319554431134306304', NULL, NULL), (N'140', N'1319554550458060800', NULL, NULL), (N'141', N'1319554948434595840', N'0', N''), (N'142', N'1319555067183730688', N'0', N''), (N'143', N'1319555230765780992', N'0', N''), (N'144', N'1319555333790470144', N'0', N'') +INSERT INTO [apigateway].[appapigatewaycacheoptions] VALUES (N'3', N'1261299170387169280', NULL, NULL), (N'4', N'1261585859064872960', NULL, NULL), (N'5', N'1261586605810368512', NULL, NULL), (N'6', N'1261587558609436672', NULL, NULL), (N'7', N'1261588213298348032', NULL, NULL), (N'8', N'1261588367619375104', NULL, NULL), (N'9', N'1261588628450557952', NULL, NULL), (N'10', N'1261588881564221440', NULL, NULL), (N'11', N'1261588983053795328', NULL, NULL), (N'12', N'1261589139039961088', NULL, NULL), (N'13', N'1261589197483393024', NULL, NULL), (N'14', N'1261589278857084928', NULL, NULL), (N'15', N'1261589420356124672', NULL, NULL), (N'16', N'1261589960393736192', NULL, NULL), (N'17', N'1261606600242085888', NULL, NULL), (N'18', N'1261606689601732608', NULL, NULL), (N'21', N'1262220447629058048', NULL, NULL), (N'22', N'1262230734939758592', NULL, NULL), (N'23', N'1262296916350869504', NULL, NULL), (N'24', N'1262632376348594176', NULL, NULL), (N'25', N'1262632791869902848', NULL, NULL), (N'28', N'1262660336921235456', N'0', N''), (N'29', N'1262660528277966848', N'0', N''), (N'30', N'1262660706875625472', N'0', N''), (N'31', N'1262660966393991168', N'0', N''), (N'32', N'1262661109474283520', N'0', N''), (N'33', N'1262663888804663296', N'0', N''), (N'34', N'1262664024096133120', N'0', N''), (N'35', N'1262664186252120064', N'0', N''), (N'36', N'1262664357044178944', N'0', N''), (N'37', N'1262664632928718848', N'0', N''), (N'38', N'1262664751409418240', N'0', N''), (N'39', N'1262664871274237952', N'0', N''), (N'40', N'1262665026111164416', N'0', N''), (N'41', N'1262665159905267712', N'0', N''), (N'42', N'1262665329829105664', N'0', N''), (N'43', N'1262665456471920640', N'0', N''), (N'44', N'1262665628165754880', NULL, NULL), (N'45', N'1262666172682883072', NULL, NULL), (N'47', N'1262723402331885568', NULL, NULL), (N'48', N'1262935771746734080', NULL, NULL), (N'49', N'1262935906522304512', NULL, NULL), (N'52', N'1263074419073593344', NULL, NULL), (N'53', N'1263075249394790400', N'0', N''), (N'54', N'1263075593499684864', N'0', N''), (N'56', N'1263101898440146944', NULL, NULL), (N'57', N'1263303878648569856', NULL, NULL), (N'58', N'1263304204797648896', NULL, NULL), (N'59', N'1263304872891555840', NULL, NULL), (N'60', N'1263305106250047488', NULL, NULL), (N'61', N'1263305244594970624', NULL, NULL), (N'62', N'1263305430536855552', NULL, NULL), (N'63', N'1263639172959174656', NULL, NULL), (N'64', N'1264799968944640000', NULL, NULL), (N'65', N'1264800070161584128', NULL, NULL), (N'66', N'1267360794414161920', NULL, NULL), (N'67', N'1267383367629807616', NULL, NULL), (N'68', N'1267817055527632896', NULL, NULL), (N'69', N'1267817221286526976', NULL, NULL), (N'70', N'1268893687085518848', NULL, NULL), (N'94', N'1288657613998579712', NULL, NULL), (N'95', N'1288657941770854400', N'0', N''), (N'96', N'1288658134067109888', N'0', N''), (N'97', N'1288658305156964352', N'0', N''), (N'98', N'1288658491216289792', N'0', N''), (N'99', N'1288658638302142464', NULL, NULL), (N'100', N'1288658791784308736', NULL, NULL), (N'101', N'1290849478956199936', NULL, NULL), (N'102', N'1290849628051124224', NULL, NULL), (N'103', N'1290849798553776128', NULL, NULL), (N'105', N'1291259822512693248', N'0', N''), (N'106', N'1292620505149145088', N'0', N''), (N'107', N'1292620665505775616', N'0', N''), (N'108', N'1292620843398791168', NULL, NULL), (N'109', N'1292621027574874112', N'0', N''), (N'110', N'1292621363161137152', N'0', N''), (N'111', N'1292621494837116928', N'0', N''), (N'112', N'1292621629260365824', N'0', N''), (N'113', N'1292622526073864192', N'0', N''), (N'114', N'1293470838745821184', N'0', N''), (N'115', N'1293471661785706496', N'0', N''), (N'116', N'1293472678392721408', N'0', N''), (N'117', N'1293472857510473728', N'0', N''), (N'118', N'1299273336009359360', NULL, NULL), (N'119', N'1299273436282585088', NULL, NULL), (N'120', N'1299273618470567936', NULL, NULL), (N'121', N'1299273770182737920', NULL, NULL), (N'122', N'1299273978023084032', NULL, NULL), (N'123', N'1299274123225694208', NULL, NULL), (N'124', N'1299274222299348992', NULL, NULL), (N'125', N'1304238876758495232', N'0', N''), (N'126', N'1304678610343383040', NULL, NULL), (N'127', N'1304679169305694208', NULL, NULL), (N'128', N'1310460417141817344', N'0', N''), (N'129', N'1310502391475519488', N'0', N''), (N'130', N'1310515546943569920', NULL, NULL), (N'131', N'1310515735292985344', NULL, NULL), (N'132', N'1316628769783480320', N'0', N''), (N'133', N'1316628940663619584', N'0', N''), (N'134', N'1316629112428756992', N'0', N''), (N'135', N'1316652047017246720', N'0', N''), (N'136', N'1316913899996737536', N'0', N''), (N'137', N'1319200951383199744', N'0', N''), (N'138', N'1319221929807024128', N'0', N''), (N'139', N'1319554431134306304', NULL, NULL), (N'140', N'1319554550458060800', NULL, NULL), (N'141', N'1319554948434595840', N'0', N''), (N'142', N'1319555067183730688', N'0', N''), (N'143', N'1319555230765780992', N'0', N''), (N'144', N'1319555333790470144', N'0', N''), (N'145', N'1321001932510203904', N'0', N''), (N'146', N'1321002059803136000', N'0', N''), (N'147', N'1321002256440496128', N'0', N''), (N'148', N'1321002350686507008', N'0', N''), (N'149', N'1322190027988525056', N'0', N'') GO COMMIT @@ -335,7 +335,7 @@ GO BEGIN TRANSACTION GO -INSERT INTO [apigateway].[appapigatewayhttpoptions] VALUES (N'1', N'1260841964962947072', NULL, NULL, N'0', N'0', N'1', N'0'), (N'4', NULL, N'1261299170387169280', N'1000', N'1', N'0', N'1', N'0'), (N'5', NULL, N'1261585859064872960', NULL, N'0', N'0', N'1', N'0'), (N'6', NULL, N'1261586605810368512', NULL, N'0', N'0', N'0', N'0'), (N'7', NULL, N'1261587558609436672', NULL, N'0', N'0', N'0', N'0'), (N'8', NULL, N'1261588213298348032', NULL, N'0', N'0', N'0', N'0'), (N'9', NULL, N'1261588367619375104', NULL, N'0', N'0', N'0', N'0'), (N'10', NULL, N'1261588628450557952', NULL, N'0', N'0', N'0', N'0'), (N'11', NULL, N'1261588881564221440', NULL, N'0', N'0', N'0', N'0'), (N'12', NULL, N'1261588983053795328', NULL, N'0', N'0', N'0', N'0'), (N'13', NULL, N'1261589139039961088', NULL, N'0', N'0', N'0', N'0'), (N'14', NULL, N'1261589197483393024', NULL, N'0', N'0', N'0', N'0'), (N'15', NULL, N'1261589278857084928', NULL, N'0', N'0', N'0', N'0'), (N'16', NULL, N'1261589420356124672', NULL, N'0', N'0', N'0', N'0'), (N'17', NULL, N'1261589960393736192', N'1000', N'1', N'0', N'1', N'0'), (N'18', NULL, N'1261606600242085888', NULL, N'0', N'0', N'0', N'0'), (N'19', NULL, N'1261606689601732608', NULL, N'0', N'0', N'0', N'0'), (N'22', NULL, N'1262220447629058048', NULL, N'0', N'0', N'1', N'0'), (N'23', NULL, N'1262230734939758592', NULL, N'0', N'0', N'1', N'0'), (N'24', NULL, N'1262296916350869504', NULL, N'0', N'0', N'1', N'0'), (N'25', NULL, N'1262632376348594176', N'0', N'0', N'0', N'0', N'0'), (N'26', NULL, N'1262632791869902848', N'0', N'0', N'0', N'0', N'0'), (N'29', NULL, N'1262660336921235456', N'0', N'0', N'0', N'0', N'0'), (N'30', NULL, N'1262660528277966848', N'0', N'0', N'0', N'0', N'0'), (N'31', NULL, N'1262660706875625472', N'0', N'0', N'0', N'0', N'0'), (N'32', NULL, N'1262660966393991168', N'0', N'0', N'0', N'0', N'0'), (N'33', NULL, N'1262661109474283520', N'0', N'0', N'0', N'0', N'0'), (N'34', NULL, N'1262663888804663296', N'0', N'0', N'0', N'0', N'0'), (N'35', NULL, N'1262664024096133120', N'0', N'0', N'0', N'0', N'0'), (N'36', NULL, N'1262664186252120064', N'0', N'0', N'0', N'0', N'0'), (N'37', NULL, N'1262664357044178944', N'0', N'0', N'0', N'0', N'0'), (N'38', NULL, N'1262664632928718848', N'0', N'0', N'0', N'0', N'0'), (N'39', NULL, N'1262664751409418240', N'0', N'0', N'0', N'0', N'0'), (N'40', NULL, N'1262664871274237952', N'0', N'0', N'0', N'0', N'0'), (N'41', NULL, N'1262665026111164416', N'0', N'0', N'0', N'0', N'0'), (N'42', NULL, N'1262665159905267712', N'0', N'0', N'0', N'0', N'0'), (N'43', NULL, N'1262665329829105664', N'0', N'0', N'0', N'0', N'0'), (N'44', NULL, N'1262665456471920640', N'0', N'0', N'0', N'0', N'0'), (N'45', NULL, N'1262665628165754880', N'0', N'0', N'0', N'0', N'0'), (N'46', NULL, N'1262666172682883072', N'0', N'0', N'0', N'0', N'0'), (N'48', NULL, N'1262723402331885568', N'0', N'0', N'0', N'0', N'0'), (N'49', NULL, N'1262935771746734080', N'0', N'0', N'0', N'0', N'0'), (N'50', NULL, N'1262935906522304512', N'0', N'0', N'0', N'0', N'0'), (N'53', NULL, N'1263074419073593344', N'0', N'0', N'0', N'0', N'0'), (N'54', NULL, N'1263075249394790400', N'0', N'0', N'0', N'0', N'0'), (N'55', NULL, N'1263075593499684864', N'0', N'0', N'0', N'0', N'0'), (N'57', NULL, N'1263101898440146944', N'0', N'0', N'0', N'0', N'0'), (N'58', NULL, N'1263303878648569856', N'0', N'0', N'0', N'0', N'0'), (N'59', NULL, N'1263304204797648896', N'0', N'0', N'0', N'0', N'0'), (N'60', NULL, N'1263304872891555840', N'0', N'0', N'0', N'0', N'0'), (N'61', NULL, N'1263305106250047488', N'0', N'0', N'0', N'0', N'0'), (N'62', NULL, N'1263305244594970624', N'0', N'0', N'0', N'0', N'0'), (N'63', NULL, N'1263305430536855552', N'0', N'0', N'0', N'0', N'0'), (N'64', NULL, N'1263639172959174656', N'0', N'0', N'0', N'0', N'0'), (N'65', NULL, N'1264799968944640000', N'0', N'0', N'0', N'0', N'0'), (N'66', NULL, N'1264800070161584128', N'0', N'0', N'0', N'0', N'0'), (N'68', NULL, N'1267360794414161920', N'0', N'0', N'0', N'0', N'0'), (N'69', NULL, N'1267383367629807616', N'0', N'0', N'0', N'0', N'0'), (N'70', NULL, N'1267817055527632896', N'0', N'0', N'0', N'0', N'0'), (N'71', NULL, N'1267817221286526976', N'0', N'0', N'0', N'0', N'0'), (N'72', NULL, N'1268893687085518848', N'0', N'0', N'0', N'0', N'0'), (N'97', NULL, N'1288657613998579712', N'1000', N'0', N'0', N'0', N'0'), (N'98', NULL, N'1288657941770854400', N'1000', N'0', N'0', N'0', N'0'), (N'99', NULL, N'1288658134067109888', N'1000', N'0', N'0', N'0', N'0'), (N'100', NULL, N'1288658305156964352', N'1000', N'0', N'0', N'0', N'0'), (N'101', NULL, N'1288658491216289792', N'1000', N'0', N'0', N'0', N'0'), (N'102', NULL, N'1288658638302142464', N'1000', N'0', N'0', N'0', N'0'), (N'103', NULL, N'1288658791784308736', N'1000', N'0', N'0', N'0', N'0'), (N'104', NULL, N'1290849478956199936', N'0', N'0', N'0', N'0', N'0'), (N'105', NULL, N'1290849628051124224', N'0', N'0', N'0', N'0', N'0'), (N'106', NULL, N'1290849798553776128', N'0', N'0', N'0', N'0', N'0'), (N'108', NULL, N'1291259822512693248', N'0', N'0', N'0', N'0', N'0'), (N'109', NULL, N'1292620505149145088', N'0', N'0', N'0', N'0', N'0'), (N'110', NULL, N'1292620665505775616', N'0', N'0', N'0', N'0', N'0'), (N'111', NULL, N'1292620843398791168', N'100', N'0', N'0', N'0', N'0'), (N'112', NULL, N'1292621027574874112', N'0', N'0', N'0', N'0', N'0'), (N'113', NULL, N'1292621363161137152', N'0', N'0', N'0', N'0', N'0'), (N'114', NULL, N'1292621494837116928', N'0', N'0', N'0', N'0', N'0'), (N'115', NULL, N'1292621629260365824', N'0', N'0', N'0', N'0', N'0'), (N'116', NULL, N'1292622526073864192', N'0', N'0', N'0', N'0', N'0'), (N'117', NULL, N'1293470838745821184', N'0', N'0', N'0', N'0', N'0'), (N'118', NULL, N'1293471661785706496', N'0', N'0', N'0', N'0', N'0'), (N'119', NULL, N'1293472678392721408', N'0', N'0', N'0', N'0', N'0'), (N'120', NULL, N'1293472857510473728', N'0', N'0', N'0', N'0', N'0'), (N'121', NULL, N'1299273336009359360', N'0', N'0', N'0', N'0', N'0'), (N'122', NULL, N'1299273436282585088', N'0', N'0', N'0', N'0', N'0'), (N'123', NULL, N'1299273618470567936', N'0', N'0', N'0', N'0', N'0'), (N'124', NULL, N'1299273770182737920', N'0', N'0', N'0', N'0', N'0'), (N'125', NULL, N'1299273978023084032', N'0', N'0', N'0', N'0', N'0'), (N'126', NULL, N'1299274123225694208', N'0', N'0', N'0', N'0', N'0'), (N'127', NULL, N'1299274222299348992', N'0', N'0', N'0', N'0', N'0'), (N'128', NULL, N'1304238876758495232', N'0', N'0', N'0', N'0', N'0'), (N'129', NULL, N'1304678610343383040', N'0', N'0', N'0', N'0', N'0'), (N'130', NULL, N'1304679169305694208', N'0', N'0', N'0', N'0', N'0'), (N'131', NULL, N'1310460417141817344', N'0', N'0', N'0', N'0', N'0'), (N'132', NULL, N'1310502391475519488', N'0', N'0', N'0', N'0', N'0'), (N'133', NULL, N'1310515546943569920', N'0', N'0', N'0', N'0', N'0'), (N'134', NULL, N'1310515735292985344', N'0', N'0', N'0', N'0', N'0'), (N'135', NULL, N'1316628769783480320', N'0', N'0', N'0', N'0', N'0'), (N'136', NULL, N'1316628940663619584', N'0', N'0', N'0', N'0', N'0'), (N'137', NULL, N'1316629112428756992', N'0', N'0', N'0', N'0', N'0'), (N'138', NULL, N'1316652047017246720', N'0', N'0', N'0', N'0', N'0'), (N'139', NULL, N'1316913899996737536', N'0', N'0', N'0', N'0', N'0'), (N'140', NULL, N'1319200951383199744', N'0', N'0', N'0', N'0', N'0'), (N'141', NULL, N'1319221929807024128', N'0', N'0', N'0', N'0', N'0'), (N'142', NULL, N'1319554431134306304', N'0', N'0', N'0', N'0', N'0'), (N'143', NULL, N'1319554550458060800', N'0', N'0', N'0', N'0', N'0'), (N'144', NULL, N'1319554948434595840', N'0', N'0', N'0', N'0', N'0'), (N'145', NULL, N'1319555067183730688', N'0', N'0', N'0', N'0', N'0'), (N'146', NULL, N'1319555230765780992', N'0', N'0', N'0', N'0', N'0'), (N'147', NULL, N'1319555333790470144', N'0', N'0', N'0', N'0', N'0') +INSERT INTO [apigateway].[appapigatewayhttpoptions] VALUES (N'1', N'1260841964962947072', NULL, NULL, N'0', N'0', N'1', N'0'), (N'4', NULL, N'1261299170387169280', N'1000', N'1', N'0', N'1', N'0'), (N'5', NULL, N'1261585859064872960', NULL, N'0', N'0', N'1', N'0'), (N'6', NULL, N'1261586605810368512', NULL, N'0', N'0', N'0', N'0'), (N'7', NULL, N'1261587558609436672', NULL, N'0', N'0', N'0', N'0'), (N'8', NULL, N'1261588213298348032', NULL, N'0', N'0', N'0', N'0'), (N'9', NULL, N'1261588367619375104', NULL, N'0', N'0', N'0', N'0'), (N'10', NULL, N'1261588628450557952', NULL, N'0', N'0', N'0', N'0'), (N'11', NULL, N'1261588881564221440', NULL, N'0', N'0', N'0', N'0'), (N'12', NULL, N'1261588983053795328', NULL, N'0', N'0', N'0', N'0'), (N'13', NULL, N'1261589139039961088', NULL, N'0', N'0', N'0', N'0'), (N'14', NULL, N'1261589197483393024', NULL, N'0', N'0', N'0', N'0'), (N'15', NULL, N'1261589278857084928', NULL, N'0', N'0', N'0', N'0'), (N'16', NULL, N'1261589420356124672', NULL, N'0', N'0', N'0', N'0'), (N'17', NULL, N'1261589960393736192', N'1000', N'1', N'0', N'1', N'0'), (N'18', NULL, N'1261606600242085888', NULL, N'0', N'0', N'0', N'0'), (N'19', NULL, N'1261606689601732608', NULL, N'0', N'0', N'0', N'0'), (N'22', NULL, N'1262220447629058048', NULL, N'0', N'0', N'1', N'0'), (N'23', NULL, N'1262230734939758592', NULL, N'0', N'0', N'1', N'0'), (N'24', NULL, N'1262296916350869504', NULL, N'0', N'0', N'1', N'0'), (N'25', NULL, N'1262632376348594176', N'0', N'0', N'0', N'0', N'0'), (N'26', NULL, N'1262632791869902848', N'0', N'0', N'0', N'0', N'0'), (N'29', NULL, N'1262660336921235456', N'0', N'0', N'0', N'0', N'0'), (N'30', NULL, N'1262660528277966848', N'0', N'0', N'0', N'0', N'0'), (N'31', NULL, N'1262660706875625472', N'0', N'0', N'0', N'0', N'0'), (N'32', NULL, N'1262660966393991168', N'0', N'0', N'0', N'0', N'0'), (N'33', NULL, N'1262661109474283520', N'0', N'0', N'0', N'0', N'0'), (N'34', NULL, N'1262663888804663296', N'0', N'0', N'0', N'0', N'0'), (N'35', NULL, N'1262664024096133120', N'0', N'0', N'0', N'0', N'0'), (N'36', NULL, N'1262664186252120064', N'0', N'0', N'0', N'0', N'0'), (N'37', NULL, N'1262664357044178944', N'0', N'0', N'0', N'0', N'0'), (N'38', NULL, N'1262664632928718848', N'0', N'0', N'0', N'0', N'0'), (N'39', NULL, N'1262664751409418240', N'0', N'0', N'0', N'0', N'0'), (N'40', NULL, N'1262664871274237952', N'0', N'0', N'0', N'0', N'0'), (N'41', NULL, N'1262665026111164416', N'0', N'0', N'0', N'0', N'0'), (N'42', NULL, N'1262665159905267712', N'0', N'0', N'0', N'0', N'0'), (N'43', NULL, N'1262665329829105664', N'0', N'0', N'0', N'0', N'0'), (N'44', NULL, N'1262665456471920640', N'0', N'0', N'0', N'0', N'0'), (N'45', NULL, N'1262665628165754880', N'0', N'0', N'0', N'0', N'0'), (N'46', NULL, N'1262666172682883072', N'0', N'0', N'0', N'0', N'0'), (N'48', NULL, N'1262723402331885568', N'0', N'0', N'0', N'0', N'0'), (N'49', NULL, N'1262935771746734080', N'0', N'0', N'0', N'0', N'0'), (N'50', NULL, N'1262935906522304512', N'0', N'0', N'0', N'0', N'0'), (N'53', NULL, N'1263074419073593344', N'0', N'0', N'0', N'0', N'0'), (N'54', NULL, N'1263075249394790400', N'0', N'0', N'0', N'0', N'0'), (N'55', NULL, N'1263075593499684864', N'0', N'0', N'0', N'0', N'0'), (N'57', NULL, N'1263101898440146944', N'0', N'0', N'0', N'0', N'0'), (N'58', NULL, N'1263303878648569856', N'0', N'0', N'0', N'0', N'0'), (N'59', NULL, N'1263304204797648896', N'0', N'0', N'0', N'0', N'0'), (N'60', NULL, N'1263304872891555840', N'0', N'0', N'0', N'0', N'0'), (N'61', NULL, N'1263305106250047488', N'0', N'0', N'0', N'0', N'0'), (N'62', NULL, N'1263305244594970624', N'0', N'0', N'0', N'0', N'0'), (N'63', NULL, N'1263305430536855552', N'0', N'0', N'0', N'0', N'0'), (N'64', NULL, N'1263639172959174656', N'0', N'0', N'0', N'0', N'0'), (N'65', NULL, N'1264799968944640000', N'0', N'0', N'0', N'0', N'0'), (N'66', NULL, N'1264800070161584128', N'0', N'0', N'0', N'0', N'0'), (N'68', NULL, N'1267360794414161920', N'0', N'0', N'0', N'0', N'0'), (N'69', NULL, N'1267383367629807616', N'0', N'0', N'0', N'0', N'0'), (N'70', NULL, N'1267817055527632896', N'0', N'0', N'0', N'0', N'0'), (N'71', NULL, N'1267817221286526976', N'0', N'0', N'0', N'0', N'0'), (N'72', NULL, N'1268893687085518848', N'0', N'0', N'0', N'0', N'0'), (N'97', NULL, N'1288657613998579712', N'1000', N'0', N'0', N'0', N'0'), (N'98', NULL, N'1288657941770854400', N'1000', N'0', N'0', N'0', N'0'), (N'99', NULL, N'1288658134067109888', N'1000', N'0', N'0', N'0', N'0'), (N'100', NULL, N'1288658305156964352', N'1000', N'0', N'0', N'0', N'0'), (N'101', NULL, N'1288658491216289792', N'1000', N'0', N'0', N'0', N'0'), (N'102', NULL, N'1288658638302142464', N'1000', N'0', N'0', N'0', N'0'), (N'103', NULL, N'1288658791784308736', N'1000', N'0', N'0', N'0', N'0'), (N'104', NULL, N'1290849478956199936', N'0', N'0', N'0', N'0', N'0'), (N'105', NULL, N'1290849628051124224', N'0', N'0', N'0', N'0', N'0'), (N'106', NULL, N'1290849798553776128', N'0', N'0', N'0', N'0', N'0'), (N'108', NULL, N'1291259822512693248', N'0', N'0', N'0', N'0', N'0'), (N'109', NULL, N'1292620505149145088', N'0', N'0', N'0', N'0', N'0'), (N'110', NULL, N'1292620665505775616', N'0', N'0', N'0', N'0', N'0'), (N'111', NULL, N'1292620843398791168', N'100', N'0', N'0', N'0', N'0'), (N'112', NULL, N'1292621027574874112', N'0', N'0', N'0', N'0', N'0'), (N'113', NULL, N'1292621363161137152', N'0', N'0', N'0', N'0', N'0'), (N'114', NULL, N'1292621494837116928', N'0', N'0', N'0', N'0', N'0'), (N'115', NULL, N'1292621629260365824', N'0', N'0', N'0', N'0', N'0'), (N'116', NULL, N'1292622526073864192', N'0', N'0', N'0', N'0', N'0'), (N'117', NULL, N'1293470838745821184', N'0', N'0', N'0', N'0', N'0'), (N'118', NULL, N'1293471661785706496', N'0', N'0', N'0', N'0', N'0'), (N'119', NULL, N'1293472678392721408', N'0', N'0', N'0', N'0', N'0'), (N'120', NULL, N'1293472857510473728', N'0', N'0', N'0', N'0', N'0'), (N'121', NULL, N'1299273336009359360', N'0', N'0', N'0', N'0', N'0'), (N'122', NULL, N'1299273436282585088', N'0', N'0', N'0', N'0', N'0'), (N'123', NULL, N'1299273618470567936', N'0', N'0', N'0', N'0', N'0'), (N'124', NULL, N'1299273770182737920', N'0', N'0', N'0', N'0', N'0'), (N'125', NULL, N'1299273978023084032', N'0', N'0', N'0', N'0', N'0'), (N'126', NULL, N'1299274123225694208', N'0', N'0', N'0', N'0', N'0'), (N'127', NULL, N'1299274222299348992', N'0', N'0', N'0', N'0', N'0'), (N'128', NULL, N'1304238876758495232', N'0', N'0', N'0', N'0', N'0'), (N'129', NULL, N'1304678610343383040', N'0', N'0', N'0', N'0', N'0'), (N'130', NULL, N'1304679169305694208', N'0', N'0', N'0', N'0', N'0'), (N'131', NULL, N'1310460417141817344', N'0', N'0', N'0', N'0', N'0'), (N'132', NULL, N'1310502391475519488', N'0', N'0', N'0', N'0', N'0'), (N'133', NULL, N'1310515546943569920', N'0', N'0', N'0', N'0', N'0'), (N'134', NULL, N'1310515735292985344', N'0', N'0', N'0', N'0', N'0'), (N'135', NULL, N'1316628769783480320', N'0', N'0', N'0', N'0', N'0'), (N'136', NULL, N'1316628940663619584', N'0', N'0', N'0', N'0', N'0'), (N'137', NULL, N'1316629112428756992', N'0', N'0', N'0', N'0', N'0'), (N'138', NULL, N'1316652047017246720', N'0', N'0', N'0', N'0', N'0'), (N'139', NULL, N'1316913899996737536', N'0', N'0', N'0', N'0', N'0'), (N'140', NULL, N'1319200951383199744', N'0', N'0', N'0', N'0', N'0'), (N'141', NULL, N'1319221929807024128', N'0', N'0', N'0', N'0', N'0'), (N'142', NULL, N'1319554431134306304', N'0', N'0', N'0', N'0', N'0'), (N'143', NULL, N'1319554550458060800', N'0', N'0', N'0', N'0', N'0'), (N'144', NULL, N'1319554948434595840', N'0', N'0', N'0', N'0', N'0'), (N'145', NULL, N'1319555067183730688', N'0', N'0', N'0', N'0', N'0'), (N'146', NULL, N'1319555230765780992', N'0', N'0', N'0', N'0', N'0'), (N'147', NULL, N'1319555333790470144', N'0', N'0', N'0', N'0', N'0'), (N'148', NULL, N'1321001932510203904', N'0', N'0', N'0', N'0', N'0'), (N'149', NULL, N'1321002059803136000', N'0', N'0', N'0', N'0', N'0'), (N'150', NULL, N'1321002256440496128', N'0', N'0', N'0', N'0', N'0'), (N'151', NULL, N'1321002350686507008', N'0', N'0', N'0', N'0', N'0'), (N'152', NULL, N'1322190027988525056', N'0', N'0', N'0', N'0', N'0') GO COMMIT @@ -366,7 +366,7 @@ GO BEGIN TRANSACTION GO -INSERT INTO [apigateway].[appapigatewayqosoptions] VALUES (N'1', N'1260841964962947072', NULL, N'60', N'60000', N'30000'), (N'4', NULL, N'1261299170387169280', N'60', N'60000', N'30000'), (N'5', NULL, N'1261585859064872960', N'60', N'60000', N'30000'), (N'6', NULL, N'1261586605810368512', N'60', N'60000', N'30000'), (N'7', NULL, N'1261587558609436672', N'60', N'60000', N'30000'), (N'8', NULL, N'1261588213298348032', N'60', N'60000', N'30000'), (N'9', NULL, N'1261588367619375104', N'60', N'60000', N'30000'), (N'10', NULL, N'1261588628450557952', N'60', N'60000', N'30000'), (N'11', NULL, N'1261588881564221440', N'60', N'60000', N'30000'), (N'12', NULL, N'1261588983053795328', N'60', N'60000', N'30000'), (N'13', NULL, N'1261589139039961088', N'60', N'60000', N'30000'), (N'14', NULL, N'1261589197483393024', N'60', N'60000', N'30000'), (N'15', NULL, N'1261589278857084928', N'60', N'60000', N'30000'), (N'16', NULL, N'1261589420356124672', N'60', N'60000', N'30000'), (N'17', NULL, N'1261589960393736192', N'60', N'60000', N'30000'), (N'18', NULL, N'1261606600242085888', NULL, NULL, NULL), (N'19', NULL, N'1261606689601732608', NULL, NULL, NULL), (N'22', NULL, N'1262220447629058048', N'60', N'60000', N'30000'), (N'23', NULL, N'1262230734939758592', N'60', N'60000', N'30000'), (N'24', NULL, N'1262296916350869504', N'60', N'60000', N'30000'), (N'25', NULL, N'1262632376348594176', N'50', N'60000', N'30000'), (N'26', NULL, N'1262632791869902848', N'50', N'60000', N'30000'), (N'29', NULL, N'1262660336921235456', N'50', N'60000', N'30000'), (N'30', NULL, N'1262660528277966848', N'50', N'60000', N'30000'), (N'31', NULL, N'1262660706875625472', N'50', N'60000', N'30000'), (N'32', NULL, N'1262660966393991168', N'50', N'60000', N'30000'), (N'33', NULL, N'1262661109474283520', N'50', N'60000', N'30000'), (N'34', NULL, N'1262663888804663296', N'50', N'60000', N'30000'), (N'35', NULL, N'1262664024096133120', N'50', N'60000', N'30000'), (N'36', NULL, N'1262664186252120064', N'50', N'60000', N'30000'), (N'37', NULL, N'1262664357044178944', N'50', N'60000', N'30000'), (N'38', NULL, N'1262664632928718848', N'50', N'60000', N'30000'), (N'39', NULL, N'1262664751409418240', N'50', N'60000', N'30000'), (N'40', NULL, N'1262664871274237952', N'50', N'60000', N'30000'), (N'41', NULL, N'1262665026111164416', N'50', N'60000', N'30000'), (N'42', NULL, N'1262665159905267712', N'50', N'60000', N'30000'), (N'43', NULL, N'1262665329829105664', N'50', N'60000', N'30000'), (N'44', NULL, N'1262665456471920640', N'50', N'60000', N'30000'), (N'45', NULL, N'1262665628165754880', N'50', N'60000', N'30000'), (N'46', NULL, N'1262666172682883072', N'50', N'60000', N'30000'), (N'48', NULL, N'1262723402331885568', N'50', N'60000', N'30000'), (N'49', NULL, N'1262935771746734080', N'50', N'60000', N'30000'), (N'50', NULL, N'1262935906522304512', N'50', N'60000', N'30000'), (N'53', NULL, N'1263074419073593344', N'50', N'60000', N'30000'), (N'54', NULL, N'1263075249394790400', N'50', N'60000', N'30000'), (N'55', NULL, N'1263075593499684864', N'50', N'60000', N'30000'), (N'57', NULL, N'1263101898440146944', N'50', N'60000', N'120000'), (N'58', NULL, N'1263303878648569856', N'50', N'60000', N'30000'), (N'59', NULL, N'1263304204797648896', N'50', N'60000', N'120000'), (N'60', NULL, N'1263304872891555840', N'50', N'60000', N'30000'), (N'61', NULL, N'1263305106250047488', N'50', N'60000', N'30000'), (N'62', NULL, N'1263305244594970624', N'50', N'60000', N'30000'), (N'63', NULL, N'1263305430536855552', N'50', N'60000', N'30000'), (N'64', NULL, N'1263639172959174656', N'50', N'60000', N'30000'), (N'65', NULL, N'1264799968944640000', N'50', N'60000', N'30000'), (N'66', NULL, N'1264800070161584128', N'50', N'60000', N'30000'), (N'68', NULL, N'1267360794414161920', N'50', N'60000', N'30000'), (N'69', NULL, N'1267383367629807616', N'50', N'60000', N'30000'), (N'70', NULL, N'1267817055527632896', N'50', N'60000', N'30000'), (N'71', NULL, N'1267817221286526976', N'50', N'60000', N'30000'), (N'72', NULL, N'1268893687085518848', N'50', N'60000', N'30000'), (N'97', NULL, N'1288657613998579712', N'50', N'60000', N'30000'), (N'98', NULL, N'1288657941770854400', N'50', N'60000', N'30000'), (N'99', NULL, N'1288658134067109888', N'50', N'60000', N'30000'), (N'100', NULL, N'1288658305156964352', N'50', N'60000', N'30000'), (N'101', NULL, N'1288658491216289792', N'50', N'60000', N'30000'), (N'102', NULL, N'1288658638302142464', N'50', N'60000', N'30000'), (N'103', NULL, N'1288658791784308736', N'50', N'60000', N'30000'), (N'104', NULL, N'1290849478956199936', N'50', N'60000', N'30000'), (N'105', NULL, N'1290849628051124224', N'50', N'60000', N'30000'), (N'106', NULL, N'1290849798553776128', N'50', N'60000', N'30000'), (N'108', NULL, N'1291259822512693248', N'50', N'60000', N'30000'), (N'109', NULL, N'1292620505149145088', N'50', N'60000', N'30000'), (N'110', NULL, N'1292620665505775616', N'50', N'60000', N'30000'), (N'111', NULL, N'1292620843398791168', N'50', N'60000', N'1200000'), (N'112', NULL, N'1292621027574874112', N'50', N'60000', N'30000'), (N'113', NULL, N'1292621363161137152', N'50', N'60000', N'30000'), (N'114', NULL, N'1292621494837116928', N'50', N'60000', N'30000'), (N'115', NULL, N'1292621629260365824', N'50', N'60000', N'30000'), (N'116', NULL, N'1292622526073864192', N'50', N'60000', N'30000'), (N'117', NULL, N'1293470838745821184', N'50', N'60000', N'30000'), (N'118', NULL, N'1293471661785706496', N'50', N'60000', N'30000'), (N'119', NULL, N'1293472678392721408', N'50', N'60000', N'30000'), (N'120', NULL, N'1293472857510473728', N'50', N'60000', N'30000'), (N'121', NULL, N'1299273336009359360', N'50', N'60000', N'30000'), (N'122', NULL, N'1299273436282585088', N'50', N'60000', N'30000'), (N'123', NULL, N'1299273618470567936', N'50', N'60000', N'30000'), (N'124', NULL, N'1299273770182737920', N'50', N'60000', N'30000'), (N'125', NULL, N'1299273978023084032', N'50', N'60000', N'30000'), (N'126', NULL, N'1299274123225694208', N'50', N'60000', N'30000'), (N'127', NULL, N'1299274222299348992', N'50', N'60000', N'30000'), (N'128', NULL, N'1304238876758495232', N'50', N'60000', N'30000'), (N'129', NULL, N'1304678610343383040', N'50', N'60000', N'30000'), (N'130', NULL, N'1304679169305694208', N'50', N'60000', N'30000'), (N'131', NULL, N'1310460417141817344', N'50', N'60000', N'30000'), (N'132', NULL, N'1310502391475519488', N'50', N'60000', N'30000'), (N'133', NULL, N'1310515546943569920', N'50', N'60000', N'30000'), (N'134', NULL, N'1310515735292985344', N'50', N'60000', N'30000'), (N'135', NULL, N'1316628769783480320', N'50', N'60000', N'30000'), (N'136', NULL, N'1316628940663619584', N'50', N'60000', N'30000'), (N'137', NULL, N'1316629112428756992', N'50', N'60000', N'30000'), (N'138', NULL, N'1316652047017246720', N'50', N'60000', N'30000'), (N'139', NULL, N'1316913899996737536', N'50', N'60000', N'30000'), (N'140', NULL, N'1319200951383199744', N'50', N'60000', N'30000'), (N'141', NULL, N'1319221929807024128', N'50', N'60000', N'30000'), (N'142', NULL, N'1319554431134306304', N'50', N'60000', N'30000'), (N'143', NULL, N'1319554550458060800', N'50', N'60000', N'30000'), (N'144', NULL, N'1319554948434595840', N'50', N'60000', N'30000'), (N'145', NULL, N'1319555067183730688', N'50', N'60000', N'30000'), (N'146', NULL, N'1319555230765780992', N'50', N'60000', N'30000'), (N'147', NULL, N'1319555333790470144', N'50', N'60000', N'30000') +INSERT INTO [apigateway].[appapigatewayqosoptions] VALUES (N'1', N'1260841964962947072', NULL, N'60', N'60000', N'30000'), (N'4', NULL, N'1261299170387169280', N'60', N'60000', N'30000'), (N'5', NULL, N'1261585859064872960', N'60', N'60000', N'30000'), (N'6', NULL, N'1261586605810368512', N'60', N'60000', N'30000'), (N'7', NULL, N'1261587558609436672', N'60', N'60000', N'30000'), (N'8', NULL, N'1261588213298348032', N'60', N'60000', N'30000'), (N'9', NULL, N'1261588367619375104', N'60', N'60000', N'30000'), (N'10', NULL, N'1261588628450557952', N'60', N'60000', N'30000'), (N'11', NULL, N'1261588881564221440', N'60', N'60000', N'30000'), (N'12', NULL, N'1261588983053795328', N'60', N'60000', N'30000'), (N'13', NULL, N'1261589139039961088', N'60', N'60000', N'30000'), (N'14', NULL, N'1261589197483393024', N'60', N'60000', N'30000'), (N'15', NULL, N'1261589278857084928', N'60', N'60000', N'30000'), (N'16', NULL, N'1261589420356124672', N'60', N'60000', N'30000'), (N'17', NULL, N'1261589960393736192', N'60', N'60000', N'30000'), (N'18', NULL, N'1261606600242085888', NULL, NULL, NULL), (N'19', NULL, N'1261606689601732608', NULL, NULL, NULL), (N'22', NULL, N'1262220447629058048', N'60', N'60000', N'30000'), (N'23', NULL, N'1262230734939758592', N'60', N'60000', N'30000'), (N'24', NULL, N'1262296916350869504', N'60', N'60000', N'30000'), (N'25', NULL, N'1262632376348594176', N'50', N'60000', N'30000'), (N'26', NULL, N'1262632791869902848', N'50', N'60000', N'30000'), (N'29', NULL, N'1262660336921235456', N'50', N'60000', N'30000'), (N'30', NULL, N'1262660528277966848', N'50', N'60000', N'30000'), (N'31', NULL, N'1262660706875625472', N'50', N'60000', N'30000'), (N'32', NULL, N'1262660966393991168', N'50', N'60000', N'30000'), (N'33', NULL, N'1262661109474283520', N'50', N'60000', N'30000'), (N'34', NULL, N'1262663888804663296', N'50', N'60000', N'30000'), (N'35', NULL, N'1262664024096133120', N'50', N'60000', N'30000'), (N'36', NULL, N'1262664186252120064', N'50', N'60000', N'30000'), (N'37', NULL, N'1262664357044178944', N'50', N'60000', N'30000'), (N'38', NULL, N'1262664632928718848', N'50', N'60000', N'30000'), (N'39', NULL, N'1262664751409418240', N'50', N'60000', N'30000'), (N'40', NULL, N'1262664871274237952', N'50', N'60000', N'30000'), (N'41', NULL, N'1262665026111164416', N'50', N'60000', N'30000'), (N'42', NULL, N'1262665159905267712', N'50', N'60000', N'30000'), (N'43', NULL, N'1262665329829105664', N'50', N'60000', N'30000'), (N'44', NULL, N'1262665456471920640', N'50', N'60000', N'30000'), (N'45', NULL, N'1262665628165754880', N'50', N'60000', N'30000'), (N'46', NULL, N'1262666172682883072', N'50', N'60000', N'30000'), (N'48', NULL, N'1262723402331885568', N'50', N'60000', N'30000'), (N'49', NULL, N'1262935771746734080', N'50', N'60000', N'30000'), (N'50', NULL, N'1262935906522304512', N'50', N'60000', N'30000'), (N'53', NULL, N'1263074419073593344', N'50', N'60000', N'30000'), (N'54', NULL, N'1263075249394790400', N'50', N'60000', N'30000'), (N'55', NULL, N'1263075593499684864', N'50', N'60000', N'30000'), (N'57', NULL, N'1263101898440146944', N'50', N'60000', N'120000'), (N'58', NULL, N'1263303878648569856', N'50', N'60000', N'30000'), (N'59', NULL, N'1263304204797648896', N'50', N'60000', N'120000'), (N'60', NULL, N'1263304872891555840', N'50', N'60000', N'30000'), (N'61', NULL, N'1263305106250047488', N'50', N'60000', N'30000'), (N'62', NULL, N'1263305244594970624', N'50', N'60000', N'30000'), (N'63', NULL, N'1263305430536855552', N'50', N'60000', N'30000'), (N'64', NULL, N'1263639172959174656', N'50', N'60000', N'30000'), (N'65', NULL, N'1264799968944640000', N'50', N'60000', N'30000'), (N'66', NULL, N'1264800070161584128', N'50', N'60000', N'30000'), (N'68', NULL, N'1267360794414161920', N'50', N'60000', N'30000'), (N'69', NULL, N'1267383367629807616', N'50', N'60000', N'30000'), (N'70', NULL, N'1267817055527632896', N'50', N'60000', N'30000'), (N'71', NULL, N'1267817221286526976', N'50', N'60000', N'30000'), (N'72', NULL, N'1268893687085518848', N'50', N'60000', N'30000'), (N'97', NULL, N'1288657613998579712', N'50', N'60000', N'30000'), (N'98', NULL, N'1288657941770854400', N'50', N'60000', N'30000'), (N'99', NULL, N'1288658134067109888', N'50', N'60000', N'30000'), (N'100', NULL, N'1288658305156964352', N'50', N'60000', N'30000'), (N'101', NULL, N'1288658491216289792', N'50', N'60000', N'30000'), (N'102', NULL, N'1288658638302142464', N'50', N'60000', N'30000'), (N'103', NULL, N'1288658791784308736', N'50', N'60000', N'30000'), (N'104', NULL, N'1290849478956199936', N'50', N'60000', N'30000'), (N'105', NULL, N'1290849628051124224', N'50', N'60000', N'30000'), (N'106', NULL, N'1290849798553776128', N'50', N'60000', N'30000'), (N'108', NULL, N'1291259822512693248', N'50', N'60000', N'30000'), (N'109', NULL, N'1292620505149145088', N'50', N'60000', N'30000'), (N'110', NULL, N'1292620665505775616', N'50', N'60000', N'30000'), (N'111', NULL, N'1292620843398791168', N'50', N'60000', N'1200000'), (N'112', NULL, N'1292621027574874112', N'50', N'60000', N'30000'), (N'113', NULL, N'1292621363161137152', N'50', N'60000', N'30000'), (N'114', NULL, N'1292621494837116928', N'50', N'60000', N'30000'), (N'115', NULL, N'1292621629260365824', N'50', N'60000', N'30000'), (N'116', NULL, N'1292622526073864192', N'50', N'60000', N'30000'), (N'117', NULL, N'1293470838745821184', N'50', N'60000', N'30000'), (N'118', NULL, N'1293471661785706496', N'50', N'60000', N'30000'), (N'119', NULL, N'1293472678392721408', N'50', N'60000', N'30000'), (N'120', NULL, N'1293472857510473728', N'50', N'60000', N'30000'), (N'121', NULL, N'1299273336009359360', N'50', N'60000', N'30000'), (N'122', NULL, N'1299273436282585088', N'50', N'60000', N'30000'), (N'123', NULL, N'1299273618470567936', N'50', N'60000', N'30000'), (N'124', NULL, N'1299273770182737920', N'50', N'60000', N'30000'), (N'125', NULL, N'1299273978023084032', N'50', N'60000', N'30000'), (N'126', NULL, N'1299274123225694208', N'50', N'60000', N'30000'), (N'127', NULL, N'1299274222299348992', N'50', N'60000', N'30000'), (N'128', NULL, N'1304238876758495232', N'50', N'60000', N'30000'), (N'129', NULL, N'1304678610343383040', N'50', N'60000', N'30000'), (N'130', NULL, N'1304679169305694208', N'50', N'60000', N'30000'), (N'131', NULL, N'1310460417141817344', N'50', N'60000', N'30000'), (N'132', NULL, N'1310502391475519488', N'50', N'60000', N'30000'), (N'133', NULL, N'1310515546943569920', N'50', N'60000', N'30000'), (N'134', NULL, N'1310515735292985344', N'50', N'60000', N'30000'), (N'135', NULL, N'1316628769783480320', N'50', N'60000', N'30000'), (N'136', NULL, N'1316628940663619584', N'50', N'60000', N'30000'), (N'137', NULL, N'1316629112428756992', N'50', N'60000', N'30000'), (N'138', NULL, N'1316652047017246720', N'50', N'60000', N'30000'), (N'139', NULL, N'1316913899996737536', N'50', N'60000', N'30000'), (N'140', NULL, N'1319200951383199744', N'50', N'60000', N'30000'), (N'141', NULL, N'1319221929807024128', N'50', N'60000', N'30000'), (N'142', NULL, N'1319554431134306304', N'50', N'60000', N'30000'), (N'143', NULL, N'1319554550458060800', N'50', N'60000', N'30000'), (N'144', NULL, N'1319554948434595840', N'50', N'60000', N'30000'), (N'145', NULL, N'1319555067183730688', N'50', N'60000', N'30000'), (N'146', NULL, N'1319555230765780992', N'50', N'60000', N'30000'), (N'147', NULL, N'1319555333790470144', N'50', N'60000', N'30000'), (N'148', NULL, N'1321001932510203904', N'50', N'60000', N'30000'), (N'149', NULL, N'1321002059803136000', N'50', N'60000', N'30000'), (N'150', NULL, N'1321002256440496128', N'50', N'60000', N'30000'), (N'151', NULL, N'1321002350686507008', N'50', N'60000', N'30000'), (N'152', NULL, N'1322190027988525056', N'50', N'60000', N'30000') GO COMMIT @@ -431,7 +431,7 @@ GO BEGIN TRANSACTION GO -INSERT INTO [apigateway].[appapigatewayratelimitrule] VALUES (N'3', N'1261299170387169280', NULL, N'', N'0', NULL, NULL, NULL), (N'4', N'1261585859064872960', NULL, N'', N'0', NULL, NULL, NULL), (N'5', N'1261586605810368512', NULL, N'', N'0', NULL, NULL, NULL), (N'6', N'1261587558609436672', NULL, N'', N'0', NULL, NULL, NULL), (N'7', N'1261588213298348032', NULL, N'', N'0', NULL, NULL, NULL), (N'8', N'1261588367619375104', NULL, N'', N'0', NULL, NULL, NULL), (N'9', N'1261588628450557952', NULL, N'', N'0', NULL, NULL, NULL), (N'10', N'1261588881564221440', NULL, N'', N'0', NULL, NULL, NULL), (N'11', N'1261588983053795328', NULL, N'', N'0', NULL, NULL, NULL), (N'12', N'1261589139039961088', NULL, N'', N'0', NULL, NULL, NULL), (N'13', N'1261589197483393024', NULL, N'', N'0', NULL, NULL, NULL), (N'14', N'1261589278857084928', NULL, N'', N'0', NULL, NULL, NULL), (N'15', N'1261589420356124672', NULL, N'', N'0', NULL, NULL, NULL), (N'16', N'1261589960393736192', NULL, N'', N'0', NULL, NULL, NULL), (N'17', N'1261606600242085888', NULL, N'', N'0', NULL, NULL, NULL), (N'18', N'1261606689601732608', NULL, N'', N'0', NULL, NULL, NULL), (N'21', N'1262220447629058048', NULL, N'', N'0', NULL, NULL, NULL), (N'22', N'1262230734939758592', NULL, N'', N'0', NULL, NULL, NULL), (N'23', N'1262296916350869504', NULL, N'', N'0', NULL, NULL, NULL), (N'24', N'1262632376348594176', NULL, N'', N'0', NULL, NULL, NULL), (N'25', N'1262632791869902848', NULL, N'', N'0', NULL, NULL, NULL), (N'28', N'1262660336921235456', NULL, N'', N'0', NULL, NULL, NULL), (N'29', N'1262660528277966848', NULL, N'', N'0', NULL, NULL, NULL), (N'30', N'1262660706875625472', NULL, N'', N'0', NULL, NULL, NULL), (N'31', N'1262660966393991168', NULL, N'', N'0', NULL, NULL, NULL), (N'32', N'1262661109474283520', NULL, N'', N'0', NULL, NULL, NULL), (N'33', N'1262663888804663296', NULL, N'', N'0', NULL, NULL, NULL), (N'34', N'1262664024096133120', NULL, N'', N'0', NULL, NULL, NULL), (N'35', N'1262664186252120064', NULL, N'', N'0', NULL, NULL, NULL), (N'36', N'1262664357044178944', NULL, N'', N'0', NULL, NULL, NULL), (N'37', N'1262664632928718848', NULL, N'', N'0', NULL, NULL, NULL), (N'38', N'1262664751409418240', NULL, N'', N'0', NULL, NULL, NULL), (N'39', N'1262664871274237952', NULL, N'', N'0', NULL, NULL, NULL), (N'40', N'1262665026111164416', NULL, N'', N'0', NULL, NULL, NULL), (N'41', N'1262665159905267712', NULL, N'', N'0', NULL, NULL, NULL), (N'42', N'1262665329829105664', NULL, N'', N'0', NULL, NULL, NULL), (N'43', N'1262665456471920640', NULL, N'', N'0', NULL, NULL, NULL), (N'44', N'1262665628165754880', NULL, N'', N'0', NULL, NULL, NULL), (N'45', N'1262666172682883072', NULL, N'', N'0', NULL, NULL, NULL), (N'47', N'1262723402331885568', NULL, N'', N'0', NULL, NULL, NULL), (N'48', N'1262935771746734080', NULL, N'', N'0', NULL, NULL, NULL), (N'49', N'1262935906522304512', NULL, N'', N'0', NULL, NULL, NULL), (N'52', N'1263074419073593344', NULL, N'', N'0', NULL, NULL, NULL), (N'53', N'1263075249394790400', NULL, N'', N'0', NULL, NULL, NULL), (N'54', N'1263075593499684864', NULL, N'', N'0', NULL, NULL, NULL), (N'56', N'1263101898440146944', NULL, N'', N'0', NULL, NULL, NULL), (N'57', N'1263303878648569856', NULL, N'', N'0', NULL, NULL, NULL), (N'58', N'1263304204797648896', NULL, N'', N'0', NULL, NULL, NULL), (N'59', N'1263304872891555840', NULL, N'', N'0', NULL, NULL, NULL), (N'60', N'1263305106250047488', NULL, N'', N'0', NULL, NULL, NULL), (N'61', N'1263305244594970624', NULL, N'', N'0', NULL, NULL, NULL), (N'62', N'1263305430536855552', NULL, N'', N'0', NULL, NULL, NULL), (N'63', N'1263639172959174656', NULL, N'', N'0', NULL, NULL, NULL), (N'64', N'1264799968944640000', NULL, N'', N'0', NULL, NULL, NULL), (N'65', N'1264800070161584128', NULL, N'', N'0', NULL, NULL, NULL), (N'66', N'1267360794414161920', NULL, N'', N'0', NULL, NULL, NULL), (N'67', N'1267383367629807616', NULL, N'', N'0', NULL, NULL, NULL), (N'68', N'1267817055527632896', NULL, N'', N'0', NULL, NULL, NULL), (N'69', N'1267817221286526976', NULL, N'', N'0', NULL, NULL, NULL), (N'70', N'1268893687085518848', NULL, N'', N'0', NULL, NULL, NULL), (N'94', N'1288657613998579712', NULL, N'', N'1', N'1m', N'60', N'200'), (N'95', N'1288657941770854400', NULL, N'', N'0', NULL, NULL, NULL), (N'96', N'1288658134067109888', NULL, N'', N'0', NULL, NULL, NULL), (N'97', N'1288658305156964352', NULL, N'', N'0', NULL, NULL, NULL), (N'98', N'1288658491216289792', NULL, N'', N'0', NULL, NULL, NULL), (N'99', N'1288658638302142464', NULL, N'', N'0', NULL, NULL, NULL), (N'100', N'1288658791784308736', NULL, N'', N'0', NULL, NULL, NULL), (N'101', N'1290849478956199936', NULL, N'', N'0', NULL, NULL, NULL), (N'102', N'1290849628051124224', NULL, N'', N'0', NULL, NULL, NULL), (N'103', N'1290849798553776128', NULL, N'', N'0', NULL, NULL, NULL), (N'105', N'1291259822512693248', NULL, N'', N'0', NULL, NULL, NULL), (N'106', N'1292620505149145088', NULL, N'', N'0', NULL, NULL, NULL), (N'107', N'1292620665505775616', NULL, N'', N'0', NULL, NULL, NULL), (N'108', N'1292620843398791168', NULL, N'', N'0', NULL, NULL, NULL), (N'109', N'1292621027574874112', NULL, N'', N'0', NULL, NULL, NULL), (N'110', N'1292621363161137152', NULL, N'', N'0', NULL, NULL, NULL), (N'111', N'1292621494837116928', NULL, N'', N'0', NULL, NULL, NULL), (N'112', N'1292621629260365824', NULL, N'', N'0', NULL, NULL, NULL), (N'113', N'1292622526073864192', NULL, N'', N'0', NULL, NULL, NULL), (N'114', N'1293470838745821184', NULL, N'', N'0', NULL, NULL, NULL), (N'115', N'1293471661785706496', NULL, N'', N'0', NULL, NULL, NULL), (N'116', N'1293472678392721408', NULL, N'', N'0', NULL, NULL, NULL), (N'117', N'1293472857510473728', NULL, N'', N'0', NULL, NULL, NULL), (N'118', N'1299273336009359360', NULL, N'', N'0', NULL, NULL, NULL), (N'119', N'1299273436282585088', NULL, N'', N'0', NULL, NULL, NULL), (N'120', N'1299273618470567936', NULL, N'', N'0', NULL, NULL, NULL), (N'121', N'1299273770182737920', NULL, N'', N'0', NULL, NULL, NULL), (N'122', N'1299273978023084032', NULL, N'', N'0', NULL, NULL, NULL), (N'123', N'1299274123225694208', NULL, N'', N'0', NULL, NULL, NULL), (N'124', N'1299274222299348992', NULL, N'', N'0', NULL, NULL, NULL), (N'125', N'1304238876758495232', NULL, N'', N'0', NULL, NULL, NULL), (N'126', N'1304678610343383040', NULL, N'', N'0', NULL, NULL, NULL), (N'127', N'1304679169305694208', NULL, N'', N'0', NULL, NULL, NULL), (N'128', N'1310460417141817344', NULL, N'', N'0', NULL, NULL, NULL), (N'129', N'1310502391475519488', NULL, N'', N'0', NULL, NULL, NULL), (N'130', N'1310515546943569920', NULL, N'', N'0', NULL, NULL, NULL), (N'131', N'1310515735292985344', NULL, N'', N'0', NULL, NULL, NULL), (N'132', N'1316628769783480320', NULL, N'', N'0', NULL, NULL, NULL), (N'133', N'1316628940663619584', NULL, N'', N'0', NULL, NULL, NULL), (N'134', N'1316629112428756992', NULL, N'', N'0', NULL, NULL, NULL), (N'135', N'1316652047017246720', NULL, N'', N'0', NULL, NULL, NULL), (N'136', N'1316913899996737536', NULL, N'', N'0', NULL, NULL, NULL), (N'137', N'1319200951383199744', NULL, N'', N'0', NULL, NULL, NULL), (N'138', N'1319221929807024128', NULL, N'', N'0', NULL, NULL, NULL), (N'139', N'1319554431134306304', NULL, N'', N'0', NULL, NULL, NULL), (N'140', N'1319554550458060800', NULL, N'', N'0', NULL, NULL, NULL), (N'141', N'1319554948434595840', NULL, N'', N'0', NULL, NULL, NULL), (N'142', N'1319555067183730688', NULL, N'', N'0', NULL, NULL, NULL), (N'143', N'1319555230765780992', NULL, N'', N'0', NULL, NULL, NULL), (N'144', N'1319555333790470144', NULL, N'', N'0', NULL, NULL, NULL) +INSERT INTO [apigateway].[appapigatewayratelimitrule] VALUES (N'3', N'1261299170387169280', NULL, N'', N'0', NULL, NULL, NULL), (N'4', N'1261585859064872960', NULL, N'', N'0', NULL, NULL, NULL), (N'5', N'1261586605810368512', NULL, N'', N'0', NULL, NULL, NULL), (N'6', N'1261587558609436672', NULL, N'', N'0', NULL, NULL, NULL), (N'7', N'1261588213298348032', NULL, N'', N'0', NULL, NULL, NULL), (N'8', N'1261588367619375104', NULL, N'', N'0', NULL, NULL, NULL), (N'9', N'1261588628450557952', NULL, N'', N'0', NULL, NULL, NULL), (N'10', N'1261588881564221440', NULL, N'', N'0', NULL, NULL, NULL), (N'11', N'1261588983053795328', NULL, N'', N'0', NULL, NULL, NULL), (N'12', N'1261589139039961088', NULL, N'', N'0', NULL, NULL, NULL), (N'13', N'1261589197483393024', NULL, N'', N'0', NULL, NULL, NULL), (N'14', N'1261589278857084928', NULL, N'', N'0', NULL, NULL, NULL), (N'15', N'1261589420356124672', NULL, N'', N'0', NULL, NULL, NULL), (N'16', N'1261589960393736192', NULL, N'', N'0', NULL, NULL, NULL), (N'17', N'1261606600242085888', NULL, N'', N'0', NULL, NULL, NULL), (N'18', N'1261606689601732608', NULL, N'', N'0', NULL, NULL, NULL), (N'21', N'1262220447629058048', NULL, N'', N'0', NULL, NULL, NULL), (N'22', N'1262230734939758592', NULL, N'', N'0', NULL, NULL, NULL), (N'23', N'1262296916350869504', NULL, N'', N'0', NULL, NULL, NULL), (N'24', N'1262632376348594176', NULL, N'', N'0', NULL, NULL, NULL), (N'25', N'1262632791869902848', NULL, N'', N'0', NULL, NULL, NULL), (N'28', N'1262660336921235456', NULL, N'', N'0', NULL, NULL, NULL), (N'29', N'1262660528277966848', NULL, N'', N'0', NULL, NULL, NULL), (N'30', N'1262660706875625472', NULL, N'', N'0', NULL, NULL, NULL), (N'31', N'1262660966393991168', NULL, N'', N'0', NULL, NULL, NULL), (N'32', N'1262661109474283520', NULL, N'', N'0', NULL, NULL, NULL), (N'33', N'1262663888804663296', NULL, N'', N'0', NULL, NULL, NULL), (N'34', N'1262664024096133120', NULL, N'', N'0', NULL, NULL, NULL), (N'35', N'1262664186252120064', NULL, N'', N'0', NULL, NULL, NULL), (N'36', N'1262664357044178944', NULL, N'', N'0', NULL, NULL, NULL), (N'37', N'1262664632928718848', NULL, N'', N'0', NULL, NULL, NULL), (N'38', N'1262664751409418240', NULL, N'', N'0', NULL, NULL, NULL), (N'39', N'1262664871274237952', NULL, N'', N'0', NULL, NULL, NULL), (N'40', N'1262665026111164416', NULL, N'', N'0', NULL, NULL, NULL), (N'41', N'1262665159905267712', NULL, N'', N'0', NULL, NULL, NULL), (N'42', N'1262665329829105664', NULL, N'', N'0', NULL, NULL, NULL), (N'43', N'1262665456471920640', NULL, N'', N'0', NULL, NULL, NULL), (N'44', N'1262665628165754880', NULL, N'', N'0', NULL, NULL, NULL), (N'45', N'1262666172682883072', NULL, N'', N'0', NULL, NULL, NULL), (N'47', N'1262723402331885568', NULL, N'', N'0', NULL, NULL, NULL), (N'48', N'1262935771746734080', NULL, N'', N'0', NULL, NULL, NULL), (N'49', N'1262935906522304512', NULL, N'', N'0', NULL, NULL, NULL), (N'52', N'1263074419073593344', NULL, N'', N'0', NULL, NULL, NULL), (N'53', N'1263075249394790400', NULL, N'', N'0', NULL, NULL, NULL), (N'54', N'1263075593499684864', NULL, N'', N'0', NULL, NULL, NULL), (N'56', N'1263101898440146944', NULL, N'', N'0', NULL, NULL, NULL), (N'57', N'1263303878648569856', NULL, N'', N'0', NULL, NULL, NULL), (N'58', N'1263304204797648896', NULL, N'', N'0', NULL, NULL, NULL), (N'59', N'1263304872891555840', NULL, N'', N'0', NULL, NULL, NULL), (N'60', N'1263305106250047488', NULL, N'', N'0', NULL, NULL, NULL), (N'61', N'1263305244594970624', NULL, N'', N'0', NULL, NULL, NULL), (N'62', N'1263305430536855552', NULL, N'', N'0', NULL, NULL, NULL), (N'63', N'1263639172959174656', NULL, N'', N'0', NULL, NULL, NULL), (N'64', N'1264799968944640000', NULL, N'', N'0', NULL, NULL, NULL), (N'65', N'1264800070161584128', NULL, N'', N'0', NULL, NULL, NULL), (N'66', N'1267360794414161920', NULL, N'', N'0', NULL, NULL, NULL), (N'67', N'1267383367629807616', NULL, N'', N'0', NULL, NULL, NULL), (N'68', N'1267817055527632896', NULL, N'', N'0', NULL, NULL, NULL), (N'69', N'1267817221286526976', NULL, N'', N'0', NULL, NULL, NULL), (N'70', N'1268893687085518848', NULL, N'', N'0', NULL, NULL, NULL), (N'94', N'1288657613998579712', NULL, N'', N'1', N'1m', N'60', N'200'), (N'95', N'1288657941770854400', NULL, N'', N'0', NULL, NULL, NULL), (N'96', N'1288658134067109888', NULL, N'', N'0', NULL, NULL, NULL), (N'97', N'1288658305156964352', NULL, N'', N'0', NULL, NULL, NULL), (N'98', N'1288658491216289792', NULL, N'', N'0', NULL, NULL, NULL), (N'99', N'1288658638302142464', NULL, N'', N'0', NULL, NULL, NULL), (N'100', N'1288658791784308736', NULL, N'', N'0', NULL, NULL, NULL), (N'101', N'1290849478956199936', NULL, N'', N'0', NULL, NULL, NULL), (N'102', N'1290849628051124224', NULL, N'', N'0', NULL, NULL, NULL), (N'103', N'1290849798553776128', NULL, N'', N'0', NULL, NULL, NULL), (N'105', N'1291259822512693248', NULL, N'', N'0', NULL, NULL, NULL), (N'106', N'1292620505149145088', NULL, N'', N'0', NULL, NULL, NULL), (N'107', N'1292620665505775616', NULL, N'', N'0', NULL, NULL, NULL), (N'108', N'1292620843398791168', NULL, N'', N'0', NULL, NULL, NULL), (N'109', N'1292621027574874112', NULL, N'', N'0', NULL, NULL, NULL), (N'110', N'1292621363161137152', NULL, N'', N'0', NULL, NULL, NULL), (N'111', N'1292621494837116928', NULL, N'', N'0', NULL, NULL, NULL), (N'112', N'1292621629260365824', NULL, N'', N'0', NULL, NULL, NULL), (N'113', N'1292622526073864192', NULL, N'', N'0', NULL, NULL, NULL), (N'114', N'1293470838745821184', NULL, N'', N'0', NULL, NULL, NULL), (N'115', N'1293471661785706496', NULL, N'', N'0', NULL, NULL, NULL), (N'116', N'1293472678392721408', NULL, N'', N'0', NULL, NULL, NULL), (N'117', N'1293472857510473728', NULL, N'', N'0', NULL, NULL, NULL), (N'118', N'1299273336009359360', NULL, N'', N'0', NULL, NULL, NULL), (N'119', N'1299273436282585088', NULL, N'', N'0', NULL, NULL, NULL), (N'120', N'1299273618470567936', NULL, N'', N'0', NULL, NULL, NULL), (N'121', N'1299273770182737920', NULL, N'', N'0', NULL, NULL, NULL), (N'122', N'1299273978023084032', NULL, N'', N'0', NULL, NULL, NULL), (N'123', N'1299274123225694208', NULL, N'', N'0', NULL, NULL, NULL), (N'124', N'1299274222299348992', NULL, N'', N'0', NULL, NULL, NULL), (N'125', N'1304238876758495232', NULL, N'', N'0', NULL, NULL, NULL), (N'126', N'1304678610343383040', NULL, N'', N'0', NULL, NULL, NULL), (N'127', N'1304679169305694208', NULL, N'', N'0', NULL, NULL, NULL), (N'128', N'1310460417141817344', NULL, N'', N'0', NULL, NULL, NULL), (N'129', N'1310502391475519488', NULL, N'', N'0', NULL, NULL, NULL), (N'130', N'1310515546943569920', NULL, N'', N'0', NULL, NULL, NULL), (N'131', N'1310515735292985344', NULL, N'', N'0', NULL, NULL, NULL), (N'132', N'1316628769783480320', NULL, N'', N'0', NULL, NULL, NULL), (N'133', N'1316628940663619584', NULL, N'', N'0', NULL, NULL, NULL), (N'134', N'1316629112428756992', NULL, N'', N'0', NULL, NULL, NULL), (N'135', N'1316652047017246720', NULL, N'', N'0', NULL, NULL, NULL), (N'136', N'1316913899996737536', NULL, N'', N'0', NULL, NULL, NULL), (N'137', N'1319200951383199744', NULL, N'', N'0', NULL, NULL, NULL), (N'138', N'1319221929807024128', NULL, N'', N'0', NULL, NULL, NULL), (N'139', N'1319554431134306304', NULL, N'', N'0', NULL, NULL, NULL), (N'140', N'1319554550458060800', NULL, N'', N'0', NULL, NULL, NULL), (N'141', N'1319554948434595840', NULL, N'', N'0', NULL, NULL, NULL), (N'142', N'1319555067183730688', NULL, N'', N'0', NULL, NULL, NULL), (N'143', N'1319555230765780992', NULL, N'', N'0', NULL, NULL, NULL), (N'144', N'1319555333790470144', NULL, N'', N'0', NULL, NULL, NULL), (N'145', N'1321001932510203904', NULL, N'', N'0', NULL, NULL, NULL), (N'146', N'1321002059803136000', NULL, N'', N'0', NULL, NULL, NULL), (N'147', N'1321002256440496128', NULL, N'', N'0', NULL, NULL, NULL), (N'148', N'1321002350686507008', NULL, N'', N'0', NULL, NULL, NULL), (N'149', N'1322190027988525056', NULL, N'', N'0', NULL, NULL, NULL) GO COMMIT @@ -486,7 +486,7 @@ GO BEGIN TRANSACTION GO -INSERT INTO [apigateway].[appapigatewayreroute] VALUES (N'4', N'{}', N'84059fcecc91498b9beafac914865e2c', N'1261299170387169280', N'【后台管理】- 权限管理', N'/api/permission-management/permissions', N'', NULL, N'/api/permission-management/permissions', N'GET,PUT,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30010,', N'', NULL, NULL, NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'5', N'{}', N'f2312eed73cc4d3cbefcd1816849fd74', N'1261585859064872960', N'【身份认证服务】- 客户端', N'/api/identity-server/clients', N'', NULL, N'/api/identity-server/clients', N'POST,GET,', N'', N'', N'X-Forwarded-For:{RemoteIpAddress},', N'', N'', N'', NULL, N'1', N'', NULL, N'HTTP', N'127.0.0.1:30015,', N'', NULL, NULL, NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'6', N'{}', N'b764ec7b994147abb12974bfcee4a0a9', N'1261586605810368512', N'【身份认证服务】- 管理客户端', N'/api/identity-server/clients/{Id}', N'', NULL, N'/api/identity-server/clients/{Id}', N'GET,DELETE,PUT,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30015,', N'', NULL, NULL, NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'7', N'{}', N'b4ce189320804dc6b87e602594e93d35', N'1261587558609436672', N'【服务网关管理】- 路由组管理', N'/api/ApiGateway/RouteGroups', N'', N'', N'/api/ApiGateway/RouteGroups', N'GET,POST,PUT,DELETE,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'8', N'{}', N'8736fefa36da4b129f3fcf6aa095f2ce', N'1261588213298348032', N'【服务网关管理】- 查询单个路由组', N'/api/ApiGateway/RouteGroups/By-AppId/{AppId}', N'', N'', N'/api/ApiGateway/RouteGroups/By-AppId/{AppId}', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'9', N'{}', N'befd14ad39e244bc9dea7e0c01e642ce', N'1261588367619375104', N'【服务网关管理】- 查询所有有效路由组', N'/api/ApiGateway/RouteGroups/Actived', N'', N'', N'/api/ApiGateway/RouteGroups/Actived', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'10', N'{}', N'0a95945d77144ce69addb0d1e8d37837', N'1261588628450557952', N'【服务网关管理】- 基础配置', N'/api/ApiGateway/Globals', N'', N'', N'/api/ApiGateway/Globals', N'GET,POST,PUT,DELETE,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'11', N'{}', N'70ee7f919bf44b42b549c905316bfd75', N'1261588881564221440', N'【服务网关管理】- 查询单个基础配置', N'/api/ApiGateway/Globals/By-AppId/{AppId}', N'', N'', N'/api/ApiGateway/Globals/By-AppId/{AppId}', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'12', N'{}', N'caf54542d561428a9123ebed88e4b2e9', N'1261588983053795328', N'【服务网关管理】- 路由配置', N'/api/ApiGateway/Routes', N'', N'', N'/api/ApiGateway/Routes', N'GET,POST,PUT,DELETE,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'13', N'{}', N'df6c48fdaab44a37842992ae61c59dc5', N'1261589139039961088', N'【服务网关管理】- 通过标识查询路由', N'/api/ApiGateway/Routes/By-RouteId/{RouteId}', N'', N'', N'/api/ApiGateway/Routes/By-RouteId/{RouteId}', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'14', N'{}', N'aaeaedebd24a4011ad565b5559f84c5f', N'1261589197483393024', N'【服务网关管理】- 通过名称查询路由', N'/api/ApiGateway/Routes/By-RouteName/{RouteName}', N'', N'', N'/api/ApiGateway/Routes/By-RouteName/{RouteName}', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'15', N'{}', N'559c9f1b2b8c44caac86f7a643a16aaa', N'1261589278857084928', N'【服务网关管理】- 通过应用标识查询路由', N'/api/ApiGateway/Routes/By-AppId/{AppId}', N'', N'', N'/api/ApiGateway/Routes/By-AppId/{AppId}', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'16', N'{}', N'00d0a12f403a4a919c99c534bd76d0d0', N'1261589420356124672', N'【服务网关管理】- 清空应用标识下所有路由', N'/api/ApiGateway/Routes/Clear', N'', N'', N'/api/ApiGateway/Routes/Clear', N'DELETE,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'17', N'{}', N'8c308f1386ad49c799cd281eb95170ac', N'1261589960393736192', N'【服务网关管理】- 通过应用标识查询动态路由', N'/api/ApiGateway/DynamicRoutes/By-AppId/{AppId}', N'', NULL, N'/api/ApiGateway/DynamicRoutes/By-AppId/{AppId}', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, NULL, NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'18', N'{}', N'e659ebbf61534a978335cfeabdc0b375', N'1261606600242085888', N'【服务网关管理】- 通过应用标识查询聚合路由', N'/api/ApiGateway/Aggregates/by-AppId/{AppId}', N'', NULL, N'/api/ApiGateway/Aggregates/by-AppId/{AppId}', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, NULL, NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'19', N'{}', N'd665e4491b81413385858601d9cf9a1d', N'1261606689601732608', N'【服务网关管理】- 聚合路由', N'/api/ApiGateway/Aggregates', N'', NULL, N'/api/ApiGateway/Aggregates', N'GET,POST,PUT,DELETE,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, NULL, NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'22', N'{}', N'2aad614e2c2a497593a4784ff639c3d9', N'1262220447629058048', N'【身份认证服务】- 克隆客户端', N'/api/identity-server/clients/{id}/clone', N'', NULL, N'/api/identity-server/clients/{id}/clone', N'POST,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30015,', N'', NULL, NULL, NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'23', N'{}', N'1504c5e4a7334298878339a305445b21', N'1262230734939758592', N'【身份认证服务】- 可用的Api资源', N'/api/identity-server/clients/assignable-api-resources', N'', NULL, N'/api/identity-server/clients/assignable-api-resources', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30015,', N'', NULL, N'assignable-api-resources', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'25', N'{}', N'53dd1751d9104940a966006a5e93d1fa', N'1262296916350869504', N'【身份认证服务】- 可用的身份资源', N'/api/identity-server/clients/assignable-identity-resources', N'', NULL, N'/api/identity-server/clients/assignable-identity-resources', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30015,', N'', NULL, N'assignable-identity-resources', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'26', N'{}', N'3fccd1318d0d47d9aef85542668829a6', N'1262632376348594176', N'【身份认证服务】- Api资源', N'/api/identity-server/api-resources', N'', N'', N'/api/identity-server/api-resources', N'GET,POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'27', N'{}', N'de6bd0ddea6d4019b4855be5442fafdc', N'1262632791869902848', N'【身份认证服务】- 管理Api资源', N'/api/identity-server/api-resources/{id}', N'', N'', N'/api/identity-server/api-resources/{id}', N'GET,DELETE,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'30', N'{}', N'0f9875697b74420c9dc2eaf77099b210', N'1262660336921235456', N'【身份认证服务】- 用户登录', N'/api/account/login', N'', N'', N'/api/account/login', N'POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'31', N'{}', N'a890c6ecc6a64c9fa313a0f6b5406e1c', N'1262660528277966848', N'【身份认证服务】- 用户登出', N'/api/account/logout', N'', N'', N'/api/account/logout', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'32', N'{}', N'88de580b6beb4d9d9d4367840ba1fcea', N'1262660706875625472', N'【身份认证服务】- 检查密码', N'/api/account/checkPassword', N'', N'', N'/api/account/checkPassword', N'POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'33', N'{}', N'78f3c1adc7a54696af37a419eda47c62', N'1262660966393991168', N'【身份认证服务】- 个人信息页', N'/api/identity/my-profile', N'', N'', N'/api/identity/my-profile', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'34', N'{}', N'95b23aa5cebb40598a78c0761cfd0b26', N'1262661109474283520', N'【身份认证服务】- 修改密码', N'/api/identity/my-profile/change-password', N'', N'', N'/api/identity/my-profile/change-password', N'POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'35', N'{}', N'4828f7c2aff8485189f37aba5de62d60', N'1262663888804663296', N'【身份认证管理】- 角色管理', N'/api/identity/roles', N'', N'', N'/api/identity/roles', N'GET,POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'36', N'{}', N'0fddcd3b50a24c6795ec9034fdb44778', N'1262664024096133120', N'【身份认证服务】- 角色列表', N'/api/identity/roles/all', N'', N'', N'/api/identity/roles/all', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'37', N'{}', N'191e555219e845069dfd93793263a840', N'1262664186252120064', N'【身份认证服务】- 单个角色', N'/api/identity/roles/{id}', N'', N'', N'/api/identity/roles/{id}', N'GET,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'38', N'{}', N'c316858e82f74e6ca6e923d6b3a3fa76', N'1262664357044178944', N'【身份认证服务】- 用户注册', N'/api/account/register', N'', N'', N'/api/account/register', N'POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'39', N'{}', N'db53b6f957914a10a6a97ba306b1f6ef', N'1262664632928718848', N'【身份认证服务】- 单个用户', N'/api/identity/users/{id}', N'', N'', N'/api/identity/users/{id}', N'GET,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'40', N'{}', N'1833434b8ce34f8ab791e7e950f4c61f', N'1262664751409418240', N'【身份认证服务】- 用户管理', N'/api/identity/users', N'', N'', N'/api/identity/users', N'GET,POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'41', N'{}', N'b3c963a1612144918bffaf272697498c', N'1262664871274237952', N'【身份认证服务】- 用户角色', N'/api/identity/users/{id}/roles', N'', N'', N'/api/identity/users/{id}/roles', N'GET,POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'42', N'{}', N'33dd757b79cb4f52994af13bfb4f6783', N'1262665026111164416', N'【身份认证服务】- 通过用户名查询用户', N'/api/identity/users/by-username/{userName}', N'', N'', N'/api/identity/users/by-username/{userName}', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'43', N'{}', N'e46fd6cb3a104da3aadfe0149fe4de68', N'1262665159905267712', N'【身份认证服务】- 通过邮件查询用户', N'/api/identity/users/by-email/{email}', N'', N'', N'/api/identity/users/by-email/{email}', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'44', N'{}', N'8c8ec5ad6aaa4145981ee7ac876c36c9', N'1262665329829105664', N'【身份认证服务】- 通过标识查询用户', N'/api/identity/users/lookup/{id}', N'', N'', N'/api/identity/users/lookup/{id}', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'45', N'{}', N'f5c0c8c02c0846fdbe5015cd86f3d81b', N'1262665456471920640', N'【身份认证服务】- 通过名称查询用户', N'/api/identity/users/lookup/by-username/{userName}', N'', N'', N'/api/identity/users/lookup/by-username/{userName}', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'46', N'{}', N'ecf0ea4a3e3c4b2e8fa3621514d00c74', N'1262665628165754880', N'【基础服务】- 通过名称查询租户', N'/api/abp/multi-tenancy/tenants/by-name/{name}', N'', N'', N'/api/abp/multi-tenancy/tenants/by-name/{name}', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'47', N'{}', N'69132bc515b64005af4292ce0dee5626', N'1262666172682883072', N'【基础服务】- 通过标识查询租户', N'/api/abp/multi-tenancy/tenants/by-id/{id}', N'', N'', N'/api/abp/multi-tenancy/tenants/by-id/{id}', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'49', N'{}', N'35f48d7bc3694bbf95d64fe59aa631ac', N'1262723402331885568', N'【身份认证服务】- 已有的跨域资源', N'/api/identity-server/clients/distinct-cors-origins', N'', N'', N'/api/identity-server/clients/distinct-cors-origins', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'distinct-cors-origins', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'50', N'{}', N'f333d028839d4fc2aafa8509e674d7dd', N'1262935771746734080', N'【身份认证服务】- 身份资源', N'/api/identity-server/identity-resources', N'', N'', N'/api/identity-server/identity-resources', N'GET,POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'51', N'{}', N'dffd1bfaca5b4c1890221678f2b16cd5', N'1262935906522304512', N'【身份认证服务】- 身份资源管理', N'/api/identity-server/identity-resources/{id}', N'', N'', N'/api/identity-server/identity-resources/{id}', N'GET,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'54', N'{}', N'7b847d8434bc4d1db07fa8961d90c14a', N'1263074419073593344', N'【服务网关管理】- 接口代理', N'/api/abp/api-definition', N'', N'', N'/api/abp/apigateway/api-definition', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30001,', N'', N'', N'apigateway-api-definition', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'55', N'{}', N'ca2cedfa620045a9adef0be2f958c4bc', N'1263075249394790400', N'【服务网关管理】- 查询聚合路由', N'/api/ApiGateway/Aggregates/{RouteId}', N'', N'', N'/api/ApiGateway/Aggregates/{RouteId}', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30001,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'57', N'{}', N'98fbc99fc8644946ac0a72cc3dc5fd1f', N'1263075593499684864', N'【服务网关管理】- 聚合路由配置', N'/api/ApiGateway/Aggregates/RouteConfig', N'', N'', N'/api/ApiGateway/Aggregates/RouteConfig', N'POST,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30001,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'59', N'{}', N'c692b30c72d4424eb4740ac49f4e9373', N'1263101898440146944', N'【服务网关管理】- 框架配置', N'/api/abp/application-configuration', N'', N'', N'/api/abp/apigateway/application-configuration', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30001,', N'', N'', N'apigateway-configuration', N'0', N'120000', N'1', N'', N'TEST-APP'), (N'60', N'{}', N'8409117162504f71aa66982f05c38a80', N'1263303878648569856', N'【平台服务】- 接口代理', N'/api/abp/api-definition', N'', N'', N'/api/abp/platform/api-definition', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'platform-api-definition', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'61', N'{}', N'9f520820071b4e14bc94ab57989cea1f', N'1263304204797648896', N'【平台服务】- 框架配置', N'/api/abp/application-configuration', N'', N'', N'/api/abp/platform/application-configuration', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'platform-configuration', N'0', N'120000', N'1', N'', N'TEST-APP'), (N'62', N'{}', N'530ab314560f41678b40f48da9383d51', N'1263304872891555840', N'【后台管理】- 租户管理', N'/api/tenant-management/tenants', N'', N'', N'/api/tenant-management/tenants', N'GET,POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'63', N'{}', N'21334c6da4c349cc883c38c13de0e754', N'1263305106250047488', N'【后台管理】- 特定租户管理', N'/api/tenant-management/tenants/{id}', N'', N'', N'/api/tenant-management/tenants/{id}', N'GET,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'64', N'{}', N'cc8fdf1b2d0b414ebf2dc51a6dc78305', N'1263305244594970624', N'【后台管理】- 租户连接字符串', N'/api/tenant-management/tenants/{id}/connection-string', N'', N'', N'/api/tenant-management/tenants/{id}/concatenation', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'2', N'30000', N'1', N'', N'TEST-APP'), (N'65', N'{}', N'aaf285ed10da4024ba561d5cf8c6322b', N'1263305430536855552', N'【后台管理】- 特定租户连接字符串', N'/api/tenant-management/tenants/{id}/connection-string/{name}', N'', N'', N'/api/tenant-management/tenants/{id}/concatenation/{name}', N'GET,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'1', N'30000', N'1', N'', N'TEST-APP'), (N'66', N'{}', N'b6ec80673b354c239def3bdce31b4cc0', N'1263639172959174656', N'【后台管理】- 全局设置', N'/api/setting-management/settings/by-global', N'', N'', N'/api/setting-management/settings/by-global', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'67', N'{}', N'755b4dce5c34444785fa3b647fef4131', N'1264799968944640000', N'【身份认证服务】- 验证手机号', N'/api/account/phone/verify', N'', N'', N'/api/account/phone/verify', N'POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'68', N'{}', N'535191c570ae453ab320012304d7a62c', N'1264800070161584128', N'【身份认证服务】- 手机号注册', N'/api/account/phone/register', N'', N'', N'/api/account/phone/register', N'POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'69', N'{}', N'723c9b111f9f4a1aa804118cdde193d3', N'1267360794414161920', N'【消息服务】- 通知', N'/signalr-hubs/notifications/{everything}', N'', N'', N'/signalr-hubs/notifications/{everything}', N'POST,GET,OPTIONS,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'ws', N'127.0.0.1:30020,', N'', N'', N'', N'1', N'30000', N'1', N'', N'TEST-APP'), (N'70', N'{}', N'f3aa2b42dd9f468aa5aae4ef64754427', N'1267383367629807616', N'【消息服务】- 通知0', N'/signalr-hubs/notifications', N'', N'', N'/signalr-hubs/notifications', N'GET,POST,PUT,DELETE,OPTIONS,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'ws', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'71', N'{}', N'99dc8259c50044008c8aede7442ddde3', N'1267817055527632896', N'【消息服务】- 聊天', N'/signalr-hubs/message', N'', N'', N'/signalr-hubs/message', N'GET,POST,PUT,DELETE,OPTIONS,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'ws', N'127.0.0.1:30020,', N'', N'', N'', N'1', N'30000', N'1', N'', N'TEST-APP'), (N'72', N'{}', N'4ec40b72d469474ba10ae02e8d3298bb', N'1267817221286526976', N'【消息服务】- 聊天1', N'/signalr-hubs/message/{everything}', N'', N'', N'/signalr-hubs/message/{everything}', N'GET,POST,PUT,DELETE,OPTIONS,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'ws', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'73', N'{}', N'cfb5f09a12bf495fbcaf2fa5d9123a40', N'1268893687085518848', N'【身份认证服务】- 重置密码', N'/api/account/phone/reset-password', N'', N'', N'/api/account/phone/reset-password', N'PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'1', N'30000', N'1', N'', N'TEST-APP'), (N'101', N'{}', N'997a4c27a433458aafed9b8aa252d957', N'1288657613998579712', N'【身份认证服务】- 组织机构列表', N'/api/identity/organization-units', N'', N'', N'/api/identity/organization-units', N'GET,POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'102', N'{}', N'a2c6acc9882a425ab26bd3ad5a9c17c6', N'1288657941770854400', N'【身份认证服务】- 组织机构管理', N'/api/identity/organization-units/{id}', N'', N'', N'/api/identity/organization-units/{id}', N'GET,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'1', N'30000', N'1', N'', N'TEST-APP'), (N'103', N'{}', N'390acfb0e16943c6b61e731d47c282e9', N'1288658134067109888', N'【身份认证服务】- 组织机构移动', N'/api/identity/organization-units/{id}/move', N'', N'', N'/api/identity/organization-units/{id}/move', N'PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'104', N'{}', N'3515e75becf9447492ad60466b27c397', N'1288658305156964352', N'【身份认证服务】- 查询组织机构子级', N'/api/identity/organization-units/find-children', N'', N'', N'/api/identity/organization-units/find-children', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'105', N'{}', N'aab0a24d930f4f9687497e5ccaac2a31', N'1288658491216289792', N'【身份认证服务】- 查询组织机构最后一个子节点', N'/api/identity/organization-units/last-children', N'', N'', N'/api/identity/organization-units/last-children', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'106', N'{}', N'9b7c999b1c5140c497bc15914a815401', N'1288658638302142464', N'【身份认证服务】- 未加入组织机构角色', N'/api/identity/organization-units/{id}/unadded-roles', N'', N'', N'/api/identity/organization-units/{id}/unadded-roles', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'107', N'{}', N'b0cdb3f6908e42bd934ca99a78f22c3f', N'1288658791784308736', N'【身份认证服务】- 未加入组织机构用户', N'/api/identity/organization-units/{id}/unadded-users', N'', N'', N'/api/identity/organization-units/{id}/unadded-users', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'108', N'{}', N'1982bc6ffd92445b9b3f47067378d1fc', N'1290849478956199936', N'【后台管理】- 当前租户设置', N'/api/setting-management/settings/by-current-tenant', N'', N'', N'/api/setting-management/settings/by-current-tenant', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'109', N'{}', N'a7df3a04805d4cc8a6e6b3823c6dd468', N'1290849628051124224', N'【后台管理】- 用户设置', N'/api/setting-management/settings/by-user/{userId}', N'', N'', N'/api/setting-management/settings/by-user/{userId}', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'110', N'{}', N'ef6e38a529a345fab67f6a627cf20635', N'1290849798553776128', N'【后台管理】- 当前用户设置', N'/api/setting-management/settings/by-current-user', N'', N'', N'/api/setting-management/settings/by-current-user', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'112', N'{}', N'9844fed6507844f2ac64bd08649bd3a6', N'1291259822512693248', N'【身份认证服务】- 查询组织机构根节点', N'/api/identity/organization-units/root-node', N'', N'', N'/api/identity/organization-units/root-node', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'113', N'{}', N'24d8794cf8f943b4ac45d2bcccf7c128', N'1292620505149145088', N'【平台服务】- 文件系统', N'/api/file-management/file-system', N'', N'', N'/api/file-management/file-system', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'114', N'{}', N'0acf6762d3af43efb655107e0039f5fc', N'1292620665505775616', N'【平台服务】- 文件系统 - 目录管理', N'/api/file-management/file-system/folders', N'', N'', N'/api/file-management/file-system/folders', N'POST,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'115', N'{}', N'8b4363f70865419089b5f62ba35382df', N'1292620843398791168', N'【平台服务】- 文件系统 - 文件管理', N'/api/file-management/file-system/files', N'', N'', N'/api/file-management/file-system/files', N'GET,POST,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'', N'0', N'1200000', N'1', N'', N'TEST-APP'), (N'116', N'{}', N'7eb315567bbc470bbbfd26923c5d0aba', N'1292621027574874112', N'【平台服务】- 文件系统 - 复制目录', N'/api/file-management/file-system/folders/copy', N'', N'', N'/api/file-management/file-system/folders/copy', N'PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'117', N'{}', N'af5853680cff454fa66ff6022f18da23', N'1292621363161137152', N'【平台服务】- 文件系统 - 移动目录', N'/api/file-management/file-system/folders/move', N'', N'', N'/api/file-management/file-system/folders/move', N'PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'118', N'{}', N'6daa6d8c8adb466899988fd8181c29a8', N'1292621494837116928', N'【平台服务】- 文件系统 - 复制文件', N'/api/file-management/file-system/files/copy', N'', N'', N'/api/file-management/file-system/files/copy', N'PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'119', N'{}', N'9560caaa3bd9424984c44724aa54bfe9', N'1292621629260365824', N'【平台服务】- 文件系统 - 移动文件', N'/api/file-management/file-system/files/move', N'', N'', N'/api/file-management/file-system/files/move', N'PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'120', N'{}', N'fc2aaa6035484201b9014912930fb7cb', N'1292622526073864192', N'【平台服务】- 文件系统 - 详情页', N'/api/file-management/file-system/profile', N'', N'', N'/api/file-management/file-system/profile', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'121', N'{}', N'c6c7b027000942dda8ba0d2e2d8cf705', N'1293470838745821184', N'【后台管理】- 框架配置', N'/api/abp/application-configuration', N'', N'', N'/api/abp/backend-admin/application-configuration', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'backend-admin-configuration', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'122', N'{}', N'becd4342079d4399abda5b5ba3b46fdc', N'1293471661785706496', N'【消息服务】- 框架配置', N'/api/abp/application-configuration', N'', N'', N'/api/abp/messages/application-configuration', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'messages-configuration', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'123', N'{}', N'c828140cee3043c18ffc274f6461f0f2', N'1293472678392721408', N'【后台管理】- 接口代理', N'/api/abp/api-definition', N'', N'', N'/api/abp/backend-admin/api-definition', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'backend-admin-api-definition', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'124', N'{}', N'e683cff8066d4c2899a17d0f618f1a0b', N'1293472857510473728', N'【消息服务】- 接口代理', N'/api/abp/api-definition', N'', N'', N'/api/abp/messages/api-definition', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'messages-api-definition', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'125', N'{}', N'0e9c3bff5b58428eba97a5516140ba5e', N'1299273336009359360', N'【消息服务】- Hangfire仪表板 ', N'/hangfire', N'', N'', N'/hangfire', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'126', N'{}', N'e906924ad3a947cf8e6956e2dd258192', N'1299273436282585088', N'【消息服务】- Hangfire仪表板 - 主页', N'/hangfire/', N'', N'', N'/hangfire/', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'127', N'{}', N'e02f2049efbc4ee1ad6629bd0341ed2b', N'1299273618470567936', N'【消息服务】- Hangfire仪表板 - 状态', N'/hangfire/stats', N'', N'', N'/hangfire/stats', N'POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'128', N'{}', N'f8d2b2f0f1d649c2a07eeef23d6adb0e', N'1299273770182737920', N'【消息服务】- Hangfire仪表板 - 作业管理', N'/hangfire/jobs/{everything}', N'', N'', N'/hangfire/jobs/{everything}', N'GET,POST,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'129', N'{}', N'9785be7a29774b468e271b23009fe115', N'1299273978023084032', N'【消息服务】- Hangfire仪表板 - 重试', N'/hangfire/retries', N'', N'', N'/hangfire/retries', N'GET,POST,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'130', N'{}', N'9c0c1cd196bb45c0bc03fafb7a1eb8f2', N'1299274123225694208', N'【消息服务】- Hangfire仪表板 - 周期性作业', N'/hangfire/recurring', N'', N'', N'/hangfire/recurring', N'GET,POST,DELETE,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'131', N'{}', N'243bafe828be463ea63a3e2b521f9923', N'1299274222299348992', N'【消息服务】- Hangfire仪表板 - 服务器列表', N'/hangfire/servers', N'', N'', N'/hangfire/servers', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'132', N'{}', N'57a8ac1b41bb434cad38fbde0e2ba2f0', N'1304238876758495232', N'【后台管理】- 管理功能', N'/api/feature-management/features', N'', N'', N'/api/feature-management/features', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'133', N'{}', N'40a150f629b047f587c91a9436a699c0', N'1304678610343383040', N'【身份认证服务】- 接口代理', N'/api/abp/api-definition', N'', N'', N'/api/abp/identity-server/api-definition', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'identity-server-api-definition', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'134', N'{}', N'3a2d5d538fa44ac690402fc5c4e1a401', N'1304679169305694208', N'【身份认证服务】- 框架配置', N'/api/abp/application-configuration', N'', N'', N'/api/abp/identity-server/application-configuration', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'identity-server-configuration', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'135', N'{}', N'2ecfe7483bc94c28ad0769b654eb765d', N'1310460417141817344', N'【后台管理】- 审计日志列表', N'/api/auditing/audit-log', N'', N'', N'/api/auditing/audit-log', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'136', N'{}', N'744e340c0024462d88458b7ea9605b3c', N'1310502391475519488', N'【后台服务】- 安全日志列表', N'/api/auditing/security-log', N'', N'', N'/api/auditing/security-log', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'137', N'{}', N'a99639f4172547c4ba9b4f4ca5cb4ab9', N'1310515546943569920', N'【后台服务】- 安全日志', N'/api/auditing/security-log/{id}', N'', N'', N'/api/auditing/security-log/{id}', N'DELETE,GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'138', N'{}', N'c3ebc82d55f640fb9d70a911e97e4ec1', N'1310515735292985344', N'【后台管理】- 审计日志', N'/api/auditing/audit-log/{id}', N'', N'', N'/api/auditing/audit-log/{id}', N'DELETE,GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'139', N'{}', N'0379fcb3a9cd4b13b562b3b5b5c3eb7d', N'1316628769783480320', N'【身份认证服务】- 声明类型', N'/api/identity/claim-types', N'', N'', N'/api/identity/claim-types', N'GET,POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'140', N'{}', N'de25c9a80d994f728b37eb483b2f5127', N'1316628940663619584', N'【身份认证服务】- 管理声明类型', N'/api/identity/claim-types/{id}', N'', N'', N'/api/identity/claim-types/{id}', N'GET,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'141', N'{}', N'25c19106baff4cf3a877ae8cd690a1b5', N'1316629112428756992', N'【身份认证服务】- 查询在用的声明类型列表', N'/api/identity/claim-types/actived-list', N'', N'', N'/api/identity/claim-types/actived-list', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'142', N'{}', N'd42f8b779cf344eeaa24df0ae37fb7cf', N'1316652047017246720', N'【身份认证服务】- 管理用户声明', N'/api/identity/users/claims/{id}', N'', N'', N'/api/identity/users/claims/{id}', N'POST,PUT,DELETE,GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'143', N'{}', N'b86af44a34a14db4b482df8550f1bde1', N'1316913899996737536', N'【身份认证管理】- 管理角色声明', N'/api/identity/roles/claims/{id}', N'', N'', N'/api/identity/roles/claims/{id}', N'GET,POST,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'144', N'{}', N'51a14bc295044de985ae014fbcc5bddf', N'1319200951383199744', N'【IdentityServer4】- 发现端点', N'/.well-known/openid-configuration', N'', N'', N'/.well-known/openid-configuration', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:44385,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'145', N'{}', N'9d859a444d774e93818237e53b6cc102', N'1319221929807024128', N'【身份认证服务】- 查询所有组织机构', N'/api/identity/organization-units/all', N'', N'', N'/api/identity/organization-units/all', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'146', N'{}', N'89f42175b24540caba2a1fded145acf8', N'1319554431134306304', N'【身份认证服务】- 管理组织机构用户', N'/api/identity/organization-units/{id}/users', N'', N'', N'/api/identity/organization-units/{id}/users', N'POST,GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'147', N'{}', N'126d82509cec43eda712e94737b01039', N'1319554550458060800', N'【身份认证服务】- 管理组织机构角色', N'/api/identity/organization-units/{id}/roles', N'', N'', N'/api/identity/organization-units/{id}/roles', N'POST,GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'148', N'{}', N'824f5eee6877489f96f1022e306c968a', N'1319554948434595840', N'【身份认证服务】- 管理角色组织机构', N'/api/identity/roles/{id}/organization-units', N'', N'', N'/api/identity/roles/{id}/organization-units', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'149', N'{}', N'fe1379d4a13f41afb6410f4c948871f3', N'1319555067183730688', N'【身份认证服务】- 删除角色组织机构', N'/api/identity/roles/{id}/organization-units/{ouId}', N'', N'', N'/api/identity/roles/{id}/organization-units/{ouId}', N'DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'150', N'{}', N'197a69bb723346aba3601bd61e7fa655', N'1319555230765780992', N'【身份认证服务】- 管理用户组织机构', N'/api/identity/users/{id}/organization-units', N'', N'', N'/api/identity/users/{id}/organization-units', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'151', N'{}', N'1a7e6d0b1c95484f82a75a2ce6e6f453', N'1319555333790470144', N'【身份认证服务】- 删除用户组织机构', N'/api/identity/users/{id}/organization-units/{ouId}', N'', N'', N'/api/identity/users/{id}/organization-units/{ouId}', N'DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP') +INSERT INTO [apigateway].[appapigatewayreroute] VALUES (N'4', N'{}', N'84059fcecc91498b9beafac914865e2c', N'1261299170387169280', N'【后台管理】- 权限管理', N'/api/permission-management/permissions', N'', NULL, N'/api/permission-management/permissions', N'GET,PUT,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30010,', N'', NULL, NULL, NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'5', N'{}', N'f2312eed73cc4d3cbefcd1816849fd74', N'1261585859064872960', N'【身份认证服务】- 客户端', N'/api/identity-server/clients', N'', NULL, N'/api/identity-server/clients', N'POST,GET,', N'', N'', N'X-Forwarded-For:{RemoteIpAddress},', N'', N'', N'', NULL, N'1', N'', NULL, N'HTTP', N'127.0.0.1:30015,', N'', NULL, NULL, NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'6', N'{}', N'b764ec7b994147abb12974bfcee4a0a9', N'1261586605810368512', N'【身份认证服务】- 管理客户端', N'/api/identity-server/clients/{Id}', N'', NULL, N'/api/identity-server/clients/{Id}', N'GET,DELETE,PUT,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30015,', N'', NULL, NULL, NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'7', N'{}', N'b4ce189320804dc6b87e602594e93d35', N'1261587558609436672', N'【服务网关管理】- 路由组管理', N'/api/ApiGateway/RouteGroups', N'', N'', N'/api/ApiGateway/RouteGroups', N'GET,POST,PUT,DELETE,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'8', N'{}', N'8736fefa36da4b129f3fcf6aa095f2ce', N'1261588213298348032', N'【服务网关管理】- 查询单个路由组', N'/api/ApiGateway/RouteGroups/By-AppId/{AppId}', N'', N'', N'/api/ApiGateway/RouteGroups/By-AppId/{AppId}', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'9', N'{}', N'befd14ad39e244bc9dea7e0c01e642ce', N'1261588367619375104', N'【服务网关管理】- 查询所有有效路由组', N'/api/ApiGateway/RouteGroups/Actived', N'', N'', N'/api/ApiGateway/RouteGroups/Actived', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'10', N'{}', N'0a95945d77144ce69addb0d1e8d37837', N'1261588628450557952', N'【服务网关管理】- 基础配置', N'/api/ApiGateway/Globals', N'', N'', N'/api/ApiGateway/Globals', N'GET,POST,PUT,DELETE,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'11', N'{}', N'70ee7f919bf44b42b549c905316bfd75', N'1261588881564221440', N'【服务网关管理】- 查询单个基础配置', N'/api/ApiGateway/Globals/By-AppId/{AppId}', N'', N'', N'/api/ApiGateway/Globals/By-AppId/{AppId}', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'12', N'{}', N'caf54542d561428a9123ebed88e4b2e9', N'1261588983053795328', N'【服务网关管理】- 路由配置', N'/api/ApiGateway/Routes', N'', N'', N'/api/ApiGateway/Routes', N'GET,POST,PUT,DELETE,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'13', N'{}', N'df6c48fdaab44a37842992ae61c59dc5', N'1261589139039961088', N'【服务网关管理】- 通过标识查询路由', N'/api/ApiGateway/Routes/By-RouteId/{RouteId}', N'', N'', N'/api/ApiGateway/Routes/By-RouteId/{RouteId}', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'14', N'{}', N'aaeaedebd24a4011ad565b5559f84c5f', N'1261589197483393024', N'【服务网关管理】- 通过名称查询路由', N'/api/ApiGateway/Routes/By-RouteName/{RouteName}', N'', N'', N'/api/ApiGateway/Routes/By-RouteName/{RouteName}', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'15', N'{}', N'559c9f1b2b8c44caac86f7a643a16aaa', N'1261589278857084928', N'【服务网关管理】- 通过应用标识查询路由', N'/api/ApiGateway/Routes/By-AppId/{AppId}', N'', N'', N'/api/ApiGateway/Routes/By-AppId/{AppId}', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'16', N'{}', N'00d0a12f403a4a919c99c534bd76d0d0', N'1261589420356124672', N'【服务网关管理】- 清空应用标识下所有路由', N'/api/ApiGateway/Routes/Clear', N'', N'', N'/api/ApiGateway/Routes/Clear', N'DELETE,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, N'', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'17', N'{}', N'8c308f1386ad49c799cd281eb95170ac', N'1261589960393736192', N'【服务网关管理】- 通过应用标识查询动态路由', N'/api/ApiGateway/DynamicRoutes/By-AppId/{AppId}', N'', NULL, N'/api/ApiGateway/DynamicRoutes/By-AppId/{AppId}', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, NULL, NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'18', N'{}', N'e659ebbf61534a978335cfeabdc0b375', N'1261606600242085888', N'【服务网关管理】- 通过应用标识查询聚合路由', N'/api/ApiGateway/Aggregates/by-AppId/{AppId}', N'', NULL, N'/api/ApiGateway/Aggregates/by-AppId/{AppId}', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, NULL, NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'19', N'{}', N'd665e4491b81413385858601d9cf9a1d', N'1261606689601732608', N'【服务网关管理】- 聚合路由', N'/api/ApiGateway/Aggregates', N'', NULL, N'/api/ApiGateway/Aggregates', N'GET,POST,PUT,DELETE,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30001,', N'', NULL, NULL, NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'22', N'{}', N'2aad614e2c2a497593a4784ff639c3d9', N'1262220447629058048', N'【身份认证服务】- 克隆客户端', N'/api/identity-server/clients/{id}/clone', N'', NULL, N'/api/identity-server/clients/{id}/clone', N'POST,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30015,', N'', NULL, NULL, NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'23', N'{}', N'1504c5e4a7334298878339a305445b21', N'1262230734939758592', N'【身份认证服务】- 可用的Api资源', N'/api/identity-server/clients/assignable-api-resources', N'', NULL, N'/api/identity-server/clients/assignable-api-resources', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30015,', N'', NULL, N'assignable-api-resources', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'25', N'{}', N'53dd1751d9104940a966006a5e93d1fa', N'1262296916350869504', N'【身份认证服务】- 可用的身份资源', N'/api/identity-server/clients/assignable-identity-resources', N'', NULL, N'/api/identity-server/clients/assignable-identity-resources', N'GET,', N'', N'', N'', N'', N'', N'', NULL, N'1', NULL, NULL, N'HTTP', N'127.0.0.1:30015,', N'', NULL, N'assignable-identity-resources', NULL, N'30000', N'1', NULL, N'TEST-APP'), (N'26', N'{}', N'3fccd1318d0d47d9aef85542668829a6', N'1262632376348594176', N'【身份认证服务】- Api资源', N'/api/identity-server/api-resources', N'', N'', N'/api/identity-server/api-resources', N'GET,POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'27', N'{}', N'de6bd0ddea6d4019b4855be5442fafdc', N'1262632791869902848', N'【身份认证服务】- 管理Api资源', N'/api/identity-server/api-resources/{id}', N'', N'', N'/api/identity-server/api-resources/{id}', N'GET,DELETE,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'30', N'{}', N'0f9875697b74420c9dc2eaf77099b210', N'1262660336921235456', N'【身份认证服务】- 用户登录', N'/api/account/login', N'', N'', N'/api/account/login', N'POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'31', N'{}', N'a890c6ecc6a64c9fa313a0f6b5406e1c', N'1262660528277966848', N'【身份认证服务】- 用户登出', N'/api/account/logout', N'', N'', N'/api/account/logout', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'32', N'{}', N'88de580b6beb4d9d9d4367840ba1fcea', N'1262660706875625472', N'【身份认证服务】- 检查密码', N'/api/account/checkPassword', N'', N'', N'/api/account/checkPassword', N'POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'33', N'{}', N'78f3c1adc7a54696af37a419eda47c62', N'1262660966393991168', N'【身份认证服务】- 个人信息页', N'/api/identity/my-profile', N'', N'', N'/api/identity/my-profile', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'34', N'{}', N'95b23aa5cebb40598a78c0761cfd0b26', N'1262661109474283520', N'【身份认证服务】- 修改密码', N'/api/identity/my-profile/change-password', N'', N'', N'/api/identity/my-profile/change-password', N'POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'35', N'{}', N'4828f7c2aff8485189f37aba5de62d60', N'1262663888804663296', N'【身份认证管理】- 角色管理', N'/api/identity/roles', N'', N'', N'/api/identity/roles', N'GET,POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'36', N'{}', N'0fddcd3b50a24c6795ec9034fdb44778', N'1262664024096133120', N'【身份认证服务】- 角色列表', N'/api/identity/roles/all', N'', N'', N'/api/identity/roles/all', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'37', N'{}', N'191e555219e845069dfd93793263a840', N'1262664186252120064', N'【身份认证服务】- 单个角色', N'/api/identity/roles/{id}', N'', N'', N'/api/identity/roles/{id}', N'GET,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'38', N'{}', N'c316858e82f74e6ca6e923d6b3a3fa76', N'1262664357044178944', N'【身份认证服务】- 用户注册', N'/api/account/register', N'', N'', N'/api/account/register', N'POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'39', N'{}', N'db53b6f957914a10a6a97ba306b1f6ef', N'1262664632928718848', N'【身份认证服务】- 单个用户', N'/api/identity/users/{id}', N'', N'', N'/api/identity/users/{id}', N'GET,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'40', N'{}', N'1833434b8ce34f8ab791e7e950f4c61f', N'1262664751409418240', N'【身份认证服务】- 用户管理', N'/api/identity/users', N'', N'', N'/api/identity/users', N'GET,POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'41', N'{}', N'b3c963a1612144918bffaf272697498c', N'1262664871274237952', N'【身份认证服务】- 用户角色', N'/api/identity/users/{id}/roles', N'', N'', N'/api/identity/users/{id}/roles', N'GET,POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'42', N'{}', N'33dd757b79cb4f52994af13bfb4f6783', N'1262665026111164416', N'【身份认证服务】- 通过用户名查询用户', N'/api/identity/users/by-username/{userName}', N'', N'', N'/api/identity/users/by-username/{userName}', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'43', N'{}', N'e46fd6cb3a104da3aadfe0149fe4de68', N'1262665159905267712', N'【身份认证服务】- 通过邮件查询用户', N'/api/identity/users/by-email/{email}', N'', N'', N'/api/identity/users/by-email/{email}', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'44', N'{}', N'8c8ec5ad6aaa4145981ee7ac876c36c9', N'1262665329829105664', N'【身份认证服务】- 通过标识查询用户', N'/api/identity/users/lookup/{id}', N'', N'', N'/api/identity/users/lookup/{id}', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'45', N'{}', N'f5c0c8c02c0846fdbe5015cd86f3d81b', N'1262665456471920640', N'【身份认证服务】- 通过名称查询用户', N'/api/identity/users/lookup/by-username/{userName}', N'', N'', N'/api/identity/users/lookup/by-username/{userName}', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'46', N'{}', N'ecf0ea4a3e3c4b2e8fa3621514d00c74', N'1262665628165754880', N'【基础服务】- 通过名称查询租户', N'/api/abp/multi-tenancy/tenants/by-name/{name}', N'', N'', N'/api/abp/multi-tenancy/tenants/by-name/{name}', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'47', N'{}', N'69132bc515b64005af4292ce0dee5626', N'1262666172682883072', N'【基础服务】- 通过标识查询租户', N'/api/abp/multi-tenancy/tenants/by-id/{id}', N'', N'', N'/api/abp/multi-tenancy/tenants/by-id/{id}', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'49', N'{}', N'35f48d7bc3694bbf95d64fe59aa631ac', N'1262723402331885568', N'【身份认证服务】- 已有的跨域资源', N'/api/identity-server/clients/distinct-cors-origins', N'', N'', N'/api/identity-server/clients/distinct-cors-origins', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'distinct-cors-origins', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'50', N'{}', N'f333d028839d4fc2aafa8509e674d7dd', N'1262935771746734080', N'【身份认证服务】- 身份资源', N'/api/identity-server/identity-resources', N'', N'', N'/api/identity-server/identity-resources', N'GET,POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'51', N'{}', N'dffd1bfaca5b4c1890221678f2b16cd5', N'1262935906522304512', N'【身份认证服务】- 身份资源管理', N'/api/identity-server/identity-resources/{id}', N'', N'', N'/api/identity-server/identity-resources/{id}', N'GET,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'54', N'{}', N'7b847d8434bc4d1db07fa8961d90c14a', N'1263074419073593344', N'【服务网关管理】- 接口代理', N'/api/abp/api-definition', N'', N'', N'/api/abp/apigateway/api-definition', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30001,', N'', N'', N'apigateway-api-definition', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'55', N'{}', N'ca2cedfa620045a9adef0be2f958c4bc', N'1263075249394790400', N'【服务网关管理】- 查询聚合路由', N'/api/ApiGateway/Aggregates/{RouteId}', N'', N'', N'/api/ApiGateway/Aggregates/{RouteId}', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30001,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'57', N'{}', N'98fbc99fc8644946ac0a72cc3dc5fd1f', N'1263075593499684864', N'【服务网关管理】- 聚合路由配置', N'/api/ApiGateway/Aggregates/RouteConfig', N'', N'', N'/api/ApiGateway/Aggregates/RouteConfig', N'POST,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30001,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'59', N'{}', N'c692b30c72d4424eb4740ac49f4e9373', N'1263101898440146944', N'【服务网关管理】- 框架配置', N'/api/abp/application-configuration', N'', N'', N'/api/abp/apigateway/application-configuration', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30001,', N'', N'', N'apigateway-configuration', N'0', N'120000', N'1', N'', N'TEST-APP'), (N'60', N'{}', N'8409117162504f71aa66982f05c38a80', N'1263303878648569856', N'【平台服务】- 接口代理', N'/api/abp/api-definition', N'', N'', N'/api/abp/platform/api-definition', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'platform-api-definition', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'61', N'{}', N'9f520820071b4e14bc94ab57989cea1f', N'1263304204797648896', N'【平台服务】- 框架配置', N'/api/abp/application-configuration', N'', N'', N'/api/abp/platform/application-configuration', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'platform-configuration', N'0', N'120000', N'1', N'', N'TEST-APP'), (N'62', N'{}', N'530ab314560f41678b40f48da9383d51', N'1263304872891555840', N'【后台管理】- 租户管理', N'/api/tenant-management/tenants', N'', N'', N'/api/tenant-management/tenants', N'GET,POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'63', N'{}', N'21334c6da4c349cc883c38c13de0e754', N'1263305106250047488', N'【后台管理】- 特定租户管理', N'/api/tenant-management/tenants/{id}', N'', N'', N'/api/tenant-management/tenants/{id}', N'GET,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'64', N'{}', N'cc8fdf1b2d0b414ebf2dc51a6dc78305', N'1263305244594970624', N'【后台管理】- 租户连接字符串', N'/api/tenant-management/tenants/{id}/connection-string', N'', N'', N'/api/tenant-management/tenants/{id}/concatenation', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'2', N'30000', N'1', N'', N'TEST-APP'), (N'65', N'{}', N'aaf285ed10da4024ba561d5cf8c6322b', N'1263305430536855552', N'【后台管理】- 特定租户连接字符串', N'/api/tenant-management/tenants/{id}/connection-string/{name}', N'', N'', N'/api/tenant-management/tenants/{id}/concatenation/{name}', N'GET,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'1', N'30000', N'1', N'', N'TEST-APP'), (N'66', N'{}', N'b6ec80673b354c239def3bdce31b4cc0', N'1263639172959174656', N'【后台管理】- 全局设置', N'/api/setting-management/settings/by-global', N'', N'', N'/api/setting-management/settings/by-global', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'67', N'{}', N'755b4dce5c34444785fa3b647fef4131', N'1264799968944640000', N'【身份认证服务】- 验证手机号', N'/api/account/phone/verify', N'', N'', N'/api/account/phone/verify', N'POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'68', N'{}', N'535191c570ae453ab320012304d7a62c', N'1264800070161584128', N'【身份认证服务】- 手机号注册', N'/api/account/phone/register', N'', N'', N'/api/account/phone/register', N'POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'69', N'{}', N'723c9b111f9f4a1aa804118cdde193d3', N'1267360794414161920', N'【消息服务】- 通知', N'/signalr-hubs/notifications/{everything}', N'', N'', N'/signalr-hubs/notifications/{everything}', N'POST,GET,OPTIONS,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'ws', N'127.0.0.1:30020,', N'', N'', N'', N'1', N'30000', N'1', N'', N'TEST-APP'), (N'70', N'{}', N'f3aa2b42dd9f468aa5aae4ef64754427', N'1267383367629807616', N'【消息服务】- 通知0', N'/signalr-hubs/notifications', N'', N'', N'/signalr-hubs/notifications', N'GET,POST,PUT,DELETE,OPTIONS,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'ws', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'71', N'{}', N'0344947bb79b401baa2ef7b4e58297f6', N'1267817055527632896', N'【消息服务】- 聊天', N'/signalr-hubs/messages', N'', N'', N'/signalr-hubs/messages', N'GET,POST,PUT,DELETE,OPTIONS,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'ws', N'127.0.0.1:30020,', N'', N'', N'', N'1', N'30000', N'1', N'', N'TEST-APP'), (N'72', N'{}', N'6676b5e5f76d40739f9ccc3e371e2f18', N'1267817221286526976', N'【消息服务】- 聊天1', N'/signalr-hubs/messages/{everything}', N'', N'', N'/signalr-hubs/messages/{everything}', N'GET,POST,PUT,DELETE,OPTIONS,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'ws', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'73', N'{}', N'cfb5f09a12bf495fbcaf2fa5d9123a40', N'1268893687085518848', N'【身份认证服务】- 重置密码', N'/api/account/phone/reset-password', N'', N'', N'/api/account/phone/reset-password', N'PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'1', N'30000', N'1', N'', N'TEST-APP'), (N'101', N'{}', N'997a4c27a433458aafed9b8aa252d957', N'1288657613998579712', N'【身份认证服务】- 组织机构列表', N'/api/identity/organization-units', N'', N'', N'/api/identity/organization-units', N'GET,POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'102', N'{}', N'a2c6acc9882a425ab26bd3ad5a9c17c6', N'1288657941770854400', N'【身份认证服务】- 组织机构管理', N'/api/identity/organization-units/{id}', N'', N'', N'/api/identity/organization-units/{id}', N'GET,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'1', N'30000', N'1', N'', N'TEST-APP'), (N'103', N'{}', N'390acfb0e16943c6b61e731d47c282e9', N'1288658134067109888', N'【身份认证服务】- 组织机构移动', N'/api/identity/organization-units/{id}/move', N'', N'', N'/api/identity/organization-units/{id}/move', N'PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'104', N'{}', N'3515e75becf9447492ad60466b27c397', N'1288658305156964352', N'【身份认证服务】- 查询组织机构子级', N'/api/identity/organization-units/find-children', N'', N'', N'/api/identity/organization-units/find-children', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'105', N'{}', N'aab0a24d930f4f9687497e5ccaac2a31', N'1288658491216289792', N'【身份认证服务】- 查询组织机构最后一个子节点', N'/api/identity/organization-units/last-children', N'', N'', N'/api/identity/organization-units/last-children', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'106', N'{}', N'9b7c999b1c5140c497bc15914a815401', N'1288658638302142464', N'【身份认证服务】- 未加入组织机构角色', N'/api/identity/organization-units/{id}/unadded-roles', N'', N'', N'/api/identity/organization-units/{id}/unadded-roles', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'107', N'{}', N'b0cdb3f6908e42bd934ca99a78f22c3f', N'1288658791784308736', N'【身份认证服务】- 未加入组织机构用户', N'/api/identity/organization-units/{id}/unadded-users', N'', N'', N'/api/identity/organization-units/{id}/unadded-users', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'108', N'{}', N'1982bc6ffd92445b9b3f47067378d1fc', N'1290849478956199936', N'【后台管理】- 当前租户设置', N'/api/setting-management/settings/by-current-tenant', N'', N'', N'/api/setting-management/settings/by-current-tenant', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'109', N'{}', N'a7df3a04805d4cc8a6e6b3823c6dd468', N'1290849628051124224', N'【后台管理】- 用户设置', N'/api/setting-management/settings/by-user/{userId}', N'', N'', N'/api/setting-management/settings/by-user/{userId}', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'110', N'{}', N'ef6e38a529a345fab67f6a627cf20635', N'1290849798553776128', N'【后台管理】- 当前用户设置', N'/api/setting-management/settings/by-current-user', N'', N'', N'/api/setting-management/settings/by-current-user', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'112', N'{}', N'9844fed6507844f2ac64bd08649bd3a6', N'1291259822512693248', N'【身份认证服务】- 查询组织机构根节点', N'/api/identity/organization-units/root-node', N'', N'', N'/api/identity/organization-units/root-node', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'113', N'{}', N'24d8794cf8f943b4ac45d2bcccf7c128', N'1292620505149145088', N'【平台服务】- 文件系统', N'/api/file-management/file-system', N'', N'', N'/api/file-management/file-system', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'114', N'{}', N'0acf6762d3af43efb655107e0039f5fc', N'1292620665505775616', N'【平台服务】- 文件系统 - 目录管理', N'/api/file-management/file-system/folders', N'', N'', N'/api/file-management/file-system/folders', N'POST,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'115', N'{}', N'8b4363f70865419089b5f62ba35382df', N'1292620843398791168', N'【平台服务】- 文件系统 - 文件管理', N'/api/file-management/file-system/files', N'', N'', N'/api/file-management/file-system/files', N'GET,POST,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'', N'0', N'1200000', N'1', N'', N'TEST-APP'), (N'116', N'{}', N'7eb315567bbc470bbbfd26923c5d0aba', N'1292621027574874112', N'【平台服务】- 文件系统 - 复制目录', N'/api/file-management/file-system/folders/copy', N'', N'', N'/api/file-management/file-system/folders/copy', N'PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'117', N'{}', N'af5853680cff454fa66ff6022f18da23', N'1292621363161137152', N'【平台服务】- 文件系统 - 移动目录', N'/api/file-management/file-system/folders/move', N'', N'', N'/api/file-management/file-system/folders/move', N'PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'118', N'{}', N'6daa6d8c8adb466899988fd8181c29a8', N'1292621494837116928', N'【平台服务】- 文件系统 - 复制文件', N'/api/file-management/file-system/files/copy', N'', N'', N'/api/file-management/file-system/files/copy', N'PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'119', N'{}', N'9560caaa3bd9424984c44724aa54bfe9', N'1292621629260365824', N'【平台服务】- 文件系统 - 移动文件', N'/api/file-management/file-system/files/move', N'', N'', N'/api/file-management/file-system/files/move', N'PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'120', N'{}', N'fc2aaa6035484201b9014912930fb7cb', N'1292622526073864192', N'【平台服务】- 文件系统 - 详情页', N'/api/file-management/file-system/profile', N'', N'', N'/api/file-management/file-system/profile', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30025,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'121', N'{}', N'c6c7b027000942dda8ba0d2e2d8cf705', N'1293470838745821184', N'【后台管理】- 框架配置', N'/api/abp/application-configuration', N'', N'', N'/api/abp/backend-admin/application-configuration', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'backend-admin-configuration', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'122', N'{}', N'becd4342079d4399abda5b5ba3b46fdc', N'1293471661785706496', N'【消息服务】- 框架配置', N'/api/abp/application-configuration', N'', N'', N'/api/abp/messages/application-configuration', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'messages-configuration', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'123', N'{}', N'c828140cee3043c18ffc274f6461f0f2', N'1293472678392721408', N'【后台管理】- 接口代理', N'/api/abp/api-definition', N'', N'', N'/api/abp/backend-admin/api-definition', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'backend-admin-api-definition', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'124', N'{}', N'e683cff8066d4c2899a17d0f618f1a0b', N'1293472857510473728', N'【消息服务】- 接口代理', N'/api/abp/api-definition', N'', N'', N'/api/abp/messages/api-definition', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'messages-api-definition', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'125', N'{}', N'0e9c3bff5b58428eba97a5516140ba5e', N'1299273336009359360', N'【消息服务】- Hangfire仪表板 ', N'/hangfire', N'', N'', N'/hangfire', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'126', N'{}', N'e906924ad3a947cf8e6956e2dd258192', N'1299273436282585088', N'【消息服务】- Hangfire仪表板 - 主页', N'/hangfire/', N'', N'', N'/hangfire/', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'127', N'{}', N'e02f2049efbc4ee1ad6629bd0341ed2b', N'1299273618470567936', N'【消息服务】- Hangfire仪表板 - 状态', N'/hangfire/stats', N'', N'', N'/hangfire/stats', N'POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'128', N'{}', N'f8d2b2f0f1d649c2a07eeef23d6adb0e', N'1299273770182737920', N'【消息服务】- Hangfire仪表板 - 作业管理', N'/hangfire/jobs/{everything}', N'', N'', N'/hangfire/jobs/{everything}', N'GET,POST,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'129', N'{}', N'9785be7a29774b468e271b23009fe115', N'1299273978023084032', N'【消息服务】- Hangfire仪表板 - 重试', N'/hangfire/retries', N'', N'', N'/hangfire/retries', N'GET,POST,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'130', N'{}', N'9c0c1cd196bb45c0bc03fafb7a1eb8f2', N'1299274123225694208', N'【消息服务】- Hangfire仪表板 - 周期性作业', N'/hangfire/recurring', N'', N'', N'/hangfire/recurring', N'GET,POST,DELETE,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'131', N'{}', N'243bafe828be463ea63a3e2b521f9923', N'1299274222299348992', N'【消息服务】- Hangfire仪表板 - 服务器列表', N'/hangfire/servers', N'', N'', N'/hangfire/servers', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'132', N'{}', N'57a8ac1b41bb434cad38fbde0e2ba2f0', N'1304238876758495232', N'【后台管理】- 管理功能', N'/api/feature-management/features', N'', N'', N'/api/feature-management/features', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'133', N'{}', N'40a150f629b047f587c91a9436a699c0', N'1304678610343383040', N'【身份认证服务】- 接口代理', N'/api/abp/api-definition', N'', N'', N'/api/abp/identity-server/api-definition', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'identity-server-api-definition', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'134', N'{}', N'3a2d5d538fa44ac690402fc5c4e1a401', N'1304679169305694208', N'【身份认证服务】- 框架配置', N'/api/abp/application-configuration', N'', N'', N'/api/abp/identity-server/application-configuration', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'identity-server-configuration', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'135', N'{}', N'2ecfe7483bc94c28ad0769b654eb765d', N'1310460417141817344', N'【后台管理】- 审计日志列表', N'/api/auditing/audit-log', N'', N'', N'/api/auditing/audit-log', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'136', N'{}', N'744e340c0024462d88458b7ea9605b3c', N'1310502391475519488', N'【后台服务】- 安全日志列表', N'/api/auditing/security-log', N'', N'', N'/api/auditing/security-log', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'137', N'{}', N'a99639f4172547c4ba9b4f4ca5cb4ab9', N'1310515546943569920', N'【后台服务】- 安全日志', N'/api/auditing/security-log/{id}', N'', N'', N'/api/auditing/security-log/{id}', N'DELETE,GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'138', N'{}', N'c3ebc82d55f640fb9d70a911e97e4ec1', N'1310515735292985344', N'【后台管理】- 审计日志', N'/api/auditing/audit-log/{id}', N'', N'', N'/api/auditing/audit-log/{id}', N'DELETE,GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30010,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'139', N'{}', N'0379fcb3a9cd4b13b562b3b5b5c3eb7d', N'1316628769783480320', N'【身份认证服务】- 声明类型', N'/api/identity/claim-types', N'', N'', N'/api/identity/claim-types', N'GET,POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'140', N'{}', N'de25c9a80d994f728b37eb483b2f5127', N'1316628940663619584', N'【身份认证服务】- 管理声明类型', N'/api/identity/claim-types/{id}', N'', N'', N'/api/identity/claim-types/{id}', N'GET,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'141', N'{}', N'25c19106baff4cf3a877ae8cd690a1b5', N'1316629112428756992', N'【身份认证服务】- 查询在用的声明类型列表', N'/api/identity/claim-types/actived-list', N'', N'', N'/api/identity/claim-types/actived-list', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'142', N'{}', N'd42f8b779cf344eeaa24df0ae37fb7cf', N'1316652047017246720', N'【身份认证服务】- 管理用户声明', N'/api/identity/users/claims/{id}', N'', N'', N'/api/identity/users/claims/{id}', N'POST,PUT,DELETE,GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'143', N'{}', N'b86af44a34a14db4b482df8550f1bde1', N'1316913899996737536', N'【身份认证管理】- 管理角色声明', N'/api/identity/roles/claims/{id}', N'', N'', N'/api/identity/roles/claims/{id}', N'GET,POST,PUT,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'144', N'{}', N'51a14bc295044de985ae014fbcc5bddf', N'1319200951383199744', N'【IdentityServer4】- 发现端点', N'/.well-known/openid-configuration', N'', N'', N'/.well-known/openid-configuration', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:44385,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'145', N'{}', N'9d859a444d774e93818237e53b6cc102', N'1319221929807024128', N'【身份认证服务】- 查询所有组织机构', N'/api/identity/organization-units/all', N'', N'', N'/api/identity/organization-units/all', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'146', N'{}', N'89f42175b24540caba2a1fded145acf8', N'1319554431134306304', N'【身份认证服务】- 管理组织机构用户', N'/api/identity/organization-units/{id}/users', N'', N'', N'/api/identity/organization-units/{id}/users', N'POST,GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'147', N'{}', N'126d82509cec43eda712e94737b01039', N'1319554550458060800', N'【身份认证服务】- 管理组织机构角色', N'/api/identity/organization-units/{id}/roles', N'', N'', N'/api/identity/organization-units/{id}/roles', N'POST,GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'148', N'{}', N'824f5eee6877489f96f1022e306c968a', N'1319554948434595840', N'【身份认证服务】- 管理角色组织机构', N'/api/identity/roles/{id}/organization-units', N'', N'', N'/api/identity/roles/{id}/organization-units', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'149', N'{}', N'fe1379d4a13f41afb6410f4c948871f3', N'1319555067183730688', N'【身份认证服务】- 删除角色组织机构', N'/api/identity/roles/{id}/organization-units/{ouId}', N'', N'', N'/api/identity/roles/{id}/organization-units/{ouId}', N'DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'150', N'{}', N'197a69bb723346aba3601bd61e7fa655', N'1319555230765780992', N'【身份认证服务】- 管理用户组织机构', N'/api/identity/users/{id}/organization-units', N'', N'', N'/api/identity/users/{id}/organization-units', N'GET,PUT,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'151', N'{}', N'1a7e6d0b1c95484f82a75a2ce6e6f453', N'1319555333790470144', N'【身份认证服务】- 删除用户组织机构', N'/api/identity/users/{id}/organization-units/{ouId}', N'', N'', N'/api/identity/users/{id}/organization-units/{ouId}', N'DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30015,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'152', N'{}', N'ecfa9bbd19694097b33e691b653f2124', N'1321001932510203904', N'【消息服务】- 我的消息', N'/api/im/chat/my-messages', N'', N'', N'/api/im/chat/my-messages', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'153', N'{}', N'4867ad188ca54acb8b961d20297b6545', N'1321002059803136000', N'【消息服务】- 我的最近消息', N'/api/im/chat/my-last-messages', N'', N'', N'/api/im/chat/my-last-messages', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'154', N'{}', N'291ab802d7bc4af98fc15c509f98fa75', N'1321002256440496128', N'【消息服务】- 我的朋友', N'/api/im/my-friends', N'', N'', N'/api/im/my-friends', N'GET,POST,DELETE,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'155', N'{}', N'08438dabb1e849988e0c304f82b08a10', N'1321002350686507008', N'【消息服务】- 我的所有朋友', N'/api/im/my-friends/all', N'', N'', N'/api/im/my-friends/all', N'GET,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP'), (N'156', N'{}', N'cecf632785b7402299764698369c751f', N'1322190027988525056', N'【消息服务】- 发送好友请求', N'/api/im/my-friends/add-request', N'', N'', N'/api/im/my-friends/add-request', N'POST,', N'', N'', N'', N'', N'', N'', N'', N'1', N'', N'', N'HTTP', N'127.0.0.1:30020,', N'', N'', N'', N'0', N'30000', N'1', N'', N'TEST-APP') GO COMMIT @@ -556,7 +556,7 @@ GO BEGIN TRANSACTION GO -INSERT INTO [apigateway].[appapigatewaysecurityoptions] VALUES (N'3', N'1261299170387169280', N'', N''), (N'4', N'1261585859064872960', N'', N''), (N'5', N'1261586605810368512', N'', N''), (N'6', N'1261587558609436672', N'', N''), (N'7', N'1261588213298348032', N'', N''), (N'8', N'1261588367619375104', N'', N''), (N'9', N'1261588628450557952', N'', N''), (N'10', N'1261588881564221440', N'', N''), (N'11', N'1261588983053795328', N'', N''), (N'12', N'1261589139039961088', N'', N''), (N'13', N'1261589197483393024', N'', N''), (N'14', N'1261589278857084928', N'', N''), (N'15', N'1261589420356124672', N'', N''), (N'16', N'1261589960393736192', N'', N''), (N'17', N'1261606600242085888', N'', N''), (N'18', N'1261606689601732608', N'', N''), (N'21', N'1262220447629058048', N'', N''), (N'22', N'1262230734939758592', N'', N''), (N'23', N'1262296916350869504', N'', N''), (N'24', N'1262632376348594176', N'', N''), (N'25', N'1262632791869902848', N'', N''), (N'28', N'1262660336921235456', N'', N''), (N'29', N'1262660528277966848', N'', N''), (N'30', N'1262660706875625472', N'', N''), (N'31', N'1262660966393991168', N'', N''), (N'32', N'1262661109474283520', N'', N''), (N'33', N'1262663888804663296', N'', N''), (N'34', N'1262664024096133120', N'', N''), (N'35', N'1262664186252120064', N'', N''), (N'36', N'1262664357044178944', N'', N''), (N'37', N'1262664632928718848', N'', N''), (N'38', N'1262664751409418240', N'', N''), (N'39', N'1262664871274237952', N'', N''), (N'40', N'1262665026111164416', N'', N''), (N'41', N'1262665159905267712', N'', N''), (N'42', N'1262665329829105664', N'', N''), (N'43', N'1262665456471920640', N'', N''), (N'44', N'1262665628165754880', N'', N''), (N'45', N'1262666172682883072', N'', N''), (N'47', N'1262723402331885568', N'', N''), (N'48', N'1262935771746734080', N'', N''), (N'49', N'1262935906522304512', N'', N''), (N'52', N'1263074419073593344', N'', N''), (N'53', N'1263075249394790400', N'', N''), (N'54', N'1263075593499684864', N'', N''), (N'56', N'1263101898440146944', N'', N''), (N'57', N'1263303878648569856', N'', N''), (N'58', N'1263304204797648896', N'', N''), (N'59', N'1263304872891555840', N'', N''), (N'60', N'1263305106250047488', N'', N''), (N'61', N'1263305244594970624', N'', N''), (N'62', N'1263305430536855552', N'', N''), (N'63', N'1263639172959174656', N'', N''), (N'64', N'1264799968944640000', N'', N''), (N'65', N'1264800070161584128', N'', N''), (N'66', N'1267360794414161920', N'', N''), (N'67', N'1267383367629807616', N'', N''), (N'68', N'1267817055527632896', N'', N''), (N'69', N'1267817221286526976', N'', N''), (N'70', N'1268893687085518848', N'', N''), (N'94', N'1288657613998579712', N'', N''), (N'95', N'1288657941770854400', N'', N''), (N'96', N'1288658134067109888', N'', N''), (N'97', N'1288658305156964352', N'', N''), (N'98', N'1288658491216289792', N'', N''), (N'99', N'1288658638302142464', N'', N''), (N'100', N'1288658791784308736', N'', N''), (N'101', N'1290849478956199936', N'', N''), (N'102', N'1290849628051124224', N'', N''), (N'103', N'1290849798553776128', N'', N''), (N'105', N'1291259822512693248', N'', N''), (N'106', N'1292620505149145088', N'', N''), (N'107', N'1292620665505775616', N'', N''), (N'108', N'1292620843398791168', N'', N''), (N'109', N'1292621027574874112', N'', N''), (N'110', N'1292621363161137152', N'', N''), (N'111', N'1292621494837116928', N'', N''), (N'112', N'1292621629260365824', N'', N''), (N'113', N'1292622526073864192', N'', N''), (N'114', N'1293470838745821184', N'', N''), (N'115', N'1293471661785706496', N'', N''), (N'116', N'1293472678392721408', N'', N''), (N'117', N'1293472857510473728', N'', N''), (N'118', N'1299273336009359360', N'127.0.0.1', N''), (N'119', N'1299273436282585088', N'127.0.0.1', N''), (N'120', N'1299273618470567936', N'127.0.0.1', N''), (N'121', N'1299273770182737920', N'127.0.0.1', N''), (N'122', N'1299273978023084032', N'127.0.0.1', N''), (N'123', N'1299274123225694208', N'127.0.0.1', N''), (N'124', N'1299274222299348992', N'127.0.0.1', N''), (N'125', N'1304238876758495232', N'', N''), (N'126', N'1304678610343383040', N'', N''), (N'127', N'1304679169305694208', N'', N''), (N'128', N'1310460417141817344', N'', N''), (N'129', N'1310502391475519488', N'', N''), (N'130', N'1310515546943569920', N'', N''), (N'131', N'1310515735292985344', N'', N''), (N'132', N'1316628769783480320', N'', N''), (N'133', N'1316628940663619584', N'', N''), (N'134', N'1316629112428756992', N'', N''), (N'135', N'1316652047017246720', N'', N''), (N'136', N'1316913899996737536', N'', N''), (N'137', N'1319200951383199744', N'', N''), (N'138', N'1319221929807024128', N'', N''), (N'139', N'1319554431134306304', N'', N''), (N'140', N'1319554550458060800', N'', N''), (N'141', N'1319554948434595840', N'', N''), (N'142', N'1319555067183730688', N'', N''), (N'143', N'1319555230765780992', N'', N''), (N'144', N'1319555333790470144', N'', N'') +INSERT INTO [apigateway].[appapigatewaysecurityoptions] VALUES (N'3', N'1261299170387169280', N'', N''), (N'4', N'1261585859064872960', N'', N''), (N'5', N'1261586605810368512', N'', N''), (N'6', N'1261587558609436672', N'', N''), (N'7', N'1261588213298348032', N'', N''), (N'8', N'1261588367619375104', N'', N''), (N'9', N'1261588628450557952', N'', N''), (N'10', N'1261588881564221440', N'', N''), (N'11', N'1261588983053795328', N'', N''), (N'12', N'1261589139039961088', N'', N''), (N'13', N'1261589197483393024', N'', N''), (N'14', N'1261589278857084928', N'', N''), (N'15', N'1261589420356124672', N'', N''), (N'16', N'1261589960393736192', N'', N''), (N'17', N'1261606600242085888', N'', N''), (N'18', N'1261606689601732608', N'', N''), (N'21', N'1262220447629058048', N'', N''), (N'22', N'1262230734939758592', N'', N''), (N'23', N'1262296916350869504', N'', N''), (N'24', N'1262632376348594176', N'', N''), (N'25', N'1262632791869902848', N'', N''), (N'28', N'1262660336921235456', N'', N''), (N'29', N'1262660528277966848', N'', N''), (N'30', N'1262660706875625472', N'', N''), (N'31', N'1262660966393991168', N'', N''), (N'32', N'1262661109474283520', N'', N''), (N'33', N'1262663888804663296', N'', N''), (N'34', N'1262664024096133120', N'', N''), (N'35', N'1262664186252120064', N'', N''), (N'36', N'1262664357044178944', N'', N''), (N'37', N'1262664632928718848', N'', N''), (N'38', N'1262664751409418240', N'', N''), (N'39', N'1262664871274237952', N'', N''), (N'40', N'1262665026111164416', N'', N''), (N'41', N'1262665159905267712', N'', N''), (N'42', N'1262665329829105664', N'', N''), (N'43', N'1262665456471920640', N'', N''), (N'44', N'1262665628165754880', N'', N''), (N'45', N'1262666172682883072', N'', N''), (N'47', N'1262723402331885568', N'', N''), (N'48', N'1262935771746734080', N'', N''), (N'49', N'1262935906522304512', N'', N''), (N'52', N'1263074419073593344', N'', N''), (N'53', N'1263075249394790400', N'', N''), (N'54', N'1263075593499684864', N'', N''), (N'56', N'1263101898440146944', N'', N''), (N'57', N'1263303878648569856', N'', N''), (N'58', N'1263304204797648896', N'', N''), (N'59', N'1263304872891555840', N'', N''), (N'60', N'1263305106250047488', N'', N''), (N'61', N'1263305244594970624', N'', N''), (N'62', N'1263305430536855552', N'', N''), (N'63', N'1263639172959174656', N'', N''), (N'64', N'1264799968944640000', N'', N''), (N'65', N'1264800070161584128', N'', N''), (N'66', N'1267360794414161920', N'', N''), (N'67', N'1267383367629807616', N'', N''), (N'68', N'1267817055527632896', N'', N''), (N'69', N'1267817221286526976', N'', N''), (N'70', N'1268893687085518848', N'', N''), (N'94', N'1288657613998579712', N'', N''), (N'95', N'1288657941770854400', N'', N''), (N'96', N'1288658134067109888', N'', N''), (N'97', N'1288658305156964352', N'', N''), (N'98', N'1288658491216289792', N'', N''), (N'99', N'1288658638302142464', N'', N''), (N'100', N'1288658791784308736', N'', N''), (N'101', N'1290849478956199936', N'', N''), (N'102', N'1290849628051124224', N'', N''), (N'103', N'1290849798553776128', N'', N''), (N'105', N'1291259822512693248', N'', N''), (N'106', N'1292620505149145088', N'', N''), (N'107', N'1292620665505775616', N'', N''), (N'108', N'1292620843398791168', N'', N''), (N'109', N'1292621027574874112', N'', N''), (N'110', N'1292621363161137152', N'', N''), (N'111', N'1292621494837116928', N'', N''), (N'112', N'1292621629260365824', N'', N''), (N'113', N'1292622526073864192', N'', N''), (N'114', N'1293470838745821184', N'', N''), (N'115', N'1293471661785706496', N'', N''), (N'116', N'1293472678392721408', N'', N''), (N'117', N'1293472857510473728', N'', N''), (N'118', N'1299273336009359360', N'127.0.0.1', N''), (N'119', N'1299273436282585088', N'127.0.0.1', N''), (N'120', N'1299273618470567936', N'127.0.0.1', N''), (N'121', N'1299273770182737920', N'127.0.0.1', N''), (N'122', N'1299273978023084032', N'127.0.0.1', N''), (N'123', N'1299274123225694208', N'127.0.0.1', N''), (N'124', N'1299274222299348992', N'127.0.0.1', N''), (N'125', N'1304238876758495232', N'', N''), (N'126', N'1304678610343383040', N'', N''), (N'127', N'1304679169305694208', N'', N''), (N'128', N'1310460417141817344', N'', N''), (N'129', N'1310502391475519488', N'', N''), (N'130', N'1310515546943569920', N'', N''), (N'131', N'1310515735292985344', N'', N''), (N'132', N'1316628769783480320', N'', N''), (N'133', N'1316628940663619584', N'', N''), (N'134', N'1316629112428756992', N'', N''), (N'135', N'1316652047017246720', N'', N''), (N'136', N'1316913899996737536', N'', N''), (N'137', N'1319200951383199744', N'', N''), (N'138', N'1319221929807024128', N'', N''), (N'139', N'1319554431134306304', N'', N''), (N'140', N'1319554550458060800', N'', N''), (N'141', N'1319554948434595840', N'', N''), (N'142', N'1319555067183730688', N'', N''), (N'143', N'1319555230765780992', N'', N''), (N'144', N'1319555333790470144', N'', N''), (N'145', N'1321001932510203904', N'', N''), (N'146', N'1321002059803136000', N'', N''), (N'147', N'1321002256440496128', N'', N''), (N'148', N'1321002350686507008', N'', N''), (N'149', N'1322190027988525056', N'', N'') GO COMMIT @@ -589,7 +589,7 @@ GO BEGIN TRANSACTION GO -INSERT INTO [apigateway].[cap.published] VALUES (N'1319249373444280320', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319249373444280320","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/22 20:08:55 +08:00","cap-corr-id":"1319249373444280320","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-22T20:08:55.7543668+08:00","AppId":"TEST-APP","Method":"Modify","Object":"ReRoute"}}', N'0', N'2020-10-22 20:08:56', N'2020-10-23 20:08:56', N'Succeeded'), (N'1319249405602009088', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319249405602009088","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/22 20:09:03 +08:00","cap-corr-id":"1319249405602009088","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-22T20:09:03.4203308+08:00","AppId":"TEST-APP","Method":"Modify","Object":"ReRoute"}}', N'0', N'2020-10-22 20:09:03', N'2020-10-23 20:09:03', N'Succeeded'), (N'1319249482190000128', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319249482190000128","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/22 20:09:21 +08:00","cap-corr-id":"1319249482190000128","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-22T20:09:21.681402+08:00","AppId":"TEST-APP","Method":"Modify","Object":"ReRoute"}}', N'0', N'2020-10-22 20:09:22', N'2020-10-23 20:09:22', N'Succeeded'), (N'1319249848986079232', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319249848986079232","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/22 20:10:49 +08:00","cap-corr-id":"1319249848986079232","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-22T20:10:49.1328929+08:00","AppId":"TEST-APP","Method":"Create","Object":"AggregateRoute"}}', N'0', N'2020-10-22 20:10:49', N'2020-10-23 20:10:49', N'Succeeded'), (N'1319250220064542720', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319250220064542720","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/22 20:12:17 +08:00","cap-corr-id":"1319250220064542720","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-22T20:12:17.6028009+08:00","AppId":"TEST-APP","Method":"Update","Object":"AggregateRoute"}}', N'0', N'2020-10-22 20:12:18', N'2020-10-23 20:12:18', N'Succeeded'), (N'1319253036082499584', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319253036082499584","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/22 20:23:28 +08:00","cap-corr-id":"1319253036082499584","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-22T20:23:28.995489+08:00","AppId":"TEST-APP","Method":"AddRouteConfig","Object":"AggregateRoute"}}', N'0', N'2020-10-22 20:23:29', N'2020-10-23 20:23:29', N'Succeeded'), (N'1319269094700978176', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319269094700978176","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/22 21:27:17 +08:00","cap-corr-id":"1319269094700978176","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-22T21:27:17.6683764+08:00","AppId":"TEST-APP","Method":"Delete","Object":"AggregateRoute"}}', N'0', N'2020-10-22 21:27:18', N'2020-10-23 21:27:18', N'Succeeded'), (N'1319269302629404672', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319269302629404672","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/22 21:28:07 +08:00","cap-corr-id":"1319269302629404672","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-22T21:28:07.2407943+08:00","AppId":"TEST-APP","Method":"Delete","Object":"AggregateRoute"}}', N'0', N'2020-10-22 21:28:07', N'2020-10-23 21:28:07', N'Succeeded'), (N'1319269513921662976', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319269513921662976","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/22 21:28:57 +08:00","cap-corr-id":"1319269513921662976","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-22T21:28:57.6185875+08:00","AppId":"TEST-APP","Method":"Delete","Object":"AggregateRoute"}}', N'0', N'2020-10-22 21:28:58', N'2020-10-23 21:28:58', N'Succeeded'), (N'1319554100082085888', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319554100082085888","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/23 16:19:48 +08:00","cap-corr-id":"1319554100082085888","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-23T16:19:48.2464771+08:00","AppId":"TEST-APP","Method":"Modify","Object":"ReRoute"}}', N'0', N'2020-10-23 16:19:48', N'2020-10-24 16:19:48', N'Succeeded'), (N'1319554182298832896', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319554182298832896","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/23 16:20:07 +08:00","cap-corr-id":"1319554182298832896","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-23T16:20:07.8366727+08:00","AppId":"TEST-APP","Method":"Modify","Object":"ReRoute"}}', N'0', N'2020-10-23 16:20:08', N'2020-10-24 16:20:08', N'Succeeded'), (N'1319554431205609472', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319554431205609472","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/23 16:21:07 +08:00","cap-corr-id":"1319554431205609472","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-23T16:21:07.192283+08:00","AppId":"TEST-APP","Method":"Create","Object":"ReRoute"}}', N'0', N'2020-10-23 16:21:07', N'2020-10-24 16:21:07', N'Succeeded'), (N'1319554550520975360', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319554550520975360","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/23 16:21:35 +08:00","cap-corr-id":"1319554550520975360","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-23T16:21:35.6396895+08:00","AppId":"TEST-APP","Method":"Create","Object":"ReRoute"}}', N'0', N'2020-10-23 16:21:36', N'2020-10-24 16:21:36', N'Succeeded'), (N'1319554948505899008', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319554948505899008","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/23 16:23:10 +08:00","cap-corr-id":"1319554948505899008","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-23T16:23:10.5258597+08:00","AppId":"TEST-APP","Method":"Create","Object":"ReRoute"}}', N'0', N'2020-10-23 16:23:11', N'2020-10-24 16:23:11', N'Succeeded'), (N'1319555067250839552', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319555067250839552","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/23 16:23:38 +08:00","cap-corr-id":"1319555067250839552","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-23T16:23:38.8355819+08:00","AppId":"TEST-APP","Method":"Create","Object":"ReRoute"}}', N'0', N'2020-10-23 16:23:39', N'2020-10-24 16:23:39', N'Succeeded'), (N'1319555230837084160', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319555230837084160","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/23 16:24:17 +08:00","cap-corr-id":"1319555230837084160","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-23T16:24:17.8394311+08:00","AppId":"TEST-APP","Method":"Create","Object":"ReRoute"}}', N'0', N'2020-10-23 16:24:18', N'2020-10-24 16:24:18', N'Succeeded'), (N'1319555333865967616', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319555333865967616","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/23 16:24:42 +08:00","cap-corr-id":"1319555333865967616","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-23T16:24:42.403288+08:00","AppId":"TEST-APP","Method":"Create","Object":"ReRoute"}}', N'0', N'2020-10-23 16:24:42', N'2020-10-24 16:24:42', N'Succeeded'), (N'1319567388383744000', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319567388383744000","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/23 17:12:36 +08:00","cap-corr-id":"1319567388383744000","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-23T17:12:36.4191302+08:00","AppId":"TEST-APP","Method":"Modify","Object":"ReRoute"}}', N'0', N'2020-10-23 17:12:36', N'2020-10-24 17:12:36', N'Succeeded'), (N'1319567469363171328', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1319567469363171328","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/23 17:12:55 +08:00","cap-corr-id":"1319567469363171328","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-23T17:12:55.7317902+08:00","AppId":"TEST-APP","Method":"Modify","Object":"ReRoute"}}', N'0', N'2020-10-23 17:12:56', N'2020-10-24 17:12:56', N'Succeeded') +INSERT INTO [apigateway].[cap.published] VALUES (N'1322190029573971968', N'v1', N'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', N'{"Headers":{"cap-callback-name":null,"cap-msg-id":"1322190029573971968","cap-msg-name":"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData","cap-msg-type":"Object","cap-senttime":"2020/10/30 22:54:02 +08:00","cap-corr-id":"1322190029573971968","cap-corr-seq":"0"},"Value":{"DateTime":"2020-10-30T22:54:02.8070185+08:00","AppId":"TEST-APP","Method":"Create","Object":"ReRoute"}}', N'0', N'2020-10-30 22:54:03', N'2020-10-31 22:54:03', N'Succeeded') GO COMMIT diff --git a/aspnet-core/database/ApiGateway-Init.sql b/aspnet-core/database/ApiGateway-Init.sql index 8cec26d70..2c56ac290 100644 --- a/aspnet-core/database/ApiGateway-Init.sql +++ b/aspnet-core/database/ApiGateway-Init.sql @@ -11,7 +11,7 @@ Target Server Version : 80020 File Encoding : 65001 - Date: 23/10/2020 19:13:56 + Date: 31/10/2020 11:28:59 */ SET NAMES utf8mb4; @@ -54,7 +54,7 @@ CREATE TABLE `appapigatewayaggregate` ( `Priority` int(0) NULL DEFAULT NULL, `UpstreamHttpMethod` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, PRIMARY KEY (`Id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewayaggregate @@ -76,7 +76,7 @@ CREATE TABLE `appapigatewayaggregateconfig` ( PRIMARY KEY (`Id`) USING BTREE, INDEX `IX_AppApiGatewayAggregateConfig_AggregateReRouteId`(`AggregateReRouteId`) USING BTREE, CONSTRAINT `FK_AppApiGatewayAggregateConfig_AppApiGatewayAggregate_Aggregat~` FOREIGN KEY (`AggregateReRouteId`) REFERENCES `appapigatewayaggregate` (`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for appapigatewayauthoptions @@ -90,7 +90,7 @@ CREATE TABLE `appapigatewayauthoptions` ( PRIMARY KEY (`Id`) USING BTREE, UNIQUE INDEX `IX_AppApiGatewayAuthOptions_ReRouteId`(`ReRouteId`) USING BTREE, CONSTRAINT `FK_AppApiGatewayAuthOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 145 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 149 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewayauthoptions @@ -205,6 +205,11 @@ INSERT INTO `appapigatewayauthoptions` VALUES (141, 1319554948434595840, '', '') INSERT INTO `appapigatewayauthoptions` VALUES (142, 1319555067183730688, '', ''); INSERT INTO `appapigatewayauthoptions` VALUES (143, 1319555230765780992, '', ''); INSERT INTO `appapigatewayauthoptions` VALUES (144, 1319555333790470144, '', ''); +INSERT INTO `appapigatewayauthoptions` VALUES (145, 1321001932510203904, '', ''); +INSERT INTO `appapigatewayauthoptions` VALUES (146, 1321002059803136000, '', ''); +INSERT INTO `appapigatewayauthoptions` VALUES (147, 1321002256440496128, '', ''); +INSERT INTO `appapigatewayauthoptions` VALUES (148, 1321002350686507008, '', ''); +INSERT INTO `appapigatewayauthoptions` VALUES (149, 1322190027988525056, '', ''); -- ---------------------------- -- Table structure for appapigatewaybalanceroptions @@ -222,7 +227,7 @@ CREATE TABLE `appapigatewaybalanceroptions` ( UNIQUE INDEX `IX_AppApiGatewayBalancerOptions_ReRouteId`(`ReRouteId`) USING BTREE, CONSTRAINT `FK_AppApiGatewayBalancerOptions_AppApiGatewayGlobalConfiguratio~` FOREIGN KEY (`ItemId`) REFERENCES `appapigatewayglobalconfiguration` (`ItemId`) ON DELETE CASCADE ON UPDATE RESTRICT, CONSTRAINT `FK_AppApiGatewayBalancerOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 148 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 152 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewaybalanceroptions @@ -338,6 +343,11 @@ INSERT INTO `appapigatewaybalanceroptions` VALUES (144, NULL, 131955494843459584 INSERT INTO `appapigatewaybalanceroptions` VALUES (145, NULL, 1319555067183730688, '', '', 0); INSERT INTO `appapigatewaybalanceroptions` VALUES (146, NULL, 1319555230765780992, '', '', 0); INSERT INTO `appapigatewaybalanceroptions` VALUES (147, NULL, 1319555333790470144, '', '', 0); +INSERT INTO `appapigatewaybalanceroptions` VALUES (148, NULL, 1321001932510203904, '', '', 0); +INSERT INTO `appapigatewaybalanceroptions` VALUES (149, NULL, 1321002059803136000, '', '', 0); +INSERT INTO `appapigatewaybalanceroptions` VALUES (150, NULL, 1321002256440496128, '', '', 0); +INSERT INTO `appapigatewaybalanceroptions` VALUES (151, NULL, 1321002350686507008, '', '', 0); +INSERT INTO `appapigatewaybalanceroptions` VALUES (152, NULL, 1322190027988525056, '', '', 0); -- ---------------------------- -- Table structure for appapigatewaycacheoptions @@ -351,7 +361,7 @@ CREATE TABLE `appapigatewaycacheoptions` ( PRIMARY KEY (`Id`) USING BTREE, UNIQUE INDEX `IX_AppApiGatewayCacheOptions_ReRouteId`(`ReRouteId`) USING BTREE, CONSTRAINT `FK_AppApiGatewayCacheOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 145 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 149 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewaycacheoptions @@ -466,6 +476,11 @@ INSERT INTO `appapigatewaycacheoptions` VALUES (141, 1319554948434595840, 0, '') INSERT INTO `appapigatewaycacheoptions` VALUES (142, 1319555067183730688, 0, ''); INSERT INTO `appapigatewaycacheoptions` VALUES (143, 1319555230765780992, 0, ''); INSERT INTO `appapigatewaycacheoptions` VALUES (144, 1319555333790470144, 0, ''); +INSERT INTO `appapigatewaycacheoptions` VALUES (145, 1321001932510203904, 0, ''); +INSERT INTO `appapigatewaycacheoptions` VALUES (146, 1321002059803136000, 0, ''); +INSERT INTO `appapigatewaycacheoptions` VALUES (147, 1321002256440496128, 0, ''); +INSERT INTO `appapigatewaycacheoptions` VALUES (148, 1321002350686507008, 0, ''); +INSERT INTO `appapigatewaycacheoptions` VALUES (149, 1322190027988525056, 0, ''); -- ---------------------------- -- Table structure for appapigatewaydiscovery @@ -485,7 +500,7 @@ CREATE TABLE `appapigatewaydiscovery` ( PRIMARY KEY (`Id`) USING BTREE, UNIQUE INDEX `IX_AppApiGatewayDiscovery_ItemId`(`ItemId`) USING BTREE, CONSTRAINT `FK_AppApiGatewayDiscovery_AppApiGatewayGlobalConfiguration_Item~` FOREIGN KEY (`ItemId`) REFERENCES `appapigatewayglobalconfiguration` (`ItemId`) ON DELETE CASCADE ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewaydiscovery @@ -506,7 +521,7 @@ CREATE TABLE `appapigatewaydynamicreroute` ( `AppId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, PRIMARY KEY (`Id`) USING BTREE, UNIQUE INDEX `AK_AppApiGatewayDynamicReRoute_DynamicReRouteId`(`DynamicReRouteId`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for appapigatewayglobalconfiguration @@ -526,7 +541,7 @@ CREATE TABLE `appapigatewayglobalconfiguration` ( `AppId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, PRIMARY KEY (`Id`) USING BTREE, UNIQUE INDEX `AK_AppApiGatewayGlobalConfiguration_ItemId`(`ItemId`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewayglobalconfiguration @@ -543,7 +558,7 @@ CREATE TABLE `appapigatewayheaders` ( `Key` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `Value` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, PRIMARY KEY (`Id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for appapigatewayhostandport @@ -555,7 +570,7 @@ CREATE TABLE `appapigatewayhostandport` ( `Host` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `Port` int(0) NULL DEFAULT 0, PRIMARY KEY (`Id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for appapigatewayhttpoptions @@ -575,7 +590,7 @@ CREATE TABLE `appapigatewayhttpoptions` ( UNIQUE INDEX `IX_AppApiGatewayHttpOptions_ReRouteId`(`ReRouteId`) USING BTREE, CONSTRAINT `FK_AppApiGatewayHttpOptions_AppApiGatewayGlobalConfiguration_It~` FOREIGN KEY (`ItemId`) REFERENCES `appapigatewayglobalconfiguration` (`ItemId`) ON DELETE CASCADE ON UPDATE RESTRICT, CONSTRAINT `FK_AppApiGatewayHttpOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 148 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 152 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewayhttpoptions @@ -691,6 +706,11 @@ INSERT INTO `appapigatewayhttpoptions` VALUES (144, NULL, 1319554948434595840, 0 INSERT INTO `appapigatewayhttpoptions` VALUES (145, NULL, 1319555067183730688, 0, 0, 0, 0, 0); INSERT INTO `appapigatewayhttpoptions` VALUES (146, NULL, 1319555230765780992, 0, 0, 0, 0, 0); INSERT INTO `appapigatewayhttpoptions` VALUES (147, NULL, 1319555333790470144, 0, 0, 0, 0, 0); +INSERT INTO `appapigatewayhttpoptions` VALUES (148, NULL, 1321001932510203904, 0, 0, 0, 0, 0); +INSERT INTO `appapigatewayhttpoptions` VALUES (149, NULL, 1321002059803136000, 0, 0, 0, 0, 0); +INSERT INTO `appapigatewayhttpoptions` VALUES (150, NULL, 1321002256440496128, 0, 0, 0, 0, 0); +INSERT INTO `appapigatewayhttpoptions` VALUES (151, NULL, 1321002350686507008, 0, 0, 0, 0, 0); +INSERT INTO `appapigatewayhttpoptions` VALUES (152, NULL, 1322190027988525056, 0, 0, 0, 0, 0); -- ---------------------------- -- Table structure for appapigatewayqosoptions @@ -708,7 +728,7 @@ CREATE TABLE `appapigatewayqosoptions` ( UNIQUE INDEX `IX_AppApiGatewayQoSOptions_ReRouteId`(`ReRouteId`) USING BTREE, CONSTRAINT `FK_AppApiGatewayQoSOptions_AppApiGatewayGlobalConfiguration_Ite~` FOREIGN KEY (`ItemId`) REFERENCES `appapigatewayglobalconfiguration` (`ItemId`) ON DELETE CASCADE ON UPDATE RESTRICT, CONSTRAINT `FK_AppApiGatewayQoSOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 148 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 152 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewayqosoptions @@ -824,6 +844,11 @@ INSERT INTO `appapigatewayqosoptions` VALUES (144, NULL, 1319554948434595840, 50 INSERT INTO `appapigatewayqosoptions` VALUES (145, NULL, 1319555067183730688, 50, 60000, 30000); INSERT INTO `appapigatewayqosoptions` VALUES (146, NULL, 1319555230765780992, 50, 60000, 30000); INSERT INTO `appapigatewayqosoptions` VALUES (147, NULL, 1319555333790470144, 50, 60000, 30000); +INSERT INTO `appapigatewayqosoptions` VALUES (148, NULL, 1321001932510203904, 50, 60000, 30000); +INSERT INTO `appapigatewayqosoptions` VALUES (149, NULL, 1321002059803136000, 50, 60000, 30000); +INSERT INTO `appapigatewayqosoptions` VALUES (150, NULL, 1321002256440496128, 50, 60000, 30000); +INSERT INTO `appapigatewayqosoptions` VALUES (151, NULL, 1321002350686507008, 50, 60000, 30000); +INSERT INTO `appapigatewayqosoptions` VALUES (152, NULL, 1322190027988525056, 50, 60000, 30000); -- ---------------------------- -- Table structure for appapigatewayratelimitoptions @@ -840,7 +865,7 @@ CREATE TABLE `appapigatewayratelimitoptions` ( PRIMARY KEY (`Id`) USING BTREE, UNIQUE INDEX `IX_AppApiGatewayRateLimitOptions_ItemId`(`ItemId`) USING BTREE, CONSTRAINT `FK_AppApiGatewayRateLimitOptions_AppApiGatewayGlobalConfigurati~` FOREIGN KEY (`ItemId`) REFERENCES `appapigatewayglobalconfiguration` (`ItemId`) ON DELETE CASCADE ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewayratelimitoptions @@ -865,7 +890,7 @@ CREATE TABLE `appapigatewayratelimitrule` ( UNIQUE INDEX `IX_AppApiGatewayRateLimitRule_ReRouteId`(`ReRouteId`) USING BTREE, CONSTRAINT `FK_AppApiGatewayRateLimitRule_AppApiGatewayDynamicReRoute_Dynam~` FOREIGN KEY (`DynamicReRouteId`) REFERENCES `appapigatewaydynamicreroute` (`DynamicReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT, CONSTRAINT `FK_AppApiGatewayRateLimitRule_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 145 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 149 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewayratelimitrule @@ -980,6 +1005,11 @@ INSERT INTO `appapigatewayratelimitrule` VALUES (141, 1319554948434595840, NULL, INSERT INTO `appapigatewayratelimitrule` VALUES (142, 1319555067183730688, NULL, '', 0, NULL, NULL, NULL); INSERT INTO `appapigatewayratelimitrule` VALUES (143, 1319555230765780992, NULL, '', 0, NULL, NULL, NULL); INSERT INTO `appapigatewayratelimitrule` VALUES (144, 1319555333790470144, NULL, '', 0, NULL, NULL, NULL); +INSERT INTO `appapigatewayratelimitrule` VALUES (145, 1321001932510203904, NULL, '', 0, NULL, NULL, NULL); +INSERT INTO `appapigatewayratelimitrule` VALUES (146, 1321002059803136000, NULL, '', 0, NULL, NULL, NULL); +INSERT INTO `appapigatewayratelimitrule` VALUES (147, 1321002256440496128, NULL, '', 0, NULL, NULL, NULL); +INSERT INTO `appapigatewayratelimitrule` VALUES (148, 1321002350686507008, NULL, '', 0, NULL, NULL, NULL); +INSERT INTO `appapigatewayratelimitrule` VALUES (149, 1322190027988525056, NULL, '', 0, NULL, NULL, NULL); -- ---------------------------- -- Table structure for appapigatewayreroute @@ -1019,7 +1049,7 @@ CREATE TABLE `appapigatewayreroute` ( PRIMARY KEY (`Id`) USING BTREE, UNIQUE INDEX `AK_AppApiGatewayReRoute_ReRouteId`(`ReRouteId`) USING BTREE, UNIQUE INDEX `IX_AppApiGatewayReRoute_AppId_DownstreamPathTemplate_UpstreamPa~`(`AppId`, `DownstreamPathTemplate`, `UpstreamPathTemplate`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 152 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 156 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewayreroute @@ -1081,8 +1111,8 @@ INSERT INTO `appapigatewayreroute` VALUES (67, '{}', '755b4dce5c34444785fa3b647f INSERT INTO `appapigatewayreroute` VALUES (68, '{}', '535191c570ae453ab320012304d7a62c', 1264800070161584128, '【身份认证服务】- 手机号注册', '/api/account/phone/register', '', '', '/api/account/phone/register', 'POST,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); INSERT INTO `appapigatewayreroute` VALUES (69, '{}', '723c9b111f9f4a1aa804118cdde193d3', 1267360794414161920, '【消息服务】- 通知', '/signalr-hubs/notifications/{everything}', '', '', '/signalr-hubs/notifications/{everything}', 'POST,GET,OPTIONS,PUT,DELETE,', '', '', '', '', '', '', '', 1, '', '', 'ws', '127.0.0.1:30020,', '', '', '', 1, 30000, 1, '', 'TEST-APP'); INSERT INTO `appapigatewayreroute` VALUES (70, '{}', 'f3aa2b42dd9f468aa5aae4ef64754427', 1267383367629807616, '【消息服务】- 通知0', '/signalr-hubs/notifications', '', '', '/signalr-hubs/notifications', 'GET,POST,PUT,DELETE,OPTIONS,', '', '', '', '', '', '', '', 1, '', '', 'ws', '127.0.0.1:30020,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); -INSERT INTO `appapigatewayreroute` VALUES (71, '{}', '99dc8259c50044008c8aede7442ddde3', 1267817055527632896, '【消息服务】- 聊天', '/signalr-hubs/message', '', '', '/signalr-hubs/message', 'GET,POST,PUT,DELETE,OPTIONS,', '', '', '', '', '', '', '', 1, '', '', 'ws', '127.0.0.1:30020,', '', '', '', 1, 30000, 1, '', 'TEST-APP'); -INSERT INTO `appapigatewayreroute` VALUES (72, '{}', '4ec40b72d469474ba10ae02e8d3298bb', 1267817221286526976, '【消息服务】- 聊天1', '/signalr-hubs/message/{everything}', '', '', '/signalr-hubs/message/{everything}', 'GET,POST,PUT,DELETE,OPTIONS,', '', '', '', '', '', '', '', 1, '', '', 'ws', '127.0.0.1:30020,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); +INSERT INTO `appapigatewayreroute` VALUES (71, '{}', '0344947bb79b401baa2ef7b4e58297f6', 1267817055527632896, '【消息服务】- 聊天', '/signalr-hubs/messages', '', '', '/signalr-hubs/messages', 'GET,POST,PUT,DELETE,OPTIONS,', '', '', '', '', '', '', '', 1, '', '', 'ws', '127.0.0.1:30020,', '', '', '', 1, 30000, 1, '', 'TEST-APP'); +INSERT INTO `appapigatewayreroute` VALUES (72, '{}', '6676b5e5f76d40739f9ccc3e371e2f18', 1267817221286526976, '【消息服务】- 聊天1', '/signalr-hubs/messages/{everything}', '', '', '/signalr-hubs/messages/{everything}', 'GET,POST,PUT,DELETE,OPTIONS,', '', '', '', '', '', '', '', 1, '', '', 'ws', '127.0.0.1:30020,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); INSERT INTO `appapigatewayreroute` VALUES (73, '{}', 'cfb5f09a12bf495fbcaf2fa5d9123a40', 1268893687085518848, '【身份认证服务】- 重置密码', '/api/account/phone/reset-password', '', '', '/api/account/phone/reset-password', 'PUT,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 1, 30000, 1, '', 'TEST-APP'); INSERT INTO `appapigatewayreroute` VALUES (101, '{}', '997a4c27a433458aafed9b8aa252d957', 1288657613998579712, '【身份认证服务】- 组织机构列表', '/api/identity/organization-units', '', '', '/api/identity/organization-units', 'GET,POST,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); INSERT INTO `appapigatewayreroute` VALUES (102, '{}', 'a2c6acc9882a425ab26bd3ad5a9c17c6', 1288657941770854400, '【身份认证服务】- 组织机构管理', '/api/identity/organization-units/{id}', '', '', '/api/identity/organization-units/{id}', 'GET,PUT,DELETE,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 1, 30000, 1, '', 'TEST-APP'); @@ -1134,6 +1164,11 @@ INSERT INTO `appapigatewayreroute` VALUES (148, '{}', '824f5eee6877489f96f1022e3 INSERT INTO `appapigatewayreroute` VALUES (149, '{}', 'fe1379d4a13f41afb6410f4c948871f3', 1319555067183730688, '【身份认证服务】- 删除角色组织机构', '/api/identity/roles/{id}/organization-units/{ouId}', '', '', '/api/identity/roles/{id}/organization-units/{ouId}', 'DELETE,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); INSERT INTO `appapigatewayreroute` VALUES (150, '{}', '197a69bb723346aba3601bd61e7fa655', 1319555230765780992, '【身份认证服务】- 管理用户组织机构', '/api/identity/users/{id}/organization-units', '', '', '/api/identity/users/{id}/organization-units', 'GET,PUT,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); INSERT INTO `appapigatewayreroute` VALUES (151, '{}', '1a7e6d0b1c95484f82a75a2ce6e6f453', 1319555333790470144, '【身份认证服务】- 删除用户组织机构', '/api/identity/users/{id}/organization-units/{ouId}', '', '', '/api/identity/users/{id}/organization-units/{ouId}', 'DELETE,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); +INSERT INTO `appapigatewayreroute` VALUES (152, '{}', 'ecfa9bbd19694097b33e691b653f2124', 1321001932510203904, '【消息服务】- 我的消息', '/api/im/chat/my-messages', '', '', '/api/im/chat/my-messages', 'GET,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30020,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); +INSERT INTO `appapigatewayreroute` VALUES (153, '{}', '4867ad188ca54acb8b961d20297b6545', 1321002059803136000, '【消息服务】- 我的最近消息', '/api/im/chat/my-last-messages', '', '', '/api/im/chat/my-last-messages', 'GET,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30020,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); +INSERT INTO `appapigatewayreroute` VALUES (154, '{}', '291ab802d7bc4af98fc15c509f98fa75', 1321002256440496128, '【消息服务】- 我的朋友', '/api/im/my-friends', '', '', '/api/im/my-friends', 'GET,POST,DELETE,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30020,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); +INSERT INTO `appapigatewayreroute` VALUES (155, '{}', '08438dabb1e849988e0c304f82b08a10', 1321002350686507008, '【消息服务】- 我的所有朋友', '/api/im/my-friends/all', '', '', '/api/im/my-friends/all', 'GET,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30020,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); +INSERT INTO `appapigatewayreroute` VALUES (156, '{}', 'cecf632785b7402299764698369c751f', 1322190027988525056, '【消息服务】- 发送好友请求', '/api/im/my-friends/add-request', '', '', '/api/im/my-friends/add-request', 'POST,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30020,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); -- ---------------------------- -- Table structure for appapigatewayroutegroup @@ -1177,7 +1212,7 @@ CREATE TABLE `appapigatewaysecurityoptions` ( PRIMARY KEY (`Id`) USING BTREE, UNIQUE INDEX `IX_AppApiGatewaySecurityOptions_ReRouteId`(`ReRouteId`) USING BTREE, CONSTRAINT `FK_AppApiGatewaySecurityOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 145 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 149 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewaysecurityoptions @@ -1292,6 +1327,11 @@ INSERT INTO `appapigatewaysecurityoptions` VALUES (141, 1319554948434595840, '', INSERT INTO `appapigatewaysecurityoptions` VALUES (142, 1319555067183730688, '', ''); INSERT INTO `appapigatewaysecurityoptions` VALUES (143, 1319555230765780992, '', ''); INSERT INTO `appapigatewaysecurityoptions` VALUES (144, 1319555333790470144, '', ''); +INSERT INTO `appapigatewaysecurityoptions` VALUES (145, 1321001932510203904, '', ''); +INSERT INTO `appapigatewaysecurityoptions` VALUES (146, 1321002059803136000, '', ''); +INSERT INTO `appapigatewaysecurityoptions` VALUES (147, 1321002256440496128, '', ''); +INSERT INTO `appapigatewaysecurityoptions` VALUES (148, 1321002350686507008, '', ''); +INSERT INTO `appapigatewaysecurityoptions` VALUES (149, 1322190027988525056, '', ''); -- ---------------------------- -- Table structure for cap.published @@ -1313,25 +1353,7 @@ CREATE TABLE `cap.published` ( -- ---------------------------- -- Records of cap.published -- ---------------------------- -INSERT INTO `cap.published` VALUES (1319249373444280320, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319249373444280320\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/22 20:08:55 +08:00\",\"cap-corr-id\":\"1319249373444280320\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-22T20:08:55.7543668+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Modify\",\"Object\":\"ReRoute\"}}', 0, '2020-10-22 20:08:56', '2020-10-23 20:08:56', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319249405602009088, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319249405602009088\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/22 20:09:03 +08:00\",\"cap-corr-id\":\"1319249405602009088\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-22T20:09:03.4203308+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Modify\",\"Object\":\"ReRoute\"}}', 0, '2020-10-22 20:09:03', '2020-10-23 20:09:03', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319249482190000128, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319249482190000128\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/22 20:09:21 +08:00\",\"cap-corr-id\":\"1319249482190000128\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-22T20:09:21.681402+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Modify\",\"Object\":\"ReRoute\"}}', 0, '2020-10-22 20:09:22', '2020-10-23 20:09:22', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319249848986079232, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319249848986079232\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/22 20:10:49 +08:00\",\"cap-corr-id\":\"1319249848986079232\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-22T20:10:49.1328929+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Create\",\"Object\":\"AggregateRoute\"}}', 0, '2020-10-22 20:10:49', '2020-10-23 20:10:49', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319250220064542720, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319250220064542720\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/22 20:12:17 +08:00\",\"cap-corr-id\":\"1319250220064542720\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-22T20:12:17.6028009+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Update\",\"Object\":\"AggregateRoute\"}}', 0, '2020-10-22 20:12:18', '2020-10-23 20:12:18', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319253036082499584, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319253036082499584\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/22 20:23:28 +08:00\",\"cap-corr-id\":\"1319253036082499584\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-22T20:23:28.995489+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"AddRouteConfig\",\"Object\":\"AggregateRoute\"}}', 0, '2020-10-22 20:23:29', '2020-10-23 20:23:29', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319269094700978176, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319269094700978176\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/22 21:27:17 +08:00\",\"cap-corr-id\":\"1319269094700978176\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-22T21:27:17.6683764+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Delete\",\"Object\":\"AggregateRoute\"}}', 0, '2020-10-22 21:27:18', '2020-10-23 21:27:18', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319269302629404672, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319269302629404672\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/22 21:28:07 +08:00\",\"cap-corr-id\":\"1319269302629404672\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-22T21:28:07.2407943+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Delete\",\"Object\":\"AggregateRoute\"}}', 0, '2020-10-22 21:28:07', '2020-10-23 21:28:07', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319269513921662976, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319269513921662976\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/22 21:28:57 +08:00\",\"cap-corr-id\":\"1319269513921662976\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-22T21:28:57.6185875+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Delete\",\"Object\":\"AggregateRoute\"}}', 0, '2020-10-22 21:28:58', '2020-10-23 21:28:58', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319554100082085888, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319554100082085888\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/23 16:19:48 +08:00\",\"cap-corr-id\":\"1319554100082085888\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-23T16:19:48.2464771+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Modify\",\"Object\":\"ReRoute\"}}', 0, '2020-10-23 16:19:48', '2020-10-24 16:19:48', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319554182298832896, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319554182298832896\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/23 16:20:07 +08:00\",\"cap-corr-id\":\"1319554182298832896\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-23T16:20:07.8366727+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Modify\",\"Object\":\"ReRoute\"}}', 0, '2020-10-23 16:20:08', '2020-10-24 16:20:08', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319554431205609472, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319554431205609472\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/23 16:21:07 +08:00\",\"cap-corr-id\":\"1319554431205609472\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-23T16:21:07.192283+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Create\",\"Object\":\"ReRoute\"}}', 0, '2020-10-23 16:21:07', '2020-10-24 16:21:07', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319554550520975360, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319554550520975360\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/23 16:21:35 +08:00\",\"cap-corr-id\":\"1319554550520975360\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-23T16:21:35.6396895+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Create\",\"Object\":\"ReRoute\"}}', 0, '2020-10-23 16:21:36', '2020-10-24 16:21:36', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319554948505899008, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319554948505899008\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/23 16:23:10 +08:00\",\"cap-corr-id\":\"1319554948505899008\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-23T16:23:10.5258597+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Create\",\"Object\":\"ReRoute\"}}', 0, '2020-10-23 16:23:11', '2020-10-24 16:23:11', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319555067250839552, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319555067250839552\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/23 16:23:38 +08:00\",\"cap-corr-id\":\"1319555067250839552\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-23T16:23:38.8355819+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Create\",\"Object\":\"ReRoute\"}}', 0, '2020-10-23 16:23:39', '2020-10-24 16:23:39', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319555230837084160, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319555230837084160\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/23 16:24:17 +08:00\",\"cap-corr-id\":\"1319555230837084160\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-23T16:24:17.8394311+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Create\",\"Object\":\"ReRoute\"}}', 0, '2020-10-23 16:24:18', '2020-10-24 16:24:18', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319555333865967616, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319555333865967616\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/23 16:24:42 +08:00\",\"cap-corr-id\":\"1319555333865967616\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-23T16:24:42.403288+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Create\",\"Object\":\"ReRoute\"}}', 0, '2020-10-23 16:24:42', '2020-10-24 16:24:42', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319567388383744000, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319567388383744000\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/23 17:12:36 +08:00\",\"cap-corr-id\":\"1319567388383744000\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-23T17:12:36.4191302+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Modify\",\"Object\":\"ReRoute\"}}', 0, '2020-10-23 17:12:36', '2020-10-24 17:12:36', 'Succeeded'); -INSERT INTO `cap.published` VALUES (1319567469363171328, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1319567469363171328\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/23 17:12:55 +08:00\",\"cap-corr-id\":\"1319567469363171328\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-23T17:12:55.7317902+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Modify\",\"Object\":\"ReRoute\"}}', 0, '2020-10-23 17:12:56', '2020-10-24 17:12:56', 'Succeeded'); +INSERT INTO `cap.published` VALUES (1322190029573971968, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1322190029573971968\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/30 22:54:02 +08:00\",\"cap-corr-id\":\"1322190029573971968\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-30T22:54:02.8070185+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Create\",\"Object\":\"ReRoute\"}}', 0, '2020-10-30 22:54:03', '2020-10-31 22:54:03', 'Succeeded'); -- ---------------------------- -- Table structure for cap.received diff --git a/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json/LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json.csproj b/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json/LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json.csproj new file mode 100644 index 000000000..c076ced26 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json/LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json.csproj @@ -0,0 +1,15 @@ + + + + + + netcoreapp3.1 + + + + + + + + + diff --git a/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json/LINGYUN/Abp/AspNetCore/SignalR/Protocol/Json/AbpAspNetCoreSignalRProtocolJsonModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json/LINGYUN/Abp/AspNetCore/SignalR/Protocol/Json/AbpAspNetCoreSignalRProtocolJsonModule.cs new file mode 100644 index 000000000..8fe7468cb --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json/LINGYUN/Abp/AspNetCore/SignalR/Protocol/Json/AbpAspNetCoreSignalRProtocolJsonModule.cs @@ -0,0 +1,22 @@ +using Microsoft.AspNetCore.SignalR; +using Microsoft.AspNetCore.SignalR.Protocol; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Volo.Abp.AspNetCore.SignalR; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json +{ + [DependsOn( + typeof(AbpAspNetCoreSignalRModule))] + public class AbpAspNetCoreSignalRProtocolJsonModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + var newtonsoftJsonOptions = new NewtonsoftJsonHubProtocolOptions(); + context.Services.ExecutePreConfiguredActions(newtonsoftJsonOptions); + + context.Services.TryAddEnumerable(ServiceDescriptor.Singleton()); + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN.Abp.ExceptionHandling.Notifications.csproj b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN.Abp.ExceptionHandling.Notifications.csproj index 022a6eeb1..199296896 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN.Abp.ExceptionHandling.Notifications.csproj +++ b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN.Abp.ExceptionHandling.Notifications.csproj @@ -7,6 +7,21 @@ + + + + + + + + + + + + + + + diff --git a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpExceptionHandlingNotificationDefinitionProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpExceptionHandlingNotificationDefinitionProvider.cs index 2e1904193..cbddc8a83 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpExceptionHandlingNotificationDefinitionProvider.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpExceptionHandlingNotificationDefinitionProvider.cs @@ -1,4 +1,6 @@ -using LINGYUN.Abp.Notifications; +using LINGYUN.Abp.ExceptionHandling.Localization; +using LINGYUN.Abp.Notifications; +using Volo.Abp.Localization; namespace LINGYUN.Abp.ExceptionHandling.Notifications { @@ -6,7 +8,23 @@ namespace LINGYUN.Abp.ExceptionHandling.Notifications { public override void Define(INotificationDefinitionContext context) { - context.Add(new NotificationDefinition(AbpExceptionHandlingNotificationNames.NotificationName)); + var exceptionGroup = context.AddGroup( + AbpExceptionHandlingNotificationNames.GroupName, + L("Notifications:Exception"), + false); + + exceptionGroup.AddNotification( + name: AbpExceptionHandlingNotificationNames.NotificationName, + displayName: L("Notifications:ExceptionNotifier"), + description: L("Notifications:ExceptionNotifier"), + notificationType: NotificationType.System, + lifetime: NotificationLifetime.Persistent, + allowSubscriptionToClients: false); + } + + protected LocalizableString L(string name) + { + return LocalizableString.Create(name); } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpExceptionHandlingNotificationNames.cs b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpExceptionHandlingNotificationNames.cs index 4299d63c9..9c8b2caa2 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpExceptionHandlingNotificationNames.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpExceptionHandlingNotificationNames.cs @@ -2,6 +2,7 @@ { public class AbpExceptionHandlingNotificationNames { - public const string NotificationName = "Abp.ExceptionHandling.Notifier"; + public const string GroupName = "LINGYUN.Abp.ExceptionHandling"; + public const string NotificationName = GroupName + ".Notifier"; } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpNotificationsExceptionHandlingModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpNotificationsExceptionHandlingModule.cs index d48d84368..1f9d501f9 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpNotificationsExceptionHandlingModule.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpNotificationsExceptionHandlingModule.cs @@ -1,5 +1,8 @@ -using LINGYUN.Abp.Notifications; +using LINGYUN.Abp.ExceptionHandling.Localization; +using LINGYUN.Abp.Notifications; +using Volo.Abp.Localization; using Volo.Abp.Modularity; +using Volo.Abp.VirtualFileSystem; namespace LINGYUN.Abp.ExceptionHandling.Notifications { @@ -8,5 +11,19 @@ namespace LINGYUN.Abp.ExceptionHandling.Notifications typeof(AbpNotificationModule))] public class AbpNotificationsExceptionHandlingModule : AbpModule { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Get() + .AddVirtualJson("/LINGYUN/Abp/ExceptionHandling/Notifications/Localization/Resources"); + }); + } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpNotificationsExceptionSubscriber.cs b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpNotificationsExceptionSubscriber.cs index 26c2a5c2a..d7b30abf9 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpNotificationsExceptionSubscriber.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpNotificationsExceptionSubscriber.cs @@ -21,26 +21,23 @@ namespace LINGYUN.Abp.ExceptionHandling.Notifications protected override async Task SendErrorNotifierAsync(ExceptionSendNotifierContext context) { - var notificationDispatcher = context.ServiceProvider.GetRequiredService(); - var notificationName = NotificationNameNormalizer - .NormalizerName(AbpExceptionHandlingNotificationNames.NotificationName); - NotificationData notificationData; - if (CurrentTenant.IsAvailable) - { - notificationData = NotificationData.CreateTenantNotificationData(CurrentTenant.Id.Value); - } - else - { - notificationData = NotificationData.CreateNotificationData(); - } + var notificationSender = context.ServiceProvider.GetRequiredService(); + + NotificationData notificationData = new NotificationData(); // 写入通知数据 //TODO:集成TextTemplate完成格式化的推送 notificationData.WriteStandardData( - context.Exception.GetType().FullName, context.Exception.Message, - DateTime.Now, "System"); + context.Exception.GetType().FullName, + context.Exception.Message, + DateTime.Now, + "System"); - await notificationDispatcher.DispatchAsync(notificationName, notificationData, - CurrentTenant.Id, NotificationSeverity.Error); + await notificationSender.SendNofiterAsync( + AbpExceptionHandlingNotificationNames.NotificationName, + notificationData, + null, + CurrentTenant.Id, + NotificationSeverity.Error); } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/Localization/Resources/en.json b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/Localization/Resources/en.json new file mode 100644 index 000000000..16edd1673 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/Localization/Resources/en.json @@ -0,0 +1,7 @@ +{ + "culture": "en", + "texts": { + "Notifications:Exception": "Exception", + "Notifications:ExceptionNotifier": "Exception Notifier" + } +} \ No newline at end of file diff --git a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/Localization/Resources/zh-Hans.json b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/Localization/Resources/zh-Hans.json new file mode 100644 index 000000000..9649f9c04 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/Localization/Resources/zh-Hans.json @@ -0,0 +1,7 @@ +{ + "culture": "zh-Hans", + "texts": { + "Notifications:Exception": "异常通知", + "Notifications:ExceptionNotifier": "异常推送" + } +} \ No newline at end of file diff --git a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling/LINGYUN.Abp.ExceptionHandling.csproj b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling/LINGYUN.Abp.ExceptionHandling.csproj index c630ff1f8..161c30c4d 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling/LINGYUN.Abp.ExceptionHandling.csproj +++ b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling/LINGYUN.Abp.ExceptionHandling.csproj @@ -8,7 +8,7 @@ - + diff --git a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling/LINGYUN/Abp/ExceptionHandling/AbpExceptionHandlingModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling/LINGYUN/Abp/ExceptionHandling/AbpExceptionHandlingModule.cs index acd417376..17823f27a 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling/LINGYUN/Abp/ExceptionHandling/AbpExceptionHandlingModule.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling/LINGYUN/Abp/ExceptionHandling/AbpExceptionHandlingModule.cs @@ -1,8 +1,18 @@ -using Volo.Abp.Modularity; +using LINGYUN.Abp.ExceptionHandling.Localization; +using Volo.Abp.Localization; +using Volo.Abp.Modularity; namespace LINGYUN.Abp.ExceptionHandling { + [DependsOn(typeof(AbpLocalizationModule))] public class AbpExceptionHandlingModule : AbpModule { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.Resources.Add("en"); + }); + } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling/LINGYUN/Abp/ExceptionHandling/Localization/ExceptionHandlingResource.cs b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling/LINGYUN/Abp/ExceptionHandling/Localization/ExceptionHandlingResource.cs new file mode 100644 index 000000000..4eba5b5fa --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling/LINGYUN/Abp/ExceptionHandling/Localization/ExceptionHandlingResource.cs @@ -0,0 +1,9 @@ +using Volo.Abp.Localization; + +namespace LINGYUN.Abp.ExceptionHandling.Localization +{ + [LocalizationResourceName("AbpExceptionHandling")] + public class ExceptionHandlingResource + { + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/AbpIMSignalRModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/AbpIMSignalRModule.cs index 4eaf55790..b994e8239 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/AbpIMSignalRModule.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/AbpIMSignalRModule.cs @@ -1,18 +1,23 @@ using LINGYUN.Abp.AspNetCore.SignalR.JwtToken; +using LINGYUN.Abp.IM.SignalR.Messages; using LINGYUN.Abp.RealTime.SignalR; -using Volo.Abp.AspNetCore.SignalR; using Volo.Abp.Modularity; namespace LINGYUN.Abp.IM.SignalR { [DependsOn( + typeof(AbpIMModule), typeof(AbpRealTimeSignalRModule), - typeof(AbpAspNetCoreSignalRModule), typeof(AbpAspNetCoreSignalRJwtTokenModule))] public class AbpIMSignalRModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { + Configure(options => + { + options.Providers.Add(); + }); + Configure(options => { options.MapPath("messages"); 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 014a9032e..8dbedb09c 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 @@ -10,7 +10,6 @@ using System; using System.Collections.Immutable; using System.Linq; using System.Threading.Tasks; -using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Users; @@ -35,6 +34,7 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs protected override async Task OnClientConnectedAsync(IOnlineClient client) { + await base.OnClientConnectedAsync(client); // 加入通讯组 var userGroups = await UserGroupStore.GetUserGroupsAsync(client.TenantId, client.UserId.Value); foreach (var group in userGroups) @@ -61,33 +61,35 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs } } - protected override async Task OnClientDisconnectedAsync(IOnlineClient client) - { - // 从通讯组断开会话 - var userGroups = await UserGroupStore.GetUserGroupsAsync(client.TenantId, client.UserId.Value); - foreach (var group in userGroups) - { - await Groups.RemoveFromGroupAsync(client.ConnectionId, group.Name); - var groupClient = Clients.Group(group.Name); - if (groupClient != null) - { - // 发送用户下线指令 - await groupClient.SendAsync("onUserOfflined", client.TenantId, client.UserId.Value); - } - } - - // 发送好友下线通知 - var userFriends = await FriendStore.GetListAsync(client.TenantId, client.UserId.Value); - if (userFriends.Count > 0) - { - var friendClientIds = userFriends.Select(friend => friend.FriendId.ToString()).ToImmutableArray(); - var userClients = Clients.Users(friendClientIds); - if (userClients != null) - { - await userClients.SendAsync("onUserOfflined", client.TenantId, client.UserId.Value); - } - } - } + //protected override async Task OnClientDisconnectedAsync(IOnlineClient client) + //{ + // // 从通讯组断开会话 + // var userGroups = await UserGroupStore.GetUserGroupsAsync(client.TenantId, client.UserId.Value, Context.ConnectionAborted); + // foreach (var group in userGroups) + // { + // await Groups.RemoveFromGroupAsync(client.ConnectionId, group.Name, Context.ConnectionAborted); + // var groupClient = Clients.Group(group.Name); + // if (groupClient != null) + // { + // // 发送用户下线指令 + // await groupClient.SendAsync("onUserOfflined", client.TenantId, client.UserId.Value, Context.ConnectionAborted); + // } + // } + + // // 发送好友下线通知 + // var userFriends = await FriendStore.GetListAsync(client.TenantId, client.UserId.Value, cancellationToken: Context.ConnectionAborted); + // if (userFriends.Count > 0) + // { + // var friendClientIds = userFriends.Select(friend => friend.FriendId.ToString()).ToImmutableArray(); + // var userClients = Clients.Users(friendClientIds); + // if (userClients != null) + // { + // await userClients.SendAsync("onUserOfflined", client.TenantId, client.UserId.Value, Context.ConnectionAborted); + // } + // } + + // await base.OnClientDisconnectedAsync(client); + //} [HubMethodName("LastContactFriends")] public virtual async Task> GetLastContactFriendsAsync( @@ -99,7 +101,7 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs var myFrientCount = await FriendStore.GetCountAsync(tenantId, userId); var lastContractFriends = await FriendStore - .GetLastContactListAsync(tenantId, userId, skipCount, maxResultCount); + .GetLastContactListAsync(tenantId, userId, skipCount, maxResultCount, cancellationToken: Context.ConnectionAborted); return new PagedResultDto(myFrientCount, lastContractFriends); } @@ -123,7 +125,7 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs { var messages = await MessageStore .GetLastChatMessagesAsync( - CurrentTenant.Id, userId, sorting, reverse, maxResultCount); + CurrentTenant.Id, userId, sorting, reverse, maxResultCount, cancellationToken: Context.ConnectionAborted); return new ListResultDto(messages); } @@ -144,7 +146,7 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs bool reverse = false) { var userFriends = await FriendStore - .GetListAsync(CurrentTenant.Id, userId, sorting, reverse); + .GetListAsync(CurrentTenant.Id, userId, sorting, reverse, cancellationToken: Context.ConnectionAborted); return new ListResultDto(userFriends); } @@ -156,7 +158,7 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs Guid friendId, string remarkName = "") { - await FriendStore.AddMemberAsync(tenantId, userId, friendId, remarkName); + await FriendStore.AddRequestAsync(tenantId, userId, friendId, remarkName); } [HubMethodName("RemoveFriend")] @@ -166,7 +168,7 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs Guid friendId, string remarkName = "") { - await FriendStore.RemoveMemberAsync(tenantId, userId, friendId); + await FriendStore.RemoveMemberAsync(tenantId, userId, friendId, cancellationToken: Context.ConnectionAborted); } /// @@ -178,7 +180,7 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs public virtual async Task SendMessageAsync(ChatMessage chatMessage) { // 持久化 - await MessageStore.StoreMessageAsync(chatMessage); + await MessageStore.StoreMessageAsync(chatMessage, cancellationToken: Context.ConnectionAborted); if (!chatMessage.GroupId.IsNullOrWhiteSpace()) { @@ -199,7 +201,7 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs return; } - await signalRClient.SendAsync("getChatMessage", chatMessage); + await signalRClient.SendAsync("getChatMessage", chatMessage, cancellationToken: Context.ConnectionAborted); } protected virtual async Task SendMessageToUserAsync(ChatMessage chatMessage) @@ -217,7 +219,7 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs Logger.LogDebug("Can not get user " + onlineClientContext.UserId + " with connectionId " + onlineClient.ConnectionId + " from SignalR hub!"); continue; } - await signalRClient.SendAsync("getChatMessage", chatMessage); + await signalRClient.SendAsync("getChatMessage", chatMessage, cancellationToken: Context.ConnectionAborted); } catch (Exception ex) { diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSender.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSenderProvider.cs similarity index 84% rename from aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSender.cs rename to aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSenderProvider.cs index 705649860..923a3b211 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSender.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSenderProvider.cs @@ -2,30 +2,27 @@ using LINGYUN.Abp.IM.SignalR.Hubs; using LINGYUN.Abp.RealTime.Client; using Microsoft.AspNetCore.SignalR; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using System; using System.Collections.Immutable; using System.Linq; using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; namespace LINGYUN.Abp.IM.SignalR.Messages { - [Dependency(ServiceLifetime.Transient, ReplaceServices = true)] - [ExposeServices(typeof(IMessageSender))] - public class SignalRMessageSender : MessageSenderBase + public class SignalRMessageSenderProvider : MessageSenderProviderBase { + public override string Name => "SignalR"; + private readonly IOnlineClientManager _onlineClientManager; private readonly IHubContext _hubContext; - public SignalRMessageSender( + public SignalRMessageSenderProvider( IOnlineClientManager onlineClientManager, IHubContext hubContext, - IMessageStore messageStore, - ILogger logger) - : base(messageStore, logger) + IServiceProvider serviceProvider) + : base(serviceProvider) { _hubContext = hubContext; _onlineClientManager = onlineClientManager; diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN.Abp.IM.csproj b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN.Abp.IM.csproj index f42bdd24c..7f324bea2 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN.Abp.IM.csproj +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN.Abp.IM.csproj @@ -9,6 +9,7 @@ + diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/AbpIMModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/AbpIMModule.cs new file mode 100644 index 000000000..1b3bc6012 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/AbpIMModule.cs @@ -0,0 +1,10 @@ +using Volo.Abp.EventBus; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.IM +{ + [DependsOn(typeof(AbpEventBusModule))] + public class AbpIMModule : AbpModule + { + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/AbpIMOptions.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/AbpIMOptions.cs new file mode 100644 index 000000000..01b49fd6e --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/AbpIMOptions.cs @@ -0,0 +1,15 @@ +using LINGYUN.Abp.IM.Messages; +using Volo.Abp.Collections; + +namespace LINGYUN.Abp.IM +{ + public class AbpIMOptions + { + public ITypeList Providers { get; } + + public AbpIMOptions() + { + Providers = new TypeList(); + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/IFriendStore.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/IFriendStore.cs index 8f0aae9ef..237a9a486 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/IFriendStore.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Contract/IFriendStore.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; namespace LINGYUN.Abp.IM.Contract @@ -16,7 +17,8 @@ namespace LINGYUN.Abp.IM.Contract Task IsFriendAsync( Guid? tenantId, Guid userId, - Guid friendId + Guid friendId, + CancellationToken cancellationToken = default ); /// /// 查询好友列表 @@ -30,7 +32,8 @@ namespace LINGYUN.Abp.IM.Contract Guid? tenantId, Guid userId, string sorting = nameof(UserFriend.UserId), - bool reverse = false + bool reverse = false, + CancellationToken cancellationToken = default ); /// /// 获取好友数量 @@ -42,7 +45,8 @@ namespace LINGYUN.Abp.IM.Contract Task GetCountAsync( Guid? tenantId, Guid userId, - string filter = ""); + string filter = "", + CancellationToken cancellationToken = default); /// /// 获取好友列表 /// @@ -61,7 +65,8 @@ namespace LINGYUN.Abp.IM.Contract string sorting = nameof(UserFriend.UserId), bool reverse = false, int skipCount = 0, - int maxResultCount = 10); + int maxResultCount = 10, + CancellationToken cancellationToken = default); /// /// 获取最近联系好友列表 /// @@ -74,7 +79,8 @@ namespace LINGYUN.Abp.IM.Contract Guid? tenantId, Guid userId, int skipCount = 0, - int maxResultCount = 10); + int maxResultCount = 10, + CancellationToken cancellationToken = default); /// /// 获取好友信息 /// @@ -85,20 +91,36 @@ namespace LINGYUN.Abp.IM.Contract Task GetMemberAsync( Guid? tenantId, Guid userId, - Guid friendId); + Guid friendId, + CancellationToken cancellationToken = default); /// /// 添加好友 /// /// /// /// + /// + Task AddMemberAsync( + Guid? tenantId, + Guid userId, + Guid friendId, + string remarkName = "", + CancellationToken cancellationToken = default); + /// + /// 添加好友请求 + /// + /// + /// + /// /// /// - Task AddMemberAsync( + Task AddRequestAsync( Guid? tenantId, Guid userId, Guid friendId, - string remarkName = ""); + string remarkName = "", + string description = "", + CancellationToken cancellationToken = default); /// /// 移除好友 /// @@ -109,7 +131,8 @@ namespace LINGYUN.Abp.IM.Contract Task RemoveMemberAsync( Guid? tenantId, Guid userId, - Guid friendId); + Guid friendId, + CancellationToken cancellationToken = default); /// /// 添加黑名单 /// @@ -120,7 +143,8 @@ namespace LINGYUN.Abp.IM.Contract Task AddShieldMemberAsync( Guid? tenantId, Guid userId, - Guid friendId); + Guid friendId, + CancellationToken cancellationToken = default); /// /// 移除黑名单 /// @@ -131,6 +155,7 @@ namespace LINGYUN.Abp.IM.Contract Task RemoveShieldMemberAsync( Guid? tenantId, Guid userId, - Guid friendId); + Guid friendId, + CancellationToken cancellationToken = default); } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/IUserGroupStore.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/IUserGroupStore.cs index d46dbf9ef..ea7212f7f 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/IUserGroupStore.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Group/IUserGroupStore.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; namespace LINGYUN.Abp.IM.Group @@ -13,7 +14,11 @@ namespace LINGYUN.Abp.IM.Group /// /// /// - Task MemberHasInGroupAsync(Guid? tenantId, long groupId, Guid userId); + Task MemberHasInGroupAsync( + Guid? tenantId, + long groupId, + Guid userId, + CancellationToken cancellationToken = default); /// /// 获取群组用户身份 /// @@ -21,28 +26,41 @@ namespace LINGYUN.Abp.IM.Group /// /// /// - Task GetUserGroupCardAsync(Guid? tenantId, long groupId, Guid userId); + Task GetUserGroupCardAsync( + Guid? tenantId, + long groupId, + Guid userId, + CancellationToken cancellationToken = default); /// /// 获取用户所在通讯组列表 /// /// /// /// - Task> GetUserGroupsAsync(Guid? tenantId, Guid userId); + Task> GetUserGroupsAsync( + Guid? tenantId, + Guid userId, + CancellationToken cancellationToken = default); /// /// 获取群组成员列表 /// /// /// /// - Task> GetMembersAsync(Guid? tenantId, long groupId); + Task> GetMembersAsync( + Guid? tenantId, + long groupId, + CancellationToken cancellationToken = default); /// /// 获取群组成员数 /// /// /// /// - Task GetMembersCountAsync(Guid? tenantId, long groupId); + Task GetMembersCountAsync( + Guid? tenantId, + long groupId, + CancellationToken cancellationToken = default); /// /// 获取通讯组用户 /// @@ -59,7 +77,8 @@ namespace LINGYUN.Abp.IM.Group string sorting = nameof(GroupUserCard.UserId), bool reverse = false, int skipCount = 0, - int maxResultCount = 10); + int maxResultCount = 10, + CancellationToken cancellationToken = default); /// /// 用户加入通讯组 /// @@ -67,7 +86,12 @@ namespace LINGYUN.Abp.IM.Group /// /// /// - Task AddUserToGroupAsync(Guid? tenantId, Guid userId, long groupId, Guid acceptUserId); + Task AddUserToGroupAsync( + Guid? tenantId, + Guid userId, + long groupId, + Guid acceptUserId, + CancellationToken cancellationToken = default); /// /// 用户退出通讯组 /// @@ -75,6 +99,10 @@ namespace LINGYUN.Abp.IM.Group /// /// /// - Task RemoveUserFormGroupAsync(Guid? tenantId, Guid userId, long groupId); + Task RemoveUserFormGroupAsync( + Guid? tenantId, + Guid userId, + long groupId, + CancellationToken cancellationToken = default); } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/ChatMessage.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/ChatMessage.cs index 28a4aa492..d3bae7b7e 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/ChatMessage.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/ChatMessage.cs @@ -48,7 +48,7 @@ namespace LINGYUN.Abp.IM.Messages /// public DateTime SendTime { get; set; } /// - /// 是否匿名发送 + /// 是否匿名发送(存储在扩展字段) /// public bool IsAnonymous { get; set; } /// diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageSenderProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageSenderProvider.cs new file mode 100644 index 000000000..fb7862084 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageSenderProvider.cs @@ -0,0 +1,10 @@ +using System.Threading.Tasks; + +namespace LINGYUN.Abp.IM.Messages +{ + public interface IMessageSenderProvider + { + string Name { get; } + Task SendMessageAsync(ChatMessage chatMessage); + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageSenderProviderManager.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageSenderProviderManager.cs new file mode 100644 index 000000000..08a292d1d --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageSenderProviderManager.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace LINGYUN.Abp.IM.Messages +{ + public interface IMessageSenderProviderManager + { + List Providers { get; } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageStore.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageStore.cs index 81ac75b7f..560548237 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageStore.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/IMessageStore.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; namespace LINGYUN.Abp.IM.Messages @@ -13,7 +14,9 @@ namespace LINGYUN.Abp.IM.Messages /// /// /// - Task StoreMessageAsync(ChatMessage chatMessage); + Task StoreMessageAsync( + ChatMessage chatMessage, + CancellationToken cancellationToken = default); /// /// 获取群组聊天记录总数 /// @@ -26,7 +29,8 @@ namespace LINGYUN.Abp.IM.Messages Guid? tenantId, long groupId, string filter = "", - MessageType? type = null); + MessageType? type = null, + CancellationToken cancellationToken = default); /// /// 获取群组聊天记录 /// @@ -47,7 +51,8 @@ namespace LINGYUN.Abp.IM.Messages bool reverse = true, MessageType? type = null, int skipCount = 0, - int maxResultCount = 10); + int maxResultCount = 10, + CancellationToken cancellationToken = default); /// /// 获取上一次通讯消息记录 /// @@ -62,7 +67,8 @@ namespace LINGYUN.Abp.IM.Messages Guid userId, string sorting = nameof(LastChatMessage.SendTime), bool reverse = true, - int maxResultCount = 10 + int maxResultCount = 10, + CancellationToken cancellationToken = default ); /// /// 获取与某个用户的聊天记录总数 @@ -78,7 +84,8 @@ namespace LINGYUN.Abp.IM.Messages Guid sendUserId, Guid receiveUserId, string filter = "", - MessageType? type = null); + MessageType? type = null, + CancellationToken cancellationToken = default); /// /// 获取与某个用户的聊天记录 /// @@ -95,6 +102,7 @@ namespace LINGYUN.Abp.IM.Messages bool reverse = true, MessageType? type = null, int skipCount = 0, - int maxResultCount = 10); + int maxResultCount = 10, + CancellationToken cancellationToken = default); } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSender.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSender.cs new file mode 100644 index 000000000..1197b62f0 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSender.cs @@ -0,0 +1,26 @@ +using System.Threading.Tasks; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.EventBus.Distributed; + +namespace LINGYUN.Abp.IM.Messages +{ + public class MessageSender : IMessageSender, ITransientDependency + { + protected IDistributedEventBus EventBus { get; } + public MessageSender(IDistributedEventBus eventBus) + { + EventBus = eventBus; + } + + public virtual async Task SendMessageAsync(ChatMessage chatMessage) + { + chatMessage.SetProperty(nameof(ChatMessage.IsAnonymous), chatMessage.IsAnonymous); + + // 如果先存储的话,就紧耦合消息处理模块了 + // await Store.StoreMessageAsync(chatMessage); + + await EventBus.PublishAsync(chatMessage); + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSenderBase.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSenderBase.cs deleted file mode 100644 index f39a4c428..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSenderBase.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Microsoft.Extensions.Logging; -using System; -using System.Threading.Tasks; - -namespace LINGYUN.Abp.IM.Messages -{ - public abstract class MessageSenderBase : IMessageSender - { - protected IMessageStore Store { get; } - protected ILogger Logger { get; } - protected MessageSenderBase( - IMessageStore store, - ILogger logger) - { - Store = store; - Logger = logger; - } - - public virtual async Task SendMessageAsync(ChatMessage chatMessage) - { - // 持久化 - await Store.StoreMessageAsync(chatMessage); - - try - { - if (!chatMessage.GroupId.IsNullOrWhiteSpace()) - { - await SendMessageToGroupAsync(chatMessage); - } - else - { - await SendMessageToUserAsync(chatMessage); - } - } - catch (Exception ex) - { - Logger.LogWarning("Could not send message, group: {0}, formUser: {1}, toUser: {2}", - chatMessage.GroupId, chatMessage.FormUserName, - chatMessage.ToUserId.HasValue ? chatMessage.ToUserId.ToString() : "None"); - Logger.LogWarning("Send group message error: {0}", ex.Message); - } - } - - protected abstract Task SendMessageToGroupAsync(ChatMessage chatMessage); - protected abstract Task SendMessageToUserAsync(ChatMessage chatMessage); - } -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSenderProviderBase.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSenderProviderBase.cs new file mode 100644 index 000000000..ef8f3223c --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSenderProviderBase.cs @@ -0,0 +1,70 @@ +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using System; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace LINGYUN.Abp.IM.Messages +{ + public abstract class MessageSenderProviderBase : IMessageSenderProvider, ITransientDependency + { + public abstract string Name { get; } + + protected IServiceProvider ServiceProvider { get; } + + protected readonly object ServiceProviderLock = new object(); + + public ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory); + private ILoggerFactory _loggerFactory; + + protected ILogger Logger => _lazyLogger.Value; + private Lazy _lazyLogger => new Lazy(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true); + + protected TService LazyGetRequiredService(ref TService reference) + { + if (reference == null) + { + lock (ServiceProviderLock) + { + if (reference == null) + { + reference = ServiceProvider.GetRequiredService(); + } + } + } + + return reference; + } + + protected MessageSenderProviderBase(IServiceProvider serviceProvider) + { + ServiceProvider = serviceProvider; + } + + public virtual async Task SendMessageAsync(ChatMessage chatMessage) + { + try + { + if (!chatMessage.GroupId.IsNullOrWhiteSpace()) + { + await SendMessageToGroupAsync(chatMessage); + } + else + { + await SendMessageToUserAsync(chatMessage); + } + } + catch (Exception ex) + { + Logger.LogWarning("Could not send message, group: {0}, formUser: {1}, toUser: {2}", + chatMessage.GroupId, chatMessage.FormUserName, + chatMessage.ToUserId.HasValue ? chatMessage.ToUserId.ToString() : "None"); + Logger.LogWarning("Send group message error: {0}", ex.Message); + } + } + + protected abstract Task SendMessageToGroupAsync(ChatMessage chatMessage); + protected abstract Task SendMessageToUserAsync(ChatMessage chatMessage); + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSenderProviderManager.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSenderProviderManager.cs new file mode 100644 index 000000000..3b0c4ec16 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSenderProviderManager.cs @@ -0,0 +1,33 @@ +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using System; +using System.Collections.Generic; +using System.Linq; +using Volo.Abp.DependencyInjection; + +namespace LINGYUN.Abp.IM.Messages +{ + public class MessageSenderProviderManager : IMessageSenderProviderManager, ISingletonDependency + { + public List Providers => _lazyProviders.Value; + + protected AbpIMOptions Options { get; } + + private readonly Lazy> _lazyProviders; + + public MessageSenderProviderManager( + IServiceProvider serviceProvider, + IOptions options) + { + Options = options.Value; + + _lazyProviders = new Lazy>( + () => Options + .Providers + .Select(type => serviceProvider.GetRequiredService(type) as IMessageSenderProvider) + .ToList(), + true + ); + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/NullMessageSender.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/NullMessageSender.cs deleted file mode 100644 index dd1469d1f..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/NullMessageSender.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Microsoft.Extensions.Logging; -using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; - -namespace LINGYUN.Abp.IM.Messages -{ - public class NullMessageSender : MessageSenderBase, ITransientDependency - { - public NullMessageSender(IMessageStore store, ILogger logger) - : base(store, logger) - { - } - - protected override Task SendMessageToGroupAsync(ChatMessage chatMessage) - { - Logger.LogWarning("No IMessageSender Interface implementation!"); - return Task.CompletedTask; - } - - protected override Task SendMessageToUserAsync(ChatMessage chatMessage) - { - Logger.LogWarning("No IMessageSender Interface implementation!"); - return Task.CompletedTask; - } - } -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/Hubs/NotificationsHub.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/Hubs/NotificationsHub.cs index 0b89ef241..2259961b2 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/Hubs/NotificationsHub.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/Hubs/NotificationsHub.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.SignalR; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; +using Volo.Abp.Uow; using Volo.Abp.Users; namespace LINGYUN.Abp.Notifications.SignalR.Hubs @@ -16,27 +17,49 @@ namespace LINGYUN.Abp.Notifications.SignalR.Hubs protected override async Task OnClientConnectedAsync(IOnlineClient client) { + await base.OnClientConnectedAsync(client); + if (client.TenantId.HasValue) { // 以租户为分组,将用户加入租户通讯组 - await Groups.AddToGroupAsync(client.ConnectionId, client.TenantId.Value.ToString()); + await Groups.AddToGroupAsync(client.ConnectionId, client.TenantId.Value.ToString(), Context.ConnectionAborted); + } + else + { + await Groups.AddToGroupAsync(client.ConnectionId, "Global", Context.ConnectionAborted); } } protected override async Task OnClientDisconnectedAsync(IOnlineClient client) { + await base.OnClientDisconnectedAsync(client); + if (client.TenantId.HasValue) { // 以租户为分组,将移除租户通讯组 - await Groups.RemoveFromGroupAsync(client.ConnectionId, client.TenantId.Value.ToString()); + await Groups.RemoveFromGroupAsync(client.ConnectionId, client.TenantId.Value.ToString(), Context.ConnectionAborted); + } + else + { + await Groups.RemoveFromGroupAsync(client.ConnectionId, "Global", Context.ConnectionAborted); } } + [HubMethodName("MySubscriptions")] + public virtual async Task> GetMySubscriptionsAsync() + { + var subscriptions = await NotificationStore + .GetUserSubscriptionsAsync(CurrentTenant.Id, CurrentUser.GetId()); + + return new ListResultDto(subscriptions); + } + + [UnitOfWork] [HubMethodName("GetNotification")] - public virtual async Task> GetNotificationAsync( - NotificationReadState readState = NotificationReadState.UnRead, int maxResultCount = 10) + public virtual async Task> GetNotificationAsync() { - var userNotifications = await NotificationStore.GetUserNotificationsAsync(CurrentTenant.Id, CurrentUser.GetId(), readState, maxResultCount); + var userNotifications = await NotificationStore + .GetUserNotificationsAsync(CurrentTenant.Id, CurrentUser.GetId(), NotificationReadState.UnRead, 10); return new ListResultDto(userNotifications); } @@ -44,7 +67,13 @@ namespace LINGYUN.Abp.Notifications.SignalR.Hubs [HubMethodName("ChangeState")] public virtual async Task ChangeStateAsync(string id, NotificationReadState readState = NotificationReadState.Read) { - await NotificationStore.ChangeUserNotificationReadStateAsync(CurrentTenant.Id, CurrentUser.GetId(), long.Parse(id), readState); + await NotificationStore + .ChangeUserNotificationReadStateAsync( + CurrentTenant.Id, + CurrentUser.GetId(), + long.Parse(id), + readState, + Context.ConnectionAborted); } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/SignalRNotificationPublishProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/SignalRNotificationPublishProvider.cs index 505af781c..252459ff8 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/SignalRNotificationPublishProvider.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/SignalRNotificationPublishProvider.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; +using System.Threading; using System.Threading.Tasks; namespace LINGYUN.Abp.Notifications.SignalR @@ -29,69 +30,41 @@ namespace LINGYUN.Abp.Notifications.SignalR _onlineClientManager = onlineClientManager; } - public override async Task PublishAsync(NotificationInfo notification, IEnumerable identifiers) + protected override async Task PublishAsync(NotificationInfo notification, IEnumerable identifiers, CancellationToken cancellationToken = default) { - if (notification.Data.HasTenantNotification(out Guid tenantId)) + if (identifiers?.Count() == 0) { - // 返回标准数据给前端 - notification.Data = NotificationData.ToStandardData(notification.Data); - var singalRGroup = _hubContext.Clients.Group(tenantId.ToString()); + var groupName = notification.TenantId?.ToString() ?? "Global"; + + var singalRGroup = _hubContext.Clients.Group(groupName); if (singalRGroup == null) { - Logger.LogDebug("Can not get group " + tenantId + " from SignalR hub!"); + Logger.LogDebug("Can not get group " + groupName + " from SignalR hub!"); return; } // 租户通知群发 Logger.LogDebug($"Found a singalr group, begin senging notifications"); - await singalRGroup.SendAsync("getNotification", notification); + await singalRGroup.SendAsync("getNotification", notification, cancellationToken); } else { - // 返回标准数据给前端 - notification.Data = NotificationData.ToStandardData(notification.Data); - foreach (var identifier in identifiers) + var onlineClients = _onlineClientManager.GetAllClients(client => identifiers.Any(ids => client.UserId == ids.UserId)); + var onlineClientConnectionIds = onlineClients.Select(client => client.ConnectionId).ToImmutableArray(); + try { - Logger.LogDebug($"Find online client with user {identifier.UserId} - {identifier.UserName}"); - var onlineClientContext = new OnlineClientContext(notification.TenantId, identifier.UserId); - var onlineClients = _onlineClientManager.GetAllByContext(onlineClientContext); - var onlineClientConnectionIds = onlineClients.Select(client => client.ConnectionId).ToImmutableArray(); - try - { - var signalRClients = _hubContext.Clients.Clients(onlineClientConnectionIds); - if (signalRClients == null) - { - Logger.LogDebug("Can not get user " + onlineClientContext.UserId + " connection from SignalR hub!"); - return; - } - Logger.LogDebug($"Found a singalr client, begin senging notifications"); - await signalRClients.SendAsync("getNotification", notification); - } - catch (Exception ex) + var signalRClients = _hubContext.Clients.Clients(onlineClientConnectionIds); + if (signalRClients == null) { - Logger.LogWarning("Could not send notifications to user: {0}", identifier.UserId); - Logger.LogWarning("Send to user notifications error: {0}", ex.Message); + Logger.LogDebug("Can not get users connection from SignalR hub!"); + return; } - - //foreach (var onlineClient in onlineClients) - //{ - // try - // { - // Logger.LogDebug($"Find online client {onlineClient.UserId} - {onlineClient.ConnectionId}"); - // var signalRClient = _hubContext.Clients.Client(onlineClient.ConnectionId); - // if (signalRClient == null) - // { - // Logger.LogDebug("Can not get user " + onlineClientContext.UserId + " with connectionId " + onlineClient.ConnectionId + " from SignalR hub!"); - // continue; - // } - // Logger.LogDebug($"Found a singalr client, begin senging notifications"); - // await signalRClient.SendAsync("getNotification", notification); - // } - // catch (Exception ex) - // { - // Logger.LogWarning("Could not send notifications to user: {0}", identifier.UserId); - // Logger.LogWarning("Send to user notifications error: {0}", ex.Message); - // } - //} + Logger.LogDebug($"Found a singalr client, begin senging notifications"); + await signalRClients.SendAsync("getNotification", notification, cancellationToken); + } + catch (Exception ex) + { + Logger.LogWarning("Could not send notifications to all users"); + Logger.LogWarning("Send to user notifications error: {0}", ex.Message); } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN.Abp.Notifications.WeChat.WeApp.csproj b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN.Abp.Notifications.WeChat.WeApp.csproj index 8c8c48113..f42eeff2c 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN.Abp.Notifications.WeChat.WeApp.csproj +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN.Abp.Notifications.WeChat.WeApp.csproj @@ -9,6 +9,7 @@ + diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/Features/WeChatWeAppFeatureDefinitionProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/Features/WeChatWeAppFeatureDefinitionProvider.cs new file mode 100644 index 000000000..a140583bd --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/Features/WeChatWeAppFeatureDefinitionProvider.cs @@ -0,0 +1,54 @@ +using LINGYUN.Abp.WeChat.Features; +using LINGYUN.Abp.WeChat.Localization; +using Volo.Abp.Features; +using Volo.Abp.Localization; +using Volo.Abp.Validation.StringValues; + +namespace LINGYUN.Abp.Notifications.WeChat.WeApp.Features +{ + public class WeChatWeAppFeatureDefinitionProvider : FeatureDefinitionProvider + { + public override void Define(IFeatureDefinitionContext context) + { + var wechatGroup = context.GetGroupOrNull(WeChatFeatures.GroupName); + if (wechatGroup != null) + { + var weappFeature = wechatGroup + .AddFeature( + WeChatWeAppFeatures.GroupName, + true.ToString(), + L("Features:WeApp"), + L("Features:WeAppDescription"), + new ToggleStringValueType(new BooleanValueValidator())); + + + var weappNofitication = weappFeature + .CreateChild( + WeChatWeAppFeatures.Notifications.Default, + true.ToString(), + L("Features:Notifications"), + L("Features:Notifications"), + new ToggleStringValueType(new BooleanValueValidator())); + weappNofitication + .CreateChild( + WeChatWeAppFeatures.Notifications.PublishLimit, + WeChatWeAppFeatures.Notifications.DefaultPublishLimit.ToString(), + L("Features:PublishLimit"), + L("Features:PublishLimitDescription"), + new ToggleStringValueType(new NumericValueValidator(0, 100000))); + weappNofitication + .CreateChild( + WeChatWeAppFeatures.Notifications.PublishLimitInterval, + WeChatWeAppFeatures.Notifications.DefaultPublishLimitInterval.ToString(), + L("Features:PublishLimitInterval"), + L("Features:PublishLimitIntervalDescription"), + new ToggleStringValueType(new NumericValueValidator(1, 12))); + } + } + + protected LocalizableString L(string name) + { + return LocalizableString.Create(name); + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/Features/WeChatWeAppFeatures.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/Features/WeChatWeAppFeatures.cs new file mode 100644 index 000000000..909cd33fc --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/Features/WeChatWeAppFeatures.cs @@ -0,0 +1,30 @@ +using LINGYUN.Abp.WeChat.Features; + +namespace LINGYUN.Abp.Notifications.WeChat.WeApp.Features +{ + public static class WeChatWeAppFeatures + { + public const string GroupName = WeChatFeatures.GroupName + ".WeApp"; + + public static class Notifications + { + public const string Default = GroupName + ".Notifications"; + /// + /// 发布次数上限 + /// + public const string PublishLimit = Default + ".PublishLimit"; + /// + /// 发布次数上限时长 + /// + public const string PublishLimitInterval = Default + ".PublishLimitInterval"; + /// + /// 默认发布次数上限 + /// + public const int DefaultPublishLimit = 1000; + /// + /// 默认发布次数上限时长 + /// + public const int DefaultPublishLimitInterval = 1; + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/IWeChatWeAppNotificationSender.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/IWeChatWeAppNotificationSender.cs index de5d8c500..27ee8d1d3 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/IWeChatWeAppNotificationSender.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/IWeChatWeAppNotificationSender.cs @@ -1,9 +1,10 @@ -using System.Threading.Tasks; +using System.Threading; +using System.Threading.Tasks; namespace LINGYUN.Abp.Notifications.WeChat.WeApp { public interface IWeChatWeAppNotificationSender { - Task SendAsync(WeChatWeAppSendNotificationData notificationData); + Task SendAsync(WeChatWeAppSendNotificationData notificationData, CancellationToken cancellationToken = default); } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/WeChatWeAppNotificationPublishProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/WeChatWeAppNotificationPublishProvider.cs index e6c21fac6..42f7e3b15 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/WeChatWeAppNotificationPublishProvider.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/WeChatWeAppNotificationPublishProvider.cs @@ -1,9 +1,12 @@ -using Microsoft.Extensions.Logging; +using LINGYUN.Abp.Notifications.WeChat.WeApp.Features; +using LINGYUN.Abp.WeChat.Authorization; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using System; using System.Collections.Generic; -using System.Linq; +using System.Threading; using System.Threading.Tasks; +using Volo.Abp.Features; namespace LINGYUN.Abp.Notifications.WeChat.WeApp { @@ -13,8 +16,13 @@ namespace LINGYUN.Abp.Notifications.WeChat.WeApp public class WeChatWeAppNotificationPublishProvider : NotificationPublishProvider { public override string Name => "WeChat.WeApp"; - private INotificationSubscriptionManager _notificationSubscriptionManager; - protected INotificationSubscriptionManager NotificationSubscriptionManager => LazyGetRequiredService(ref _notificationSubscriptionManager); + + private IFeatureChecker _featureChecker; + protected IFeatureChecker FeatureChecker => LazyGetRequiredService(ref _featureChecker); + + private IWeChatOpenIdFinder _weChatOpenIdFinder; + protected IWeChatOpenIdFinder WeChatOpenIdFinder => LazyGetRequiredService(ref _weChatOpenIdFinder); + protected IWeChatWeAppNotificationSender NotificationSender { get; } protected AbpWeChatWeAppNotificationOptions Options { get; } public WeChatWeAppNotificationPublishProvider( @@ -27,32 +35,39 @@ namespace LINGYUN.Abp.Notifications.WeChat.WeApp NotificationSender = notificationSender; } - public override async Task PublishAsync(NotificationInfo notification, IEnumerable identifiers) + protected override async Task PublishAsync(NotificationInfo notification, IEnumerable identifiers, CancellationToken cancellationToken = default) { + + // 先检测微信小程序的功能限制 + var publishEnabled = await FeatureChecker.GetAsync(WeChatWeAppFeatures.Notifications.Default, false); + + if (!publishEnabled) + { + return; + } + // step1 默认微信openid绑定的就是username, // 如果不是,需要自行处理openid获取逻辑 // step2 调用微信消息推送接口 - // 微信不支持推送到所有用户,需要获取订阅列表再发送 + // 微信不支持推送到所有用户 // 在小程序里用户订阅消息后通过 api/subscribes/subscribe 接口订阅对应模板消息 - if (identifiers == null) - { - var userSubscriptions = await NotificationSubscriptionManager - .GetSubscriptionsAsync(notification.TenantId, notification.Name); - identifiers = userSubscriptions - .Select(us => new UserIdentifier(us.UserId, us.UserName)); - - } foreach (var identifier in identifiers) { - await SendWeChatTemplateMessagAsync(notification, identifier); + await SendWeChatTemplateMessagAsync(notification, identifier, cancellationToken); } } - protected virtual async Task SendWeChatTemplateMessagAsync(NotificationInfo notification, UserIdentifier identifier) + protected virtual async Task SendWeChatTemplateMessagAsync(NotificationInfo notification, UserIdentifier identifier, CancellationToken cancellationToken = default) { var templateId = GetOrDefaultTemplateId(notification.Data); + if (templateId.IsNullOrWhiteSpace()) + { + Logger.LogWarning("Wechat weapp template id be empty, can not send notification!"); + return; + } + Logger.LogDebug($"Get wechat weapp template id: {templateId}"); var redirect = GetOrDefault(notification.Data, "RedirectPage", null); @@ -64,13 +79,22 @@ namespace LINGYUN.Abp.Notifications.WeChat.WeApp var weAppLang = GetOrDefault(notification.Data, "WeAppLanguage", Options.DefaultWeAppLanguage); Logger.LogDebug($"Get wechat weapp language: {weAppLang ?? null}"); - var weChatWeAppNotificationData = new WeChatWeAppSendNotificationData(identifier.UserName, + // TODO: 如果微信端发布通知,请组装好 wx-code 字段在通知数据内容里面 + string weChatCode = GetOrDefault(notification.Data, "wx-code", ""); + + WeChatOpenId openId = weChatCode.IsNullOrWhiteSpace() + ? await WeChatOpenIdFinder.FindByUserNameAsync(identifier.UserName) // 按照实际情况,需要自行实现 IUserWeChatCodeFinder 接口以获取微信Code,然后通过Code来获取OpenId + : await WeChatOpenIdFinder.FindAsync(weChatCode); + + + var weChatWeAppNotificationData = new WeChatWeAppSendNotificationData(openId.OpenId, templateId, redirect, weAppState, weAppLang); // 写入模板数据 weChatWeAppNotificationData.WriteStandardData(NotificationData.ToStandardData(Options.DefaultMsgPrefix, notification.Data)); Logger.LogDebug($"Sending wechat weapp notification: {notification.Name}"); + // 发送小程序订阅消息 await NotificationSender.SendAsync(weChatWeAppNotificationData); } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/WeChatWeAppNotificationSender.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/WeChatWeAppNotificationSender.cs index 44ecac7db..7d680ff9d 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/WeChatWeAppNotificationSender.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.WeChat/LINGYUN/Abp/Notifications/WeChat/WeApp/WeChatWeAppNotificationSender.cs @@ -1,13 +1,17 @@ -using LINGYUN.Abp.WeChat.Authorization; +using LINGYUN.Abp.Features.LimitValidation; +using LINGYUN.Abp.Notifications.WeChat.WeApp.Features; +using LINGYUN.Abp.WeChat.Authorization; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Newtonsoft.Json; using System.Collections.Generic; using System.Net.Http; using System.Text; +using System.Threading; using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.DependencyInjection; +using Volo.Abp.Features; using Volo.Abp.Json; namespace LINGYUN.Abp.Notifications.WeChat.WeApp @@ -31,7 +35,14 @@ namespace LINGYUN.Abp.Notifications.WeChat.WeApp Logger = NullLogger.Instance; } - public virtual async Task SendAsync(WeChatWeAppSendNotificationData notificationData) + [RequiresLimitFeature( // 检查消息发布功能限制 + WeChatWeAppFeatures.Notifications.PublishLimit, + WeChatWeAppFeatures.Notifications.PublishLimitInterval, + LimitPolicy.Month, + WeChatWeAppFeatures.Notifications.DefaultPublishLimit, + WeChatWeAppFeatures.Notifications.DefaultPublishLimitInterval + )] + public virtual async Task SendAsync(WeChatWeAppSendNotificationData notificationData, CancellationToken cancellationToken = default) { var weChatToken = await WeChatTokenProvider.GetTokenAsync(); var requestParamters = new Dictionary @@ -41,7 +52,7 @@ namespace LINGYUN.Abp.Notifications.WeChat.WeApp var weChatSendNotificationUrl = "https://api.weixin.qq.com"; var weChatSendNotificationPath = "/cgi-bin/message/subscribe/send"; var requestUrl = BuildRequestUrl(weChatSendNotificationUrl, weChatSendNotificationPath, requestParamters); - var responseContent = await MakeRequestAndGetResultAsync(requestUrl, notificationData); + var responseContent = await MakeRequestAndGetResultAsync(requestUrl, notificationData, cancellationToken); var weChatSenNotificationResponse = JsonSerializer.Deserialize(responseContent); if (!weChatSenNotificationResponse.IsSuccessed) @@ -52,7 +63,7 @@ namespace LINGYUN.Abp.Notifications.WeChat.WeApp // 失败是否抛出异常 // weChatSenNotificationResponse.ThrowIfNotSuccess(); } - protected virtual async Task MakeRequestAndGetResultAsync(string url, WeChatWeAppSendNotificationData notificationData) + protected virtual async Task MakeRequestAndGetResultAsync(string url, WeChatWeAppSendNotificationData notificationData, CancellationToken cancellationToken = default) { var client = HttpClientFactory.CreateClient(SendNotificationClientName); var sendDataContent = JsonSerializer.Serialize(notificationData); @@ -62,7 +73,7 @@ namespace LINGYUN.Abp.Notifications.WeChat.WeApp Content = requestContent }; - var response = await client.SendAsync(requestMessage); + var response = await client.SendAsync(requestMessage, cancellationToken); if (!response.IsSuccessStatusCode) { throw new AbpException($"WeChat send subscribe message http request service returns error! HttpStatusCode: {response.StatusCode}, ReasonPhrase: {response.ReasonPhrase}"); diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationModule.cs index f4eeb1ff5..250744007 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationModule.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationModule.cs @@ -22,11 +22,6 @@ namespace LINGYUN.Abp.Notifications AutoAddDefinitionProviders(context.Services); } - public override void ConfigureServices(ServiceConfigurationContext context) - { - context.Services.AddTransient(); - } - public override void OnApplicationInitialization(ApplicationInitializationContext context) { var options = context.ServiceProvider.GetRequiredService>().Value; diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationDefinitionContext.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationDefinitionContext.cs index 00aaf52e6..a576eae97 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationDefinitionContext.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationDefinitionContext.cs @@ -1,9 +1,18 @@ -namespace LINGYUN.Abp.Notifications +using JetBrains.Annotations; +using Volo.Abp.Localization; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Abp.Notifications { public interface INotificationDefinitionContext { - NotificationDefinition GetOrNull(string category); + NotificationGroupDefinition AddGroup( + [NotNull] string name, + ILocalizableString displayName = null, + bool allowSubscriptionToClients = true); + + NotificationGroupDefinition GetGroupOrNull(string name); - void Add(params NotificationDefinition[] definitions); + void RemoveGroup(string name); } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationDefinitionManager.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationDefinitionManager.cs index ab958ee8f..0eb55cf4a 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationDefinitionManager.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationDefinitionManager.cs @@ -6,10 +6,12 @@ namespace LINGYUN.Abp.Notifications public interface INotificationDefinitionManager { [NotNull] - NotificationDefinition Get([NotNull] string category); + NotificationDefinition Get([NotNull] string name); IReadOnlyList GetAll(); - NotificationDefinition GetOrNull(string category); + NotificationDefinition GetOrNull(string name); + + IReadOnlyList GetGroups(); } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationDispatcher.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationDispatcher.cs index cc450bb9f..7b3338970 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationDispatcher.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationDispatcher.cs @@ -6,28 +6,29 @@ namespace LINGYUN.Abp.Notifications /// /// 通知发送者接口 /// + [Obsolete("Notification system redesigned, publisher interface deactivated, please use INotificationSender")] public interface INotificationDispatcher { - /// - /// 发送通知 - /// - /// 通知名称 - /// 数据 - /// 租户 - /// 级别 - /// - Task DispatchAsync(NotificationName notificationName, NotificationData data, Guid? tenantId = null, - NotificationSeverity notificationSeverity = NotificationSeverity.Info); + ///// + ///// 发送通知 + ///// + ///// 通知名称 + ///// 数据 + ///// 租户 + ///// 级别 + ///// + //Task DispatchAsync(NotificationName notificationName, NotificationData data, Guid? tenantId = null, + // NotificationSeverity notificationSeverity = NotificationSeverity.Info); - /// - /// 发送通知事件 - /// - /// 通知名称 - /// 数据 - /// 租户 - /// 级别 - /// - Task DispatchEventAsync(NotificationName notificationName, NotificationData data, Guid? tenantId = null, - NotificationSeverity notificationSeverity = NotificationSeverity.Info); + ///// + ///// 发送通知事件 + ///// + ///// 通知名称 + ///// 数据 + ///// 租户 + ///// 级别 + ///// + //Task DispatchEventAsync(NotificationName notificationName, NotificationData data, Guid? tenantId = null, + // NotificationSeverity notificationSeverity = NotificationSeverity.Info); } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationSender.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationSender.cs new file mode 100644 index 000000000..2ad50913a --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationSender.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace LINGYUN.Abp.Notifications +{ + /// + /// 发送通知接口 + /// + public interface INotificationSender + { + /// + /// 发送通知 + /// + /// 名称 + /// 数据 + /// 用户,为空标识发给所有订阅用户 + /// 租户 + /// 严重级别 + Task SendNofiterAsync( + string name, + NotificationData data, + UserIdentifier user = null, + Guid? tenantId = null, + NotificationSeverity severity = NotificationSeverity.Info); + /// + /// 发送通知 + /// + /// 名称 + /// 数据 + /// 用户列表,为空标识发给所有订阅用户 + /// 租户 + /// 严重级别 + Task SendNofitersAsync( + string name, + NotificationData data, + IEnumerable users = null, + Guid? tenantId = null, + NotificationSeverity severity = NotificationSeverity.Info); + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationStore.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationStore.cs index e90af6509..57040f150 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationStore.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationStore.cs @@ -1,45 +1,126 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; namespace LINGYUN.Abp.Notifications { public interface INotificationStore { - Task InsertUserSubscriptionAsync(Guid? tenantId, UserIdentifier identifier, string notificationName); - - Task InsertUserSubscriptionAsync(Guid? tenantId, IEnumerable identifiers, string notificationName); - - Task DeleteUserSubscriptionAsync(Guid? tenantId, Guid userId, string notificationName); - - Task DeleteAllUserSubscriptionAsync(Guid? tenantId, string notificationName); - - Task DeleteUserSubscriptionAsync(Guid? tenantId, IEnumerable identifiers, string notificationName); - - Task> GetSubscriptionsAsync(Guid? tenantId, string notificationName); - - Task> GetUserSubscriptionsAsync(Guid? tenantId, Guid userId); - - Task> GetUserSubscriptionsAsync(Guid? tenantId, string userName); - - Task IsSubscribedAsync(Guid? tenantId, Guid userId, string notificationName); - - Task InsertNotificationAsync(NotificationInfo notification); - - Task DeleteNotificationAsync(NotificationInfo notification); - - Task DeleteNotificationAsync(int batchCount); - - Task InsertUserNotificationAsync(NotificationInfo notification, Guid userId); - - Task InsertUserNotificationsAsync(NotificationInfo notification, IEnumerable userIds); - - Task DeleteUserNotificationAsync(Guid? tenantId, Guid userId, long notificationId); - - Task GetNotificationOrNullAsync(Guid? tenantId, long notificationId); - - Task> GetUserNotificationsAsync(Guid? tenantId, Guid userId, NotificationReadState readState = NotificationReadState.UnRead, int maxResultCount = 10); - - Task ChangeUserNotificationReadStateAsync(Guid? tenantId, Guid userId, long notificationId, NotificationReadState readState); + Task InsertUserSubscriptionAsync( + Guid? tenantId, + UserIdentifier identifier, + string notificationName, + CancellationToken cancellationToken = default); + + Task InsertUserSubscriptionAsync( + Guid? tenantId, + IEnumerable identifiers, + string notificationName, + CancellationToken cancellationToken = default); + + Task DeleteUserSubscriptionAsync( + Guid? tenantId, + Guid userId, + string notificationName, + CancellationToken cancellationToken = default); + + Task DeleteAllUserSubscriptionAsync( + Guid? tenantId, + string notificationName, + CancellationToken cancellationToken = default); + + Task DeleteUserSubscriptionAsync( + Guid? tenantId, + IEnumerable identifiers, + string notificationName, + CancellationToken cancellationToken = default); + + Task> GetUserSubscriptionsAsync( + Guid? tenantId, + string notificationName, + IEnumerable identifiers = null, + CancellationToken cancellationToken = default); + + Task> GetUserSubscriptionsAsync( + Guid? tenantId, + Guid userId, + CancellationToken cancellationToken = default); + + Task> GetUserSubscriptionsAsync( + Guid? tenantId, + string userName, + CancellationToken cancellationToken = default); + + Task IsSubscribedAsync( + Guid? tenantId, + Guid userId, + string notificationName, + CancellationToken cancellationToken = default); + + Task InsertNotificationAsync( + NotificationInfo notification, + CancellationToken cancellationToken = default); + + Task DeleteNotificationAsync( + NotificationInfo notification, + CancellationToken cancellationToken = default); + + Task DeleteNotificationAsync( + int batchCount, + CancellationToken cancellationToken = default); + + Task InsertUserNotificationAsync( + NotificationInfo notification, + Guid userId, + CancellationToken cancellationToken = default); + + Task InsertUserNotificationsAsync( + NotificationInfo notification, + IEnumerable userIds, + CancellationToken cancellationToken = default); + + Task DeleteUserNotificationAsync( + Guid? tenantId, + Guid userId, + long notificationId, + CancellationToken cancellationToken = default); + + Task GetNotificationOrNullAsync( + Guid? tenantId, + long notificationId, + CancellationToken cancellationToken = default); + + Task> GetUserNotificationsAsync( + Guid? tenantId, + Guid userId, + NotificationReadState readState = NotificationReadState.UnRead, + int maxResultCount = 10, + CancellationToken cancellationToken = default); + + Task GetUserNotificationsCountAsync( + Guid? tenantId, + Guid userId, + string filter = "", + NotificationReadState readState = NotificationReadState.UnRead, + CancellationToken cancellationToken = default); + + Task> GetUserNotificationsAsync( + Guid? tenantId, + Guid userId, + string filter = "", + string sorting = nameof(NotificationInfo.CreationTime), + bool reverse = true, + NotificationReadState readState = NotificationReadState.UnRead, + int skipCount = 1, + int maxResultCount = 10, + CancellationToken cancellationToken = default); + + Task ChangeUserNotificationReadStateAsync( + Guid? tenantId, + Guid userId, + long notificationId, + NotificationReadState readState, + CancellationToken cancellationToken = default); } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationSubscriptionManager.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationSubscriptionManager.cs index 2754a872a..04b32eaea 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationSubscriptionManager.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationSubscriptionManager.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; namespace LINGYUN.Abp.Notifications @@ -16,7 +17,11 @@ namespace LINGYUN.Abp.Notifications /// 用户标识 /// 通知名称 /// - Task IsSubscribedAsync(Guid? tenantId, Guid userId, string notificationName); + Task IsSubscribedAsync( + Guid? tenantId, + Guid userId, + string notificationName, + CancellationToken cancellationToken = default); /// /// 订阅通知 /// @@ -24,7 +29,11 @@ namespace LINGYUN.Abp.Notifications /// 用户标识 /// 通知名称 /// - Task SubscribeAsync(Guid? tenantId, UserIdentifier identifier, string notificationName); + Task SubscribeAsync( + Guid? tenantId, + UserIdentifier identifier, + string notificationName, + CancellationToken cancellationToken = default); /// /// 订阅通知 /// @@ -32,14 +41,21 @@ namespace LINGYUN.Abp.Notifications /// 用户标识列表 /// 通知名称 /// - Task SubscribeAsync(Guid? tenantId, IEnumerable identifiers, string notificationName); + Task SubscribeAsync( + Guid? tenantId, + IEnumerable identifiers, + string notificationName, + CancellationToken cancellationToken = default); /// /// 取消所有用户订阅 /// /// 租户 /// 通知名称 /// - Task UnsubscribeAllAsync(Guid? tenantId, string notificationName); + Task UnsubscribeAllAsync( + Guid? tenantId, + string notificationName, + CancellationToken cancellationToken = default); /// /// 取消订阅 /// @@ -47,7 +63,11 @@ namespace LINGYUN.Abp.Notifications /// 用户标识 /// 通知名称 /// - Task UnsubscribeAsync(Guid? tenantId, UserIdentifier identifier, string notificationName); + Task UnsubscribeAsync( + Guid? tenantId, + UserIdentifier identifier, + string notificationName, + CancellationToken cancellationToken = default); /// /// 取消订阅 /// @@ -55,27 +75,42 @@ namespace LINGYUN.Abp.Notifications /// 用户标识列表 /// 通知名称 /// - Task UnsubscribeAsync(Guid? tenantId, IEnumerable identifiers, string notificationName); + Task UnsubscribeAsync( + Guid? tenantId, + IEnumerable identifiers, + string notificationName, + CancellationToken cancellationToken = default); /// /// 获取通知被订阅用户列表 /// /// 租户 /// 通知名称 + /// 需要检查的用户列表 /// - Task> GetSubscriptionsAsync(Guid? tenantId, string notificationName); + Task> GetUsersSubscriptionsAsync( + Guid? tenantId, + string notificationName, + IEnumerable identifiers = null, + CancellationToken cancellationToken = default); /// /// 获取用户订阅列表 /// /// 租户 /// 用户标识 /// - Task> GetUserSubscriptionsAsync(Guid? tenantId, Guid userId); + Task> GetUserSubscriptionsAsync( + Guid? tenantId, + Guid userId, + CancellationToken cancellationToken = default); /// /// 获取用户订阅列表 /// /// 租户 /// 用户名 /// - Task> GetUserSubscriptionsAsync(Guid? tenantId, string userName); + Task> GetUserSubscriptionsAsync( + Guid? tenantId, + string userName, + CancellationToken cancellationToken = default); } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/DefaultNotificationDispatcher.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/DefaultNotificationDispatcher.cs deleted file mode 100644 index f27df960c..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/DefaultNotificationDispatcher.cs +++ /dev/null @@ -1,220 +0,0 @@ -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.EventBus.Distributed; - -namespace LINGYUN.Abp.Notifications.Internal -{ - /// - /// Implements . - /// - internal class DefaultNotificationDispatcher : INotificationDispatcher - { - /// - /// Reference to . - /// - public ILogger Logger { get; set; } - /// - /// Reference to . - /// - public IDistributedEventBus DistributedEventBus { get; set; } - /// - /// Reference to . - /// - private readonly AbpNotificationOptions _notificationOptions; - /// - /// Reference to . - /// - private readonly IBackgroundJobManager _backgroundJobManager; - /// - /// Reference to . - /// - private readonly INotificationStore _notificationStore; - /// - /// Reference to . - /// - private readonly INotificationDefinitionManager _notificationDefinitionManager; - /// - /// Reference to . - /// - private readonly INotificationPublishProviderManager _notificationPublishProviderManager; - /// - /// Initializes a new instance of the class. - /// - public DefaultNotificationDispatcher( - IBackgroundJobManager backgroundJobManager, - IOptions options, - INotificationStore notificationStore, - INotificationDefinitionManager notificationDefinitionManager, - INotificationPublishProviderManager notificationPublishProviderManager) - { - _backgroundJobManager = backgroundJobManager; - _notificationOptions = options.Value; - _notificationStore = notificationStore; - _notificationDefinitionManager = notificationDefinitionManager; - _notificationPublishProviderManager = notificationPublishProviderManager; - - DistributedEventBus = NullDistributedEventBus.Instance; - Logger = NullLogger.Instance; - } - /// - /// 发送通知 - /// - /// 通知名称 - /// 通知数据 - /// 租户 - /// 级别 - /// - public virtual async Task DispatchAsync(NotificationName notificationName, NotificationData data, Guid? tenantId = null, - NotificationSeverity notificationSeverity = NotificationSeverity.Info) - { - // 获取自定义的通知 - var defineNotification = _notificationDefinitionManager.Get(notificationName.CateGory); - - //// 没有定义的通知,应该也要能发布、订阅, - //// 比如订单之类的,是以订单编号为通知名称,这是动态的,没法自定义 - //if(defineNotification == null) - //{ - // defineNotification = new NotificationDefinition(notificationName.CateGory); - //} - - var notificationInfo = new NotificationInfo - { - CateGory = notificationName.CateGory, - Name = notificationName.Name, - CreationTime = DateTime.Now, - NotificationSeverity = notificationSeverity, - Lifetime = defineNotification.NotificationLifetime, - NotificationType = defineNotification.NotificationType, - TenantId = tenantId, - Data = data - }; - - var providers = Enumerable - .Reverse(_notificationPublishProviderManager.Providers); - - if (defineNotification.Providers.Any()) - { - providers = providers.Where(p => defineNotification.Providers.Contains(p.Name)); - } - - await PublishFromProvidersAsync(providers, notificationInfo); - - if (notificationInfo.Lifetime == NotificationLifetime.OnlyOne) - { - // 一次性通知在发送完成后就取消用户订阅 - await _notificationStore.DeleteAllUserSubscriptionAsync(notificationInfo.TenantId, - notificationInfo.Name); - } - } - /// - /// 发送通知事件 - /// - /// - /// - /// - /// - /// - public virtual async Task DispatchEventAsync(NotificationName notificationName, NotificationData data, Guid? tenantId = null, - NotificationSeverity notificationSeverity = NotificationSeverity.Info) - { - // 获取自定义的通知 - var defineNotification = _notificationDefinitionManager.Get(notificationName.CateGory); - - var notificationEventData = new NotificationEventData - { - CateGory = notificationName.CateGory, - Name = notificationName.Name, - CreationTime = DateTime.Now, - NotificationSeverity = notificationSeverity, - Lifetime = defineNotification.NotificationLifetime, - NotificationType = defineNotification.NotificationType, - TenantId = tenantId, - Data = data - }; - // 发布分布式通知事件,让消息中心统一处理 - await DistributedEventBus.PublishAsync(notificationEventData); - } - /// - /// 指定提供者发布通知 - /// - /// 提供者列表 - /// 通知信息 - /// - protected async Task PublishFromProvidersAsync(IEnumerable providers, - NotificationInfo notificationInfo) - { - Logger.LogDebug($"Persistent notification {notificationInfo.Name}"); - // 持久化通知 - await _notificationStore.InsertNotificationAsync(notificationInfo); - - Logger.LogDebug($"Gets a list of user subscriptions {notificationInfo.Name}"); - // 获取用户订阅列表 - var userSubscriptions = await _notificationStore.GetSubscriptionsAsync(notificationInfo.TenantId, notificationInfo.Name); - - Logger.LogDebug($"Persistent user notifications {notificationInfo.Name}"); - // 持久化用户通知 - var subscriptionUserIdentifiers = userSubscriptions.Select(us => new UserIdentifier(us.UserId, us.UserName)); - - await _notificationStore.InsertUserNotificationsAsync(notificationInfo, - subscriptionUserIdentifiers.Select(u => u.UserId)); - - // 发布通知 - foreach (var provider in providers) - { - await PublishAsync(provider, notificationInfo, subscriptionUserIdentifiers); - } - - // TODO: 需要计算队列大小,根据情况是否需要并行发布消息 - //Parallel.ForEach(providers, async (provider) => - //{ - // await PublishAsync(provider, notificationInfo, subscriptionUserIdentifiers); - //}); - } - /// - /// 发布通知 - /// - /// 通知发布者 - /// 通知信息 - /// 订阅用户列表 - /// - protected async Task PublishAsync(INotificationPublishProvider provider, NotificationInfo notificationInfo, - IEnumerable subscriptionUserIdentifiers) - { - try - { - Logger.LogDebug($"Sending notification with provider {provider.Name}"); - var notifacationDataMapping = _notificationOptions.NotificationDataMappings - .GetMapItemOrNull(notificationInfo.CateGory, 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/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/NotificationSender.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/NotificationSender.cs new file mode 100644 index 000000000..65845d7c2 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/NotificationSender.cs @@ -0,0 +1,78 @@ +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.EventBus.Distributed; + +namespace LINGYUN.Abp.Notifications +{ + public class NotificationSender : INotificationSender, ITransientDependency + { + /// + /// Reference to . + /// + public ILogger Logger { get; set; } + /// + /// Reference to . + /// + public IDistributedEventBus DistributedEventBus { get; } + + public NotificationSender( + IDistributedEventBus distributedEventBus) + { + DistributedEventBus = distributedEventBus; + Logger = NullLogger.Instance; + } + + public async Task SendNofiterAsync( + string name, + NotificationData data, + UserIdentifier user = null, + Guid? tenantId = null, + NotificationSeverity severity = NotificationSeverity.Info) + { + if (user == null) + { + await PublishNofiterAsync(name, data, null, tenantId, severity); + + } + else + { + await PublishNofiterAsync(name, data, new List { user }, tenantId, severity); + } + } + + public async Task SendNofitersAsync( + string name, + NotificationData data, + IEnumerable users = null, + Guid? tenantId = null, + NotificationSeverity severity = NotificationSeverity.Info) + { + await PublishNofiterAsync(name, data, users, tenantId, severity); + } + + protected async Task PublishNofiterAsync( + string name, + NotificationData data, + IEnumerable users = null, + Guid? tenantId = null, + NotificationSeverity severity = NotificationSeverity.Info) + { + await DistributedEventBus + .PublishAsync( + new NotificationEventData + { + TenantId = tenantId, + Users = users?.ToList(), + Name = name, + Data = data, + CreationTime = DateTime.Now, + Severity = severity + }); + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/NotificationSubscriptionManager.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/NotificationSubscriptionManager.cs index 3754d72d3..006ee9c83 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/NotificationSubscriptionManager.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/NotificationSubscriptionManager.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; @@ -15,56 +16,89 @@ namespace LINGYUN.Abp.Notifications.Internal _store = store; } - public virtual async Task> GetSubscriptionsAsync(Guid? tenantId, string notificationName) + public virtual async Task> GetUsersSubscriptionsAsync( + Guid? tenantId, + string notificationName, + IEnumerable identifiers = null, + CancellationToken cancellationToken = default) { - return await _store.GetSubscriptionsAsync(tenantId, notificationName); + return await _store.GetUserSubscriptionsAsync(tenantId, notificationName, identifiers, cancellationToken); } - public virtual async Task> GetUserSubscriptionsAsync(Guid? tenantId, Guid userId) + public virtual async Task> GetUserSubscriptionsAsync( + Guid? tenantId, + Guid userId, + CancellationToken cancellationToken = default) { - return await _store.GetUserSubscriptionsAsync(tenantId, userId); + return await _store.GetUserSubscriptionsAsync(tenantId, userId, cancellationToken); } - public virtual async Task> GetUserSubscriptionsAsync(Guid? tenantId, string userName) + public virtual async Task> GetUserSubscriptionsAsync( + Guid? tenantId, + string userName, + CancellationToken cancellationToken = default) { - return await _store.GetUserSubscriptionsAsync(tenantId, userName); + return await _store.GetUserSubscriptionsAsync(tenantId, userName, cancellationToken); } - public virtual async Task IsSubscribedAsync(Guid? tenantId, Guid userId, string notificationName) + public virtual async Task IsSubscribedAsync( + Guid? tenantId, + Guid userId, + string notificationName, + CancellationToken cancellationToken = default) { - return await _store.IsSubscribedAsync(tenantId, userId, notificationName); + return await _store.IsSubscribedAsync(tenantId, userId, notificationName, cancellationToken); } - public virtual async Task SubscribeAsync(Guid? tenantId, UserIdentifier identifier, string notificationName) + public virtual async Task SubscribeAsync( + Guid? tenantId, + UserIdentifier identifier, + string notificationName, + CancellationToken cancellationToken = default) { - if (await IsSubscribedAsync(tenantId, identifier.UserId, notificationName)) + if (await IsSubscribedAsync(tenantId, identifier.UserId, notificationName, cancellationToken)) { return; } - await _store.InsertUserSubscriptionAsync(tenantId, identifier, notificationName); + await _store.InsertUserSubscriptionAsync(tenantId, identifier, notificationName, cancellationToken); } - public virtual async Task SubscribeAsync(Guid? tenantId, IEnumerable identifiers, string notificationName) + public virtual async Task SubscribeAsync( + Guid? tenantId, + IEnumerable identifiers, + string notificationName, + CancellationToken cancellationToken = default) { foreach(var identifier in identifiers) { - await SubscribeAsync(tenantId, identifier, notificationName); + await SubscribeAsync(tenantId, identifier, notificationName, cancellationToken); } } - public virtual async Task UnsubscribeAsync(Guid? tenantId, UserIdentifier identifier, string notificationName) + public virtual async Task UnsubscribeAsync( + Guid? tenantId, + UserIdentifier identifier, + string notificationName, + CancellationToken cancellationToken = default) { - await _store.DeleteUserSubscriptionAsync(tenantId, identifier.UserId, notificationName); + await _store.DeleteUserSubscriptionAsync(tenantId, identifier.UserId, notificationName, cancellationToken); } - public virtual async Task UnsubscribeAllAsync(Guid? tenantId, string notificationName) + public virtual async Task UnsubscribeAllAsync( + Guid? tenantId, + string notificationName, + CancellationToken cancellationToken = default) { - await _store.DeleteAllUserSubscriptionAsync(tenantId, notificationName); + await _store.DeleteAllUserSubscriptionAsync(tenantId, notificationName, cancellationToken); } - public virtual async Task UnsubscribeAsync(Guid? tenantId, IEnumerable identifiers, string notificationName) + public virtual async Task UnsubscribeAsync( + Guid? tenantId, + IEnumerable identifiers, + string notificationName, + CancellationToken cancellationToken = default) { - await _store.DeleteUserSubscriptionAsync(tenantId, identifiers, notificationName); + await _store.DeleteUserSubscriptionAsync(tenantId, identifiers, notificationName, cancellationToken); } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/LocalizableStringInfo.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/LocalizableStringInfo.cs new file mode 100644 index 000000000..ce26dbf68 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/LocalizableStringInfo.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace LINGYUN.Abp.Notifications +{ + public class LocalizableStringInfo + { + public string ResourceName { get; } + + public string Name { get; } + + public Dictionary Values { get; } + + public LocalizableStringInfo( + string resourceName, + string name, + Dictionary values = null) + { + ResourceName = resourceName; + Name = name; + Values = values; + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationData.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationData.cs index 7548d8d0b..a53de5bea 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationData.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationData.cs @@ -8,14 +8,11 @@ namespace LINGYUN.Abp.Notifications /// /// /// TODO: 2020-10-29 针对不同语言的用户,如果在发布时期就本地化语言是错误的设计 - /// 把通知的标题和内容设计为 让客户端自行本地化 + /// 把通知的标题和内容设计为 让客户端自行本地化 /// public class NotificationData { - public const string NotificationKey = "N:G"; - public const string UserIdNotificationKey = "N:UI"; - public const string UserNameNotificationKey = "N:UN"; - public const string TenantNotificationKey = "N:T"; + public const string LocalizerKey = "localizer"; public virtual string Type => GetType().FullName; public object this[string key] @@ -55,30 +52,35 @@ namespace LINGYUN.Abp.Notifications public NotificationData() { _properties = new Dictionary(); + TrySetData(LocalizerKey, false); } - - public static NotificationData CreateNotificationData() - { - var data = new NotificationData(); - data.TrySetData(NotificationKey, "AbpNotification"); - return data; - } - - public static NotificationData CreateUserNotificationData(Guid userId, string userName) - { - var data = new NotificationData(); - data.TrySetData(UserIdNotificationKey, userId); - data.TrySetData(UserNameNotificationKey, userName); - return data; - } - - public static NotificationData CreateTenantNotificationData(Guid tenantId) + /// + /// 写入本地化的消息数据 + /// + /// + /// + /// + /// + /// + /// + public NotificationData WriteLocalizedData( + LocalizableStringInfo title, + LocalizableStringInfo message, + DateTime createTime, + string formUser, + LocalizableStringInfo description = null) { - var data = new NotificationData(); - data.TrySetData(TenantNotificationKey, tenantId); - return data; + TrySetData("title", title); + TrySetData("message", message); + TrySetData("formUser", formUser); + TrySetData("createTime", createTime); + TrySetData(LocalizerKey, true); + if (description != null) + { + TrySetData("description", description); + } + return this; } - /// /// 写入标准数据 /// @@ -86,13 +88,16 @@ namespace LINGYUN.Abp.Notifications /// 内容 /// 创建时间 /// 来源用户 + /// 附加说明 /// - public NotificationData WriteStandardData(string title, string message, DateTime createTime, string formUser) + public NotificationData WriteStandardData(string title, string message, DateTime createTime, string formUser, string description = "") { TrySetData("title", title); TrySetData("message", message); + TrySetData("description", description); TrySetData("formUser", formUser); TrySetData("createTime", createTime); + TrySetData(LocalizerKey, false); return this; } /// @@ -105,6 +110,7 @@ namespace LINGYUN.Abp.Notifications public NotificationData WriteStandardData(string prefix, string key, object value) { TrySetData(string.Concat(prefix, key), value); + TrySetData(LocalizerKey, false); return this; } /// @@ -117,8 +123,10 @@ namespace LINGYUN.Abp.Notifications var data = new NotificationData(); data.TrySetData("title", sourceData.TryGetData("title")); data.TrySetData("message", sourceData.TryGetData("message")); + data.TrySetData("description", sourceData.TryGetData("description")); data.TrySetData("formUser", sourceData.TryGetData("formUser")); data.TrySetData("createTime", sourceData.TryGetData("createTime")); + data.TrySetData(LocalizerKey, sourceData.TryGetData(LocalizerKey)); return data; } /// @@ -154,29 +162,20 @@ namespace LINGYUN.Abp.Notifications { if (value != null && !Properties.ContainsKey(key)) { - Properties[key] = value; + Properties.Add(key, value); } + Properties[key] = value; } - - public bool HasUserNotification(out Guid userId, out string userName) - { - userName = ""; - if (Properties.TryGetValue(UserIdNotificationKey, out object userKey)) - { - userId = (Guid)userKey; - var name = TryGetData(UserNameNotificationKey); - userName = name?.ToString() ?? userName; - return true; - } - return false; - } - - public bool HasTenantNotification(out Guid tenantId) + /// + /// 需要本地化 + /// + /// + public bool NeedLocalizer() { - if (Properties.TryGetValue(TenantNotificationKey, out object tenantKey)) + var localizer = TryGetData(LocalizerKey); + if (localizer != null && localizer is bool needLocalizer) { - tenantId = (Guid)tenantKey; - return true; + return needLocalizer; } return false; } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDataConverter.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDataConverter.cs new file mode 100644 index 000000000..f9a2d0880 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDataConverter.cs @@ -0,0 +1,31 @@ +using Newtonsoft.Json; + +namespace LINGYUN.Abp.Notifications +{ + public class NotificationDataConverter + { + public static NotificationData Convert(NotificationData notificationData) + { + if (notificationData != null) + { + if (notificationData.NeedLocalizer()) + { + var title = JsonConvert.DeserializeObject(notificationData.TryGetData("title").ToString()); + var message = JsonConvert.DeserializeObject(notificationData.TryGetData("message").ToString()); + notificationData.TrySetData("title", title); + notificationData.TrySetData("message", message); + + if (notificationData.Properties.TryGetValue("description", out object description) && description != null) + { + notificationData.TrySetData("description", JsonConvert.DeserializeObject(description.ToString())); + } + } + } + else + { + notificationData = new NotificationData(); + } + return notificationData; + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDataMappingDictionary.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDataMappingDictionary.cs index 008355e2a..da81cac62 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDataMappingDictionary.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDataMappingDictionary.cs @@ -6,13 +6,13 @@ namespace LINGYUN.Abp.Notifications { public class NotificationDataMappingDictionary : Dictionary> { - public void Mapping(string cateGory, string provider, Func func) + public void Mapping(string name, string provider, Func func) { - if (ContainsKey(cateGory)) + if (ContainsKey(name)) { - this[cateGory] = new List(); + this[name] = new List(); } - this[cateGory].Add(new NotificationDataMappingDictionaryItem(provider, func)); + this[name].Add(new NotificationDataMappingDictionaryItem(provider, func)); } public void MappingAll(string provider, Func func) @@ -23,11 +23,11 @@ namespace LINGYUN.Abp.Notifications } } - public NotificationDataMappingDictionaryItem GetMapItemOrNull(string cateGory, string provider) + public NotificationDataMappingDictionaryItem GetMapItemOrNull(string name, string provider) { - if (ContainsKey(cateGory)) + if (ContainsKey(name)) { - return this[cateGory].FirstOrDefault(map => map.Provider.Equals(provider)); + return this[name].FirstOrDefault(map => map.Provider.Equals(provider)); } return null; } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDefinition.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDefinition.cs index 3a0c8f3c5..b6b356a21 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDefinition.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDefinition.cs @@ -3,17 +3,11 @@ using System; using System.Collections.Generic; using Volo.Abp; using Volo.Abp.Localization; +using Volo.Abp.MultiTenancy; /* - * 通知系统的设计不应该定死通知名称 - * 而是规范通知的一些属性,因此不应该是自定义通知名称,而是定义通知的类目,类似于Catalog - * 或者Prefix - * - * TODO: 2020-08-26 如果需要用户或者租户特定的消息该如何来发送通知? - * 是否追加字段:通知类别(宿主、租户、用户、通用),主要可以在运行时判断发布消息的来源, - * 如果是用户通知(NotificationData[FormUser])则只会查询用户对于用户通知的订阅(用户互动:站内信、私信、好友请求、留言等),优先级最低 - * 租户通知(NotificationData[FormTenant])则只会查询用户对于租户通知的订阅(系统发布、应用通知),优先级次于用户 - * 全局通知(NotificationData[FormGlobal])则查询用户对于全局通知的订阅(一般用于系统发布、应用通知),优先级最高 + * 2020-10-29 重构通知 + * INotificationSender指定接收者,未指定才会查询所有订阅用户,已指定发布者,直接发布(检验是否订阅) */ namespace LINGYUN.Abp.Notifications @@ -21,10 +15,10 @@ namespace LINGYUN.Abp.Notifications public class NotificationDefinition { /// - /// 通知类目 + /// 通知名称 /// [NotNull] - public string CateGory { get; set; } + public string Name { get; set; } /// /// 通知显示名称 /// @@ -58,15 +52,15 @@ namespace LINGYUN.Abp.Notifications public List Providers { get; } public NotificationDefinition( - string category, + string name, ILocalizableString displayName = null, ILocalizableString description = null, NotificationType notificationType = NotificationType.Application, NotificationLifetime lifetime = NotificationLifetime.Persistent, bool allowSubscriptionToClients = false) { - CateGory = category; - DisplayName = displayName ?? new FixedLocalizableString(category); + Name = name; + DisplayName = displayName ?? new FixedLocalizableString(name); Description = description; NotificationLifetime = lifetime; NotificationType = notificationType; @@ -84,5 +78,10 @@ namespace LINGYUN.Abp.Notifications return this; } + + public override string ToString() + { + return $"[{nameof(NotificationDefinition)} {Name}]"; + } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDefinitionContext.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDefinitionContext.cs index db8b40bdc..64e674e24 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDefinitionContext.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDefinitionContext.cs @@ -1,33 +1,57 @@ -using System; +using JetBrains.Annotations; using System.Collections.Generic; +using Volo.Abp; +using Volo.Abp.Localization; +using Volo.Abp.MultiTenancy; namespace LINGYUN.Abp.Notifications { public class NotificationDefinitionContext : INotificationDefinitionContext { - protected Dictionary Notifications { get; } + internal Dictionary Groups { get; } - public NotificationDefinitionContext(Dictionary notifications) + public NotificationDefinitionContext() { - Notifications = notifications; + Groups = new Dictionary(); } - public void Add(params NotificationDefinition[] definitions) + public NotificationGroupDefinition AddGroup( + [NotNull] string name, + ILocalizableString displayName = null, + bool allowSubscriptionToClients = true) { - if (definitions.IsNullOrEmpty()) + Check.NotNull(name, nameof(name)); + + if (Groups.ContainsKey(name)) { - return; + throw new AbpException($"There is already an existing notification group with name: {name}"); } - foreach (var definition in definitions) + return Groups[name] = new NotificationGroupDefinition(name, displayName, allowSubscriptionToClients); + } + + public NotificationGroupDefinition GetGroupOrNull(string name) + { + Check.NotNull(name, nameof(name)); + + if (!Groups.ContainsKey(name)) { - Notifications[definition.CateGory] = definition; + return null; } + + return Groups[name]; } - public NotificationDefinition GetOrNull(string category) + public void RemoveGroup(string name) { - return Notifications.GetOrDefault(category); + Check.NotNull(name, nameof(name)); + + if (!Groups.ContainsKey(name)) + { + throw new AbpException($"Undefined notification group: '{name}'."); + } + + Groups.Remove(name); } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDefinitionManager.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDefinitionManager.cs index 6c92aa695..079e666a4 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDefinitionManager.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDefinitionManager.cs @@ -1,5 +1,4 @@ -using JetBrains.Annotations; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using System; using System.Collections.Generic; @@ -12,51 +11,88 @@ namespace LINGYUN.Abp.Notifications { public class NotificationDefinitionManager : INotificationDefinitionManager, ISingletonDependency { - protected Lazy> NotificationDefinitions { get; } - protected AbpNotificationOptions Options { get; } - protected IServiceProvider ServiceProvider { get; } + protected IDictionary NotificationGroupDefinitions => _lazyNotificationGroupDefinitions.Value; + private readonly Lazy> _lazyNotificationGroupDefinitions; + + protected IDictionary NotificationDefinitions => _lazyNotificationDefinitions.Value; + private readonly Lazy> _lazyNotificationDefinitions; + + private readonly IServiceScopeFactory _serviceScopeFactory; public NotificationDefinitionManager( IOptions options, - IServiceProvider serviceProvider) + IServiceScopeFactory serviceScopeFactory) { - ServiceProvider = serviceProvider; + _serviceScopeFactory = serviceScopeFactory; Options = options.Value; - NotificationDefinitions = new Lazy>(CreateNotificationDefinitions, true); + _lazyNotificationDefinitions = new Lazy>( + CreateNotificationDefinitions, + isThreadSafe: true + ); + + _lazyNotificationGroupDefinitions = new Lazy>( + CreateNotificationGroupDefinitions, + isThreadSafe: true + ); } - public virtual NotificationDefinition Get([NotNull] string category) + public virtual NotificationDefinition Get(string name) { - Check.NotNull(category, nameof(category)); + Check.NotNull(name, nameof(name)); - var notification = GetOrNull(category); + var feature = GetOrNull(name); - if (notification == null) + if (feature == null) { - throw new AbpException("Undefined notification category: " + category); + throw new AbpException("Undefined notification: " + name); } - return notification; + return feature; } public virtual IReadOnlyList GetAll() { - return NotificationDefinitions.Value.Values.ToImmutableList(); + return NotificationDefinitions.Values.ToImmutableList(); + } + + public virtual NotificationDefinition GetOrNull(string name) + { + return NotificationDefinitions.GetOrDefault(name); } - public virtual NotificationDefinition GetOrNull(string category) + public IReadOnlyList GetGroups() { - return NotificationDefinitions.Value.GetOrDefault(category); + return NotificationGroupDefinitions.Values.ToImmutableList(); } - protected virtual IDictionary CreateNotificationDefinitions() + protected virtual Dictionary CreateNotificationDefinitions() { var notifications = new Dictionary(); - using (var scope = ServiceProvider.CreateScope()) + foreach (var groupDefinition in NotificationGroupDefinitions.Values) + { + foreach (var notification in groupDefinition.Notifications) + { + if (notifications.ContainsKey(notification.Name)) + { + throw new AbpException("Duplicate notification name: " + notification.Name); + } + + notifications[notification.Name] = notification; + } + } + + return notifications; + } + + protected virtual Dictionary CreateNotificationGroupDefinitions() + { + var context = new NotificationDefinitionContext(); + + using (var scope = _serviceScopeFactory.CreateScope()) { var providers = Options .DefinitionProviders @@ -65,11 +101,11 @@ namespace LINGYUN.Abp.Notifications foreach (var provider in providers) { - provider.Define(new NotificationDefinitionContext(notifications)); + provider.Define(context); } } - return notifications; + return context.Groups; } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationEventData.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationEventData.cs index 6eebfcd41..3fca3b84a 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationEventData.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationEventData.cs @@ -1,38 +1,20 @@ using System; +using System.Collections.Generic; +using Volo.Abp.MultiTenancy; namespace LINGYUN.Abp.Notifications { - public class NotificationEventData + public class NotificationEventData : IMultiTenant { public Guid? TenantId { get; set; } - public string CateGory { get; set; } public string Name { get; set; } - public string Id { get; set; } public NotificationData Data { get; set; } public DateTime CreationTime { get; set; } - public NotificationLifetime Lifetime { get; set; } - public NotificationType NotificationType { get; set; } - public NotificationSeverity NotificationSeverity { get; set; } - + public NotificationSeverity Severity { get; set; } + public List Users { get; set; } public NotificationEventData() { - - } - - public NotificationInfo ToNotificationInfo() - { - return new NotificationInfo - { - NotificationSeverity = NotificationSeverity, - CreationTime = CreationTime, - Data = Data, - Id = Id, - Name = Name, - CateGory = CateGory, - NotificationType = NotificationType, - Lifetime = Lifetime, - TenantId = TenantId - }; + Users = new List(); } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationGroupDefinition.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationGroupDefinition.cs new file mode 100644 index 000000000..088ba6447 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationGroupDefinition.cs @@ -0,0 +1,70 @@ +using JetBrains.Annotations; +using System.Collections.Generic; +using System.Collections.Immutable; +using Volo.Abp; +using Volo.Abp.Localization; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Abp.Notifications +{ + public class NotificationGroupDefinition + { + /// + /// 通知组名称 + /// + [NotNull] + public string Name { get; set; } + /// + /// 通知组显示名称 + /// + [NotNull] + public ILocalizableString DisplayName + { + get => _displayName; + set => _displayName = Check.NotNull(value, nameof(value)); + } + private ILocalizableString _displayName; + /// + /// 通知组说明 + /// + [CanBeNull] + public ILocalizableString Description { get; set; } + public bool AllowSubscriptionToClients { get; set; } + public IReadOnlyList Notifications => _notifications.ToImmutableList(); + private readonly List _notifications; + + protected internal NotificationGroupDefinition( + string name, + ILocalizableString displayName = null, + bool allowSubscriptionToClients = false) + { + Name = name; + DisplayName = displayName ?? new FixedLocalizableString(Name); + AllowSubscriptionToClients = allowSubscriptionToClients; + + _notifications = new List(); + } + + public virtual NotificationDefinition AddNotification( + string name, + ILocalizableString displayName = null, + ILocalizableString description = null, + NotificationType notificationType = NotificationType.Application, + NotificationLifetime lifetime = NotificationLifetime.Persistent, + bool allowSubscriptionToClients = false) + { + var notification = new NotificationDefinition( + name, + displayName, + description, + notificationType, + lifetime, + allowSubscriptionToClients + ); + + _notifications.Add(notification); + + return notification; + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationInfo.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationInfo.cs index 8b5745359..2b2f6db31 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationInfo.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationInfo.cs @@ -6,53 +6,33 @@ namespace LINGYUN.Abp.Notifications { public Guid? TenantId { get; set; } public string Name { get; set; } - public string CateGory { get; set; } public string Id { get; set; } public NotificationData Data { get; set; } public DateTime CreationTime { get; set; } public NotificationLifetime Lifetime { get; set; } - public NotificationType NotificationType { get; set; } - public NotificationSeverity NotificationSeverity { get; set; } + public NotificationType Type { get; set; } + public NotificationSeverity Severity { get; set; } public NotificationInfo() { Data = new NotificationData(); Lifetime = NotificationLifetime.Persistent; - NotificationType = NotificationType.Application; - NotificationSeverity = NotificationSeverity.Info; + Type = NotificationType.Application; + Severity = NotificationSeverity.Info; CreationTime = DateTime.Now; } - public long SetId(long id) + public void SetId(long id) { if (Id.IsNullOrWhiteSpace()) { Id = id.ToString(); - return id; } - - return GetId(); } public long GetId() { return long.Parse(Id); } - - public NotificationEventData ToNotificationEventData() - { - return new NotificationEventData - { - NotificationSeverity = NotificationSeverity, - CreationTime = CreationTime, - Data = Data, - Id = Id, - Name = Name, - CateGory = CateGory, - Lifetime = Lifetime, - NotificationType = NotificationType, - TenantId = TenantId - }; - } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationName.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationName.cs deleted file mode 100644 index 057259ded..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationName.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace LINGYUN.Abp.Notifications -{ - public class NotificationName - { - public string CateGory { get; } - public string Name { get; } - - public NotificationName(string cateGory, string name) - { - Name = name; - CateGory = cateGory; - } - } -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationNameNormalizer.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationNameNormalizer.cs deleted file mode 100644 index 1d4ada3d1..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationNameNormalizer.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace LINGYUN.Abp.Notifications -{ - public static class NotificationNameNormalizer - { - public static NotificationName NormalizerName(string name) - { - return new NotificationName(name, name); - } - public static NotificationName NormalizerName(string category, string name) - { - var notifyName = string.Concat(category, ":", name); - return new NotificationName(category, notifyName); - } - } -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationPublishJob.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationPublishJob.cs index 194739e49..d1023e4c6 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationPublishJob.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationPublishJob.cs @@ -30,8 +30,10 @@ namespace LINGYUN.Abp.Notifications if (ServiceProvider.GetRequiredService(providerType) is INotificationPublishProvider publishProvider) { var notification = await Store.GetNotificationOrNullAsync(args.TenantId, args.NotificationId); + notification.Data = NotificationDataConverter.Convert(notification.Data); + var notifacationDataMapping = Options.NotificationDataMappings - .GetMapItemOrNull(publishProvider.Name, notification.CateGory); + .GetMapItemOrNull(notification.Name, publishProvider.Name); if (notifacationDataMapping != null) { notification.Data = notifacationDataMapping.MappingFunc(notification.Data); diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationPublishProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationPublishProvider.cs index c2f4fda24..7e44c30ea 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationPublishProvider.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationPublishProvider.cs @@ -3,8 +3,10 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; +using Volo.Abp.Threading; namespace LINGYUN.Abp.Notifications { @@ -39,11 +41,19 @@ namespace LINGYUN.Abp.Notifications return reference; } + public ICancellationTokenProvider CancellationTokenProvider { get; set; } + protected NotificationPublishProvider(IServiceProvider serviceProvider) { ServiceProvider = serviceProvider; + CancellationTokenProvider = NullCancellationTokenProvider.Instance; + } + + public async Task PublishAsync(NotificationInfo notification, IEnumerable identifiers) + { + await PublishAsync(notification, identifiers, CancellationTokenProvider.Token); } - public abstract Task PublishAsync(NotificationInfo notification, IEnumerable identifiers); + protected abstract Task PublishAsync(NotificationInfo notification, IEnumerable identifiers, CancellationToken cancellationToken = default); } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NullNotificationStore.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NullNotificationStore.cs index 4aebff7f6..a954bdddc 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NullNotificationStore.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NullNotificationStore.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; @@ -9,92 +10,178 @@ namespace LINGYUN.Abp.Notifications [ExposeServices(typeof(INotificationStore))] public class NullNotificationStore : INotificationStore { - public Task ChangeUserNotificationReadStateAsync(Guid? tenantId, Guid userId, long notificationId, NotificationReadState readState) + public Task ChangeUserNotificationReadStateAsync( + Guid? tenantId, + Guid userId, + long notificationId, + NotificationReadState readState, + CancellationToken cancellationToken = default) { return Task.CompletedTask; } - public Task DeleteAllUserSubscriptionAsync(Guid? tenantId, string notificationName) + public Task DeleteAllUserSubscriptionAsync( + Guid? tenantId, + string notificationName, + CancellationToken cancellationToken = default) { return Task.CompletedTask; } - public Task DeleteNotificationAsync(NotificationInfo notification) + public Task DeleteNotificationAsync( + NotificationInfo notification, + CancellationToken cancellationToken = default) { return Task.CompletedTask; } - public Task DeleteNotificationAsync(int batchCount) + public Task DeleteNotificationAsync( + int batchCount, + CancellationToken cancellationToken = default) { return Task.CompletedTask; } - public Task DeleteUserNotificationAsync(Guid? tenantId, Guid userId, long notificationId) + public Task DeleteUserNotificationAsync( + Guid? tenantId, + Guid userId, + long notificationId, + CancellationToken cancellationToken = default) { return Task.CompletedTask; } - public Task DeleteUserSubscriptionAsync(Guid? tenantId, Guid userId, string notificationName) + public Task DeleteUserSubscriptionAsync( + Guid? tenantId, + Guid userId, + string notificationName, + CancellationToken cancellationToken = default) { return Task.CompletedTask; } - public Task DeleteUserSubscriptionAsync(Guid? tenantId, IEnumerable identifiers, string notificationName) + public Task DeleteUserSubscriptionAsync( + Guid? tenantId, + IEnumerable identifiers, + string notificationName, + CancellationToken cancellationToken = default) { return Task.CompletedTask; } - public Task GetNotificationOrNullAsync(Guid? tenantId, long notificationId) + public Task GetNotificationOrNullAsync( + Guid? tenantId, + long notificationId, + CancellationToken cancellationToken = default) { return Task.FromResult(new NotificationInfo()); } - public Task> GetSubscriptionsAsync(Guid? tenantId, string notificationName) + public Task> GetUserSubscriptionsAsync( + Guid? tenantId, + string notificationName, + IEnumerable identifiers, + CancellationToken cancellationToken = default) { return Task.FromResult(new List()); } - public Task> GetUserNotificationsAsync(Guid? tenantId, Guid userId, NotificationReadState readState = NotificationReadState.UnRead, int maxResultCount = 10) + public Task> GetUserNotificationsAsync( + Guid? tenantId, + Guid userId, + NotificationReadState readState = NotificationReadState.UnRead, + int maxResultCount = 10, + CancellationToken cancellationToken = default) { return Task.FromResult(new List()); } - public Task> GetUserSubscriptionsAsync(Guid? tenantId, Guid userId) + public Task GetUserNotificationsCountAsync( + Guid? tenantId, + Guid userId, + string filter = "", + NotificationReadState readState = NotificationReadState.UnRead, + CancellationToken cancellationToken = default) + { + return Task.FromResult(0); + } + + public Task> GetUserNotificationsAsync( + Guid? tenantId, + Guid userId, + string filter = "", + string sorting = nameof(NotificationInfo.CreationTime), + bool reverse = true, + NotificationReadState readState = NotificationReadState.UnRead, + int skipCount = 1, + int maxResultCount = 10, + CancellationToken cancellationToken = default) + { + return Task.FromResult(new List()); + } + + public Task> GetUserSubscriptionsAsync( + Guid? tenantId, + Guid userId, + CancellationToken cancellationToken = default) { return Task.FromResult(new List()); } - public Task> GetUserSubscriptionsAsync(Guid? tenantId, string userName) + public Task> GetUserSubscriptionsAsync( + Guid? tenantId, + string userName, + CancellationToken cancellationToken = default) { return Task.FromResult(new List()); } - public Task InsertNotificationAsync(NotificationInfo notification) + public Task InsertNotificationAsync( + NotificationInfo notification, + CancellationToken cancellationToken = default) { return Task.CompletedTask; } - public Task InsertUserNotificationAsync(NotificationInfo notification, Guid userId) + public Task InsertUserNotificationAsync( + NotificationInfo notification, + Guid userId, + CancellationToken cancellationToken = default) { return Task.CompletedTask; } - public Task InsertUserNotificationsAsync(NotificationInfo notification, IEnumerable userIds) + public Task InsertUserNotificationsAsync( + NotificationInfo notification, + IEnumerable userIds, + CancellationToken cancellationToken = default) { return Task.CompletedTask; } - public Task InsertUserSubscriptionAsync(Guid? tenantId, UserIdentifier identifier, string notificationName) + public Task InsertUserSubscriptionAsync( + Guid? tenantId, + UserIdentifier identifier, + string notificationName, + CancellationToken cancellationToken = default) { return Task.CompletedTask; } - public Task InsertUserSubscriptionAsync(Guid? tenantId, IEnumerable identifiers, string notificationName) + public Task InsertUserSubscriptionAsync( + Guid? tenantId, + IEnumerable identifiers, + string notificationName, + CancellationToken cancellationToken = default) { return Task.CompletedTask; } - public Task IsSubscribedAsync(Guid? tenantId, Guid userId, string notificationName) + public Task IsSubscribedAsync( + Guid? tenantId, + Guid userId, + string notificationName, + CancellationToken cancellationToken = default) { return Task.FromResult(false); } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/Class1.cs b/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/Class1.cs deleted file mode 100644 index 06fc047ee..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/Class1.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace LINGYUN.Abp.RealTime.SignalR -{ - public class Class1 - { - } -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN/Abp/RealTime/SignalR/AbpRealTimeSignalRModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN/Abp/RealTime/SignalR/AbpRealTimeSignalRModule.cs index 3e8995e8d..190b91a1d 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN/Abp/RealTime/SignalR/AbpRealTimeSignalRModule.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN/Abp/RealTime/SignalR/AbpRealTimeSignalRModule.cs @@ -4,6 +4,7 @@ using Volo.Abp.Modularity; namespace LINGYUN.Abp.RealTime.SignalR { [DependsOn( + typeof(AbpRealTimeModule), typeof(AbpAspNetCoreSignalRModule))] public class AbpRealTimeSignalRModule : AbpModule { diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN/Abp/RealTime/SignalR/Hubs/OnlineClientHubBase.cs b/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN/Abp/RealTime/SignalR/Hubs/OnlineClientHubBase.cs index c8d6f3307..6701cd9cd 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN/Abp/RealTime/SignalR/Hubs/OnlineClientHubBase.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.RealTime.SignalR/LINGYUN/Abp/RealTime/SignalR/Hubs/OnlineClientHubBase.cs @@ -1,80 +1,94 @@ using LINGYUN.Abp.RealTime.Client; -using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using System; using System.Threading.Tasks; using Volo.Abp.AspNetCore.SignalR; +using Volo.Abp.AspNetCore.WebClientInfo; namespace LINGYUN.Abp.RealTime.SignalR { - public abstract class OnlineClientHubBase : AbpHub + public abstract class OnlineClientHubBase : AbpHub, IClient { + private IWebClientInfoProvider _webClientInfoProvider; + protected IWebClientInfoProvider WebClientInfoProvider => LazyGetRequiredService(ref _webClientInfoProvider); + private IOnlineClientManager _onlineClientManager; protected IOnlineClientManager OnlineClientManager => LazyGetRequiredService(ref _onlineClientManager); - private IHttpContextAccessor _httpContextAccessor; - protected IHttpContextAccessor HttpContextAccessor => LazyGetRequiredService(ref _httpContextAccessor); - public override async Task OnConnectedAsync() { await base.OnConnectedAsync(); + IOnlineClient onlineClient = CreateClientForCurrentConnection(); - Logger.LogDebug("A client is connected: " + onlineClient.ToString()); - OnlineClientManager.Add(onlineClient); - await OnClientConnectedAsync(onlineClient); + await OnConnectedAsync(onlineClient); + } + + public virtual async Task OnConnectedAsync(IOnlineClient client) + { + Logger.LogDebug("A client is connected: " + client.ToString()); + OnlineClientManager.Add(client); + await OnClientConnectedAsync(client); } public override async Task OnDisconnectedAsync(Exception exception) { + // 从通讯组移除 + var onlineClient = OnlineClientManager.GetByConnectionIdOrNull(Context.ConnectionId); + await OnDisconnectedAsync(onlineClient); + await base.OnDisconnectedAsync(exception); - Logger.LogDebug("A client is disconnected: " + Context.ConnectionId); - try + } + + public virtual async Task OnDisconnectedAsync(IOnlineClient client) + { + if (client != null) { - // 从通讯组移除 - var onlineClient = OnlineClientManager.GetByConnectionIdOrNull(Context.ConnectionId); - if(onlineClient != null) + try { + Logger.LogDebug("A client is disconnected: " + client); // 移除在线客户端 OnlineClientManager.Remove(Context.ConnectionId); - await OnClientDisconnectedAsync(onlineClient); + await OnClientDisconnectedAsync(client); + } + catch (Exception ex) + { + Logger.LogWarning(ex.ToString(), ex); } - } - catch (Exception ex) - { - Logger.LogWarning(ex.ToString(), ex); } } protected virtual IOnlineClient CreateClientForCurrentConnection() { - return new OnlineClient(Context.ConnectionId, GetClientIpAddress(), - CurrentTenant.Id, CurrentUser.Id) + return new OnlineClient( + Context.ConnectionId, + WebClientInfoProvider.ClientIpAddress, + CurrentTenant.Id, + CurrentUser.Id) { - ConnectTime = Clock.Now + ConnectTime = Clock.Now, + UserName = CurrentUser.UserName, + UserAccount = CurrentUser.UserName, + Roles = CurrentUser.Roles ?? new string[0], + Properties = Context.Items }; } - protected virtual string GetClientIpAddress() + protected virtual async Task OnClientConnectedAsync(IOnlineClient client) { - try - { - return HttpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(); - } - catch (Exception ex) + // 角色添加进组 + foreach (var role in client.Roles) { - Logger.LogException(ex, LogLevel.Warning); - return null; + await Groups.AddToGroupAsync(client.ConnectionId, role); } } - protected virtual Task OnClientConnectedAsync(IOnlineClient client) + protected virtual async Task OnClientDisconnectedAsync(IOnlineClient client) { - return Task.CompletedTask; - } - - protected virtual Task OnClientDisconnectedAsync(IOnlineClient client) - { - return Task.CompletedTask; + // 角色添加进组 + foreach (var role in client.Roles) + { + await Groups.RemoveFromGroupAsync(client.ConnectionId, role); + } } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/IClient.cs b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/IClient.cs new file mode 100644 index 000000000..1df9e6b3d --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/IClient.cs @@ -0,0 +1,10 @@ +using System.Threading.Tasks; + +namespace LINGYUN.Abp.RealTime.Client +{ + public interface IClient + { + Task OnConnectedAsync(IOnlineClient client); + Task OnDisconnectedAsync(IOnlineClient client); + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/IOnlineClient.cs b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/IOnlineClient.cs index 00f465a89..fc66eaed2 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/IOnlineClient.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/IOnlineClient.cs @@ -19,8 +19,10 @@ namespace LINGYUN.Abp.RealTime.Client DateTime ConnectTime { get; } - object this[string key] { get; set; } + string[] Roles { get; } - Dictionary Properties { get; } + object this[object key] { get; set; } + + IDictionary Properties { get; } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/IOnlineClientManager.cs b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/IOnlineClientManager.cs index 7f83b96bb..9afb77bc1 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/IOnlineClientManager.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/IOnlineClientManager.cs @@ -1,6 +1,7 @@ using JetBrains.Annotations; using System; using System.Collections.Generic; +using System.Linq.Expressions; namespace LINGYUN.Abp.RealTime.Client { @@ -22,6 +23,8 @@ namespace LINGYUN.Abp.RealTime.Client IReadOnlyList GetAllClients(); + IReadOnlyList GetAllClients(Expression> predicate); + IReadOnlyList GetAllByContext([NotNull] OnlineClientContext context); } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/IOnlineClientStore.cs b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/IOnlineClientStore.cs index 9affcabbc..ea294bfa1 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/IOnlineClientStore.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/IOnlineClientStore.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; namespace LINGYUN.Abp.RealTime.Client { @@ -15,5 +17,7 @@ namespace LINGYUN.Abp.RealTime.Client bool Contains(string connectionId); IReadOnlyList GetAll(); + + IReadOnlyList GetAll(Expression> predicate); } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/InMemoryOnlineClientStore.cs b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/InMemoryOnlineClientStore.cs index 20b8de95c..568b1be9c 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/InMemoryOnlineClientStore.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/InMemoryOnlineClientStore.cs @@ -1,6 +1,9 @@ -using System.Collections.Concurrent; +using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; +using System.Linq; +using System.Linq.Expressions; using Volo.Abp.DependencyInjection; namespace LINGYUN.Abp.RealTime.Client @@ -43,5 +46,12 @@ namespace LINGYUN.Abp.RealTime.Client { return Clients.Values.ToImmutableList(); } + + public IReadOnlyList GetAll(Expression> predicate) + { + return Clients.Values + .Where(predicate.Compile()) + .ToImmutableList(); + } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/OnlineClient.cs b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/OnlineClient.cs index 43dc48b1c..0341c0007 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/OnlineClient.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/OnlineClient.cs @@ -6,7 +6,7 @@ namespace LINGYUN.Abp.RealTime.Client [Serializable] public class OnlineClient : IOnlineClient { - public object this[string key] + public object this[object key] { get { return Properties[key]; } set { Properties[key] = value; } @@ -23,10 +23,12 @@ namespace LINGYUN.Abp.RealTime.Client public string UserName { get; set; } + public string[] Roles { get; set; } + public DateTime ConnectTime { get; set; } - private Dictionary _properties; - public Dictionary Properties + private IDictionary _properties; + public IDictionary Properties { get { return _properties; } set @@ -53,7 +55,8 @@ namespace LINGYUN.Abp.RealTime.Client TenantId = tenantId; UserId = userId; - Properties = new Dictionary(); + Roles = new string[0]; + Properties = new Dictionary(); } public override string ToString() diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/OnlineClientManager.cs b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/OnlineClientManager.cs index e02405cf4..68e1bcfd9 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/OnlineClientManager.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/Client/OnlineClientManager.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; +using System.Linq.Expressions; using Volo.Abp; using Volo.Abp.DependencyInjection; @@ -89,10 +90,12 @@ namespace LINGYUN.Abp.RealTime.Client public virtual IReadOnlyList GetAllClients() { - lock (SyncObj) - { - return Store.GetAll(); - } + return Store.GetAll(); + } + + public virtual IReadOnlyList GetAllClients(Expression> predicate) + { + return Store.GetAll(predicate); } [NotNull] diff --git a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN.Abp.WeChat.Authorization.csproj b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN.Abp.WeChat.Authorization.csproj index 19ec414a5..85bf57c60 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN.Abp.WeChat.Authorization.csproj +++ b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN.Abp.WeChat.Authorization.csproj @@ -13,4 +13,8 @@ + + + + diff --git a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/AbpWeChatAuthorizationModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/AbpWeChatAuthorizationModule.cs index cb8ba8810..e69091dd7 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/AbpWeChatAuthorizationModule.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/AbpWeChatAuthorizationModule.cs @@ -7,7 +7,10 @@ using Volo.Abp.Modularity; namespace LINGYUN.Abp.WeChat.Authorization { - [DependsOn(typeof(AbpJsonModule), typeof(AbpCachingModule))] + [DependsOn( + typeof(AbpWeChatModule), + typeof(AbpJsonModule), + typeof(AbpCachingModule))] public class AbpWeChatAuthorizationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/IUserWeChatCodeFinder.cs b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/IUserWeChatCodeFinder.cs new file mode 100644 index 000000000..1edba6807 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/IUserWeChatCodeFinder.cs @@ -0,0 +1,12 @@ +using System; +using System.Threading.Tasks; + +namespace LINGYUN.Abp.WeChat.Authorization +{ + public interface IUserWeChatCodeFinder + { + Task FindByUserIdAsync(Guid userId); + + Task FindByUserNameAsync(string userName); + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/IWeChatOpenIdFinder.cs b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/IWeChatOpenIdFinder.cs index 3fa47002a..6fb15bcd9 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/IWeChatOpenIdFinder.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/IWeChatOpenIdFinder.cs @@ -1,9 +1,14 @@ -using System.Threading.Tasks; +using System; +using System.Threading.Tasks; namespace LINGYUN.Abp.WeChat.Authorization { public interface IWeChatOpenIdFinder { Task FindAsync(string code); + + Task FindByUserIdAsync(Guid userId); + + Task FindByUserNameAsync(string userName); } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/NullUserWeChatCodeFinder.cs b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/NullUserWeChatCodeFinder.cs new file mode 100644 index 000000000..364da9ef0 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/NullUserWeChatCodeFinder.cs @@ -0,0 +1,19 @@ +using System; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace LINGYUN.Abp.WeChat.Authorization +{ + public class NullUserWeChatCodeFinder : IUserWeChatCodeFinder, ISingletonDependency + { + public Task FindByUserIdAsync(Guid userId) + { + return Task.FromResult(userId.ToString()); + } + + public Task FindByUserNameAsync(string userName) + { + return Task.FromResult(userName); + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/WeChatOpenIdCacheItem.cs b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/WeChatOpenIdCacheItem.cs index 52950c532..888f7dd5f 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/WeChatOpenIdCacheItem.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/WeChatOpenIdCacheItem.cs @@ -18,11 +18,9 @@ namespace LINGYUN.Abp.WeChat.Authorization WeChatOpenId = weChatOpenId; } - public static string CalculateCacheKey(string code, Guid? tenantId = null) + public static string CalculateCacheKey(string code) { - string tenant = tenantId != null ? tenantId.Value.ToString("D") : "host"; - - return "t:" + tenant + ",c:" + code; + return "c:" + code; } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/WeChatOpenIdFinder.cs b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/WeChatOpenIdFinder.cs index 553f356e1..fcf22aecc 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/WeChatOpenIdFinder.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/OpenId/WeChatOpenIdFinder.cs @@ -22,16 +22,19 @@ namespace LINGYUN.Abp.WeChat.Authorization protected ICurrentTenant CurrentTenant { get; } protected IHttpClientFactory HttpClientFactory { get; } protected IJsonSerializer JsonSerializer { get; } + protected IUserWeChatCodeFinder UserWeChatCodeFinder { get; } protected IDistributedCache Cache { get; } public WeChatOpenIdFinder( ICurrentTenant currentTenant, IJsonSerializer jsonSerializer, + IUserWeChatCodeFinder userWeChatCodeFinder, IHttpClientFactory httpClientFactory, IOptions options, IDistributedCache cache) { CurrentTenant = currentTenant; JsonSerializer = jsonSerializer; + UserWeChatCodeFinder = userWeChatCodeFinder; HttpClientFactory = httpClientFactory; Cache = cache; @@ -43,12 +46,30 @@ namespace LINGYUN.Abp.WeChat.Authorization { // TODO: 如果需要获取SessionKey的话呢,需要再以openid作为标识来缓存一下吗 // 或者前端保存code,通过传递code来获取 - return (await GetCacheItemAsync(code, CurrentTenant.Id)).WeChatOpenId; + return (await GetCacheItemAsync(code)).WeChatOpenId; } - protected virtual async Task GetCacheItemAsync(string code, Guid? tenantId = null) + public virtual async Task FindByUserIdAsync(Guid userId) { - var cacheKey = WeChatOpenIdCacheItem.CalculateCacheKey(code, tenantId); + var code = await UserWeChatCodeFinder.FindByUserIdAsync(userId); + // TODO: 如果需要获取SessionKey的话呢,需要再以openid作为标识来缓存一下吗 + // 或者前端保存code,通过传递code来获取 + return (await GetCacheItemAsync(code)).WeChatOpenId; + } + + public virtual async Task FindByUserNameAsync(string userName) + { + var code = await UserWeChatCodeFinder.FindByUserNameAsync(userName); + // TODO: 如果需要获取SessionKey的话呢,需要再以openid作为标识来缓存一下吗 + // 或者前端保存code,通过传递code来获取 + return (await GetCacheItemAsync(code)).WeChatOpenId; + } + + + + protected virtual async Task GetCacheItemAsync(string code) + { + var cacheKey = WeChatOpenIdCacheItem.CalculateCacheKey(code); Logger.LogDebug($"WeChatOpenIdFinder.GetCacheItemAsync: {cacheKey}"); diff --git a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/Token/IWeChatTokenProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/Token/IWeChatTokenProvider.cs index dddf69239..0fdd7ceb2 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/Token/IWeChatTokenProvider.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/Token/IWeChatTokenProvider.cs @@ -1,9 +1,10 @@ -using System.Threading.Tasks; +using System.Threading; +using System.Threading.Tasks; namespace LINGYUN.Abp.WeChat.Authorization { public interface IWeChatTokenProvider { - Task GetTokenAsync(); + Task GetTokenAsync(CancellationToken cancellationToken = default); } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/Token/WeChatTokenProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/Token/WeChatTokenProvider.cs index 3c6b2b7e6..4e1cb40e5 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/Token/WeChatTokenProvider.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/Token/WeChatTokenProvider.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using System; using System.Net.Http; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.Caching; using Volo.Abp.DependencyInjection; @@ -33,18 +34,18 @@ namespace LINGYUN.Abp.WeChat.Authorization Logger = NullLogger.Instance; } - public virtual async Task GetTokenAsync() + public virtual async Task GetTokenAsync(CancellationToken cancellationToken = default) { - return (await GetCacheItemAsync("WeChatToken", Options.AppId)).WeChatToken; + return (await GetCacheItemAsync("WeChatToken", Options.AppId, cancellationToken)).WeChatToken; } - protected virtual async Task GetCacheItemAsync(string provider, string appId) + protected virtual async Task GetCacheItemAsync(string provider, string appId, CancellationToken cancellationToken = default) { var cacheKey = WeChatTokenCacheItem.CalculateCacheKey(provider, appId); Logger.LogDebug($"WeChatTokenProvider.GetCacheItemAsync: {cacheKey}"); - var cacheItem = await Cache.GetAsync(cacheKey); + var cacheItem = await Cache.GetAsync(cacheKey, token: cancellationToken); if (cacheItem != null) { @@ -64,7 +65,7 @@ namespace LINGYUN.Abp.WeChat.Authorization GrantType = "client_credential" }; - var response = await client.RequestWeChatCodeTokenAsync(request); + var response = await client.RequestWeChatCodeTokenAsync(request, cancellationToken); var responseContent = await response.Content.ReadAsStringAsync(); var weChatTokenResponse = JsonSerializer.Deserialize(responseContent); var weChatToken = weChatTokenResponse.ToWeChatToken(); @@ -78,7 +79,7 @@ namespace LINGYUN.Abp.WeChat.Authorization AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(weChatToken.ExpiresIn - 120) }; - await Cache.SetAsync(cacheKey, cacheItem, cacheOptions); + await Cache.SetAsync(cacheKey, cacheItem, cacheOptions, token: cancellationToken); Logger.LogDebug($"Finished setting the cache item: {cacheKey}"); diff --git a/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/WeChatAuthorizationConsts.cs b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/WeChatAuthorizationConsts.cs new file mode 100644 index 000000000..d1ffc1a13 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.WeChat.Authorization/LINGYUN/Abp/WeChat/Authorization/WeChatAuthorizationConsts.cs @@ -0,0 +1,22 @@ +namespace LINGYUN.Abp.WeChat.Authorization +{ + public class WeChatAuthorizationConsts + { + /// + /// 微信提供者标识 + /// + public static string ProviderKey { get; set; } = "WeChat"; + /// + /// 微信Code参数名称 + /// + public static string WeCahtCodeKey { get; set; } = "wx-code"; + /// + /// 微信OpenId参数名称 + /// + public static string WeCahtOpenIdKey { get; set; } = "wx-open-id"; + /// + /// 微信SessionKey参数名称 + /// + public static string WeCahtSessionKey { get; set; } = "wx-session-key"; + } +} diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/IIdentityUserAppService.cs b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/IIdentityUserAppService.cs index 2a5b02b1b..df9159134 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/IIdentityUserAppService.cs +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/IIdentityUserAppService.cs @@ -16,7 +16,6 @@ namespace LINGYUN.Abp.Identity Task RemoveOrganizationUnitsAsync(Guid id, Guid ouId); - #endregion #region ClaimType diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.WeChatValidator/LINGYUN/Abp/IdentityServer/WeChatValidator/WeChatTokenGrantValidator.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.WeChatValidator/LINGYUN/Abp/IdentityServer/WeChatValidator/WeChatTokenGrantValidator.cs index ed363e542..444a9fef7 100644 --- a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.WeChatValidator/LINGYUN/Abp/IdentityServer/WeChatValidator/WeChatTokenGrantValidator.cs +++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.WeChatValidator/LINGYUN/Abp/IdentityServer/WeChatValidator/WeChatTokenGrantValidator.cs @@ -72,6 +72,7 @@ namespace LINGYUN.Abp.IdentityServer.WeChatValidator Localizer["InvalidGrant:GrantTypeInvalid"]); return; } + // TODO: 统一命名规范, 微信认证传递的 code 改为 WeChatOpenIdConsts.WeCahtCodeKey var wechatCode = raw.Get(WeChatValidatorConsts.WeChatValidatorTokenName); if (wechatCode.IsNullOrWhiteSpace() || wechatCode.IsNullOrWhiteSpace()) { @@ -81,7 +82,7 @@ namespace LINGYUN.Abp.IdentityServer.WeChatValidator return; } var wechatOpenId = await WeChatOpenIdFinder.FindAsync(wechatCode); - var currentUser = await UserManager.FindByLoginAsync("WeChat", wechatOpenId.OpenId); + var currentUser = await UserManager.FindByLoginAsync(WeChatAuthorizationConsts.ProviderKey, wechatOpenId.OpenId); if(currentUser == null) { Logger.LogWarning("Invalid grant type: wechat openid: {0} not register", wechatOpenId.OpenId); @@ -91,6 +92,11 @@ namespace LINGYUN.Abp.IdentityServer.WeChatValidator } var sub = await UserManager.GetUserIdAsync(currentUser); + // 微信登录的用户写入token + currentUser.SetToken(WeChatAuthorizationConsts.ProviderKey, WeChatAuthorizationConsts.WeCahtCodeKey, wechatCode); + currentUser.SetToken(WeChatAuthorizationConsts.ProviderKey, WeChatAuthorizationConsts.WeCahtOpenIdKey, wechatOpenId.OpenId); + currentUser.SetToken(WeChatAuthorizationConsts.ProviderKey, WeChatAuthorizationConsts.WeCahtSessionKey, wechatOpenId.SessionKey); + var additionalClaims = new List(); if (currentUser.TenantId.HasValue) { diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.WeChatValidator/LINGYUN/Abp/WeChat/Authorization/UserWeChatCodeFinder.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.WeChatValidator/LINGYUN/Abp/WeChat/Authorization/UserWeChatCodeFinder.cs new file mode 100644 index 000000000..e0a966910 --- /dev/null +++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.WeChatValidator/LINGYUN/Abp/WeChat/Authorization/UserWeChatCodeFinder.cs @@ -0,0 +1,40 @@ +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Identity; + +namespace LINGYUN.Abp.WeChat.Authorization +{ + // TODO: 真正的项目需要扩展Abp框架实体来关联微信 + [Dependency(ServiceLifetime.Transient, ReplaceServices = true)] + [ExposeServices(typeof(IUserWeChatCodeFinder))] + public class UserWeChatCodeFinder : IUserWeChatCodeFinder + { + protected IdentityUserManager UserManager { get; } + + public UserWeChatCodeFinder( + IdentityUserManager userManager) + { + UserManager = userManager; + } + + public virtual async Task FindByUserIdAsync(Guid userId) + { + var user = await UserManager.FindByIdAsync(userId.ToString()); + + var weChatCodeToken = user?.FindToken(WeChatAuthorizationConsts.ProviderKey, WeChatAuthorizationConsts.WeCahtCodeKey); + + return weChatCodeToken?.Value ?? userId.ToString(); + } + + public virtual async Task FindByUserNameAsync(string userName) + { + var user = await UserManager.FindByNameAsync(userName); + + var weChatCodeToken = user?.FindToken(WeChatAuthorizationConsts.ProviderKey, WeChatAuthorizationConsts.WeCahtCodeKey); + + return weChatCodeToken?.Value ?? userName; + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendAddRequestDto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendAddRequestDto.cs new file mode 100644 index 000000000..d68bbd2f3 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendAddRequestDto.cs @@ -0,0 +1,7 @@ +namespace LINGYUN.Abp.MessageService.Chat +{ + public class MyFriendAddRequestDto : MyFriendOperationDto + { + public string RemarkName { get; set; } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendCreateDto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendCreateDto.cs index 00192a0ae..9fcc3e309 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendCreateDto.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/Dto/MyFriendCreateDto.cs @@ -2,6 +2,5 @@ { public class MyFriendCreateDto : MyFriendOperationDto { - public string RemarkName { get; set; } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IMyFriendAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IMyFriendAppService.cs index a220d5ee3..ada5421ad 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IMyFriendAppService.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Chat/IMyFriendAppService.cs @@ -14,5 +14,7 @@ namespace LINGYUN.Abp.MessageService.Chat Task CreateAsync(MyFriendCreateDto input); Task DeleteAsync(MyFriendOperationDto input); + + Task AddRequestAsync(MyFriendAddRequestDto input); } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Localization/ApplicationContracts/en.json b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Localization/ApplicationContracts/en.json index d33bd06cb..330f1fee3 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Localization/ApplicationContracts/en.json +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Localization/ApplicationContracts/en.json @@ -3,6 +3,8 @@ "texts": { "Permission:MessageService": "Message service", "Permission:Notification": "Notification", - "Permission:Delete": "Delete" + "Permission:Delete": "Delete", + "Permission:Hangfire": "Hangfire dashboard", + "Permission:ManageQueue": "Manage queue" } } \ No newline at end of file diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Localization/ApplicationContracts/zh-Hans.json b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Localization/ApplicationContracts/zh-Hans.json index 61f89d68c..dd688422c 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Localization/ApplicationContracts/zh-Hans.json +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Localization/ApplicationContracts/zh-Hans.json @@ -3,6 +3,8 @@ "texts": { "Permission:MessageService": "消息服务", "Permission:Notification": "通知管理", - "Permission:Delete": "删除" + "Permission:Delete": "删除", + "Permission:Hangfire": "Hangfire仪表板", + "Permission:ManageQueue": "管理队列" } } \ No newline at end of file diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationDto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationDto.cs new file mode 100644 index 000000000..7bff2a55c --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationDto.cs @@ -0,0 +1,28 @@ +using LINGYUN.Abp.Notifications; + +namespace LINGYUN.Abp.MessageService.Notifications +{ + public class NotificationDto + { + /// + /// 通知名称 + /// + public string Name { get; set; } + /// + /// 显示名称 + /// + public string DisplayName { get; set; } + /// + /// 说明 + /// + public string Description { get; set; } + /// + /// 存活类型 + /// + public NotificationLifetime Lifetime { get; set; } + /// + /// 通知类型 + /// + public NotificationType Type { get; set; } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationGroupDto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationGroupDto.cs new file mode 100644 index 000000000..32cf4587e --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationGroupDto.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace LINGYUN.Abp.MessageService.Notifications +{ + public class NotificationGroupDto + { + public string Name { get; set; } + public string DisplayName { get; set; } + public List Notifications { get; set; } = new List(); + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationSendDto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationSendDto.cs new file mode 100644 index 000000000..d0baadb58 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationSendDto.cs @@ -0,0 +1,22 @@ +using LINGYUN.Abp.Notifications; +using System; +using System.ComponentModel.DataAnnotations; + +namespace LINGYUN.Abp.MessageService.Notifications +{ + public class NotificationSendDto + { + [Required] + [StringLength(NotificationConsts.MaxNameLength)] + public string Name { get; set; } + + public NotificationData Data { get; set; } = new NotificationData(); + + public Guid? ToUserId { get; set; } + + [StringLength(128)] + public string ToUserName { get; set; } + + public NotificationSeverity Severity { get; set; } = NotificationSeverity.Info; + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/UserNotificationGetByPagedDto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/UserNotificationGetByPagedDto.cs index d8c102a69..b1e811463 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/UserNotificationGetByPagedDto.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/UserNotificationGetByPagedDto.cs @@ -7,6 +7,8 @@ namespace LINGYUN.Abp.MessageService.Notifications { public string Filter { get; set; } + public bool Reverse { get; set; } + public NotificationReadState ReadState { get; set; } = NotificationReadState.Read; } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/IMyNotificationAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/IMyNotificationAppService.cs new file mode 100644 index 000000000..e5dce9110 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/IMyNotificationAppService.cs @@ -0,0 +1,21 @@ +using LINGYUN.Abp.Notifications; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Abp.MessageService.Notifications +{ + public interface IMyNotificationAppService : + + IReadOnlyAppService< + NotificationInfo, + long, + UserNotificationGetByPagedDto + >, + IDeleteAppService + { + Task SendNofiterAsync(NotificationSendDto input); + + Task> GetAssignableNotifiersAsync(); + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/INotificationAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/INotificationAppService.cs deleted file mode 100644 index ca446d394..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/INotificationAppService.cs +++ /dev/null @@ -1,41 +0,0 @@ -using LINGYUN.Abp.Notifications; -using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; - -namespace LINGYUN.Abp.MessageService.Notifications -{ - public interface INotificationAppService : IApplicationService - { - /// - /// 查询通知明细 - /// - /// - /// - Task GetAsync(NotificationGetByIdDto notificationGetById); - /// - /// 删除通知 - /// - /// - /// - Task DeleteAsync(NotificationGetByIdDto notificationGetById); - /// - /// 删除用户通知 - /// - /// - /// - Task DeleteUserNotificationAsync(NotificationGetByIdDto notificationGetById); - /// - /// 变更通知阅读状态 - /// - /// - /// - Task ChangeUserNotificationReadStateAsync(UserNotificationChangeReadStateDto userNotificationChangeRead); - /// - /// 获取用户通知列表 - /// - /// - /// - Task> GetUserNotificationsAsync(UserNotificationGetByPagedDto userNotificationGetByPaged); - } -} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Permissions/MessageServicePermissions.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Permissions/MessageServicePermissions.cs index ed5372ad5..a6aadc2c2 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Permissions/MessageServicePermissions.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Permissions/MessageServicePermissions.cs @@ -10,5 +10,12 @@ public const string Delete = Default + ".Delete"; } + + public class Hangfire + { + public const string Default = GroupName + ".Hangfire"; + + public const string ManageQueue = Default + ".ManageQueue"; + } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Permissions/MessageServicePermissionsDefinitionProvider.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Permissions/MessageServicePermissionsDefinitionProvider.cs index d3417252d..b0f3e01dd 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Permissions/MessageServicePermissionsDefinitionProvider.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Permissions/MessageServicePermissionsDefinitionProvider.cs @@ -12,6 +12,9 @@ namespace LINGYUN.Abp.MessageService.Permissions var noticeGroup = group.AddPermission(MessageServicePermissions.Notification.Default, L("Permission:Notification")); noticeGroup.AddChild(MessageServicePermissions.Notification.Delete, L("Permission:Delete")); + + var hangfirePermission = group.AddPermission(MessageServicePermissions.Hangfire.Default, L("Permission:Hangfire")); + hangfirePermission.AddChild(MessageServicePermissions.Hangfire.ManageQueue, L("Permission:ManageQueue")); } private static LocalizableString L(string name) diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/Dto/SubscriptionsGetByNameDto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/Dto/SubscriptionsGetByNameDto.cs index f5bfcface..b4ceaad64 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/Dto/SubscriptionsGetByNameDto.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/Dto/SubscriptionsGetByNameDto.cs @@ -7,6 +7,6 @@ namespace LINGYUN.Abp.MessageService.Subscriptions { [Required] [StringLength(NotificationConsts.MaxNameLength)] - public string NotificationName { get; set; } + public string Name { get; set; } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/Dto/UserSubscreNotificationDto.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/Dto/UserSubscreNotificationDto.cs new file mode 100644 index 000000000..6e47e7823 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/Dto/UserSubscreNotificationDto.cs @@ -0,0 +1,7 @@ +namespace LINGYUN.Abp.MessageService.Subscriptions +{ + public class UserSubscreNotificationDto + { + public string Name { get; set; } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/Dto/UserSubscriptionsResult.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/Dto/UserSubscriptionsResult.cs new file mode 100644 index 000000000..495c2dd04 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/Dto/UserSubscriptionsResult.cs @@ -0,0 +1,22 @@ +namespace LINGYUN.Abp.MessageService.Subscriptions +{ + public class UserSubscriptionsResult + { + public bool IsSubscribed { get; } + + public UserSubscriptionsResult(bool isSubscribed) + { + IsSubscribed = isSubscribed; + } + + public static UserSubscriptionsResult Subscribed() + { + return new UserSubscriptionsResult(true); + } + + public static UserSubscriptionsResult UnSubscribed() + { + return new UserSubscriptionsResult(false); + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/IMySubscriptionAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/IMySubscriptionAppService.cs new file mode 100644 index 000000000..c22d53b39 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/IMySubscriptionAppService.cs @@ -0,0 +1,39 @@ +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Abp.MessageService.Subscriptions +{ + public interface IMySubscriptionAppService : IApplicationService + { + /// + /// 是否已订阅消息 + /// + /// + /// + Task IsSubscribedAsync(SubscriptionsGetByNameDto input); + /// + /// 订阅消息 + /// + /// + /// + Task SubscribeAsync(SubscriptionsGetByNameDto input); + /// + /// 退订消息 + /// + /// + /// + Task UnSubscribeAsync(SubscriptionsGetByNameDto input); + /// + /// 获取订阅列表 + /// + /// + /// + Task> GetListAsync(SubscriptionsGetByPagedDto input); + /// + /// 获取所有订阅列表 + /// + /// + Task> GetAllListAsync(); + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/ISubscriptionAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/ISubscriptionAppService.cs deleted file mode 100644 index d1ec7eeab..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Subscriptions/ISubscriptionAppService.cs +++ /dev/null @@ -1,35 +0,0 @@ -using LINGYUN.Abp.Notifications; -using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; - -namespace LINGYUN.Abp.MessageService.Subscriptions -{ - public interface ISubscriptionAppService : IApplicationService - { - /// - /// 是否已订阅消息 - /// - /// - /// - Task IsSubscribedAsync(SubscriptionsGetByNameDto subscriptionsGetByName); - /// - /// 订阅消息 - /// - /// - /// - Task SubscribeAsync(SubscriptionsGetByNameDto subscriptionsGetByName); - /// - /// 退订消息 - /// - /// - /// - Task UnSubscribeAsync(SubscriptionsGetByNameDto subscriptionsGetByName); - /// - /// 获取订阅列表 - /// - /// - /// - Task> GetSubscribedsAsync(SubscriptionsGetByPagedDto subscriptionsGetByPaged); - } -} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/MyFriendAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/MyFriendAppService.cs index d8254233a..501ebd55b 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/MyFriendAppService.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Chat/MyFriendAppService.cs @@ -1,4 +1,5 @@ using LINGYUN.Abp.IM.Contract; +using LINGYUN.Abp.MessageService.Localization; using Microsoft.AspNetCore.Authorization; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; @@ -12,14 +13,28 @@ namespace LINGYUN.Abp.MessageService.Chat { protected IFriendStore FriendStore { get; } - public MyFriendAppService(IFriendStore friendStore) + protected IUserChatCardRepository UserChatCardRepository { get; } + + public MyFriendAppService( + IFriendStore friendStore, + IUserChatCardRepository userChatCardRepository) { FriendStore = friendStore; + UserChatCardRepository = userChatCardRepository; + + LocalizationResource = typeof(MessageServiceResource); } public virtual async Task CreateAsync(MyFriendCreateDto input) { - await FriendStore.AddMemberAsync(CurrentTenant.Id, CurrentUser.GetId(), input.FriendId, input.RemarkName); + var friendCard = await UserChatCardRepository.GetMemberAsync(input.FriendId); + + await FriendStore.AddMemberAsync(CurrentTenant.Id, CurrentUser.GetId(), input.FriendId, friendCard?.NickName ?? friendCard?.UserName ?? input.FriendId.ToString()); + } + + public virtual async Task AddRequestAsync(MyFriendAddRequestDto input) + { + await FriendStore.AddRequestAsync(CurrentTenant.Id, CurrentUser.GetId(), input.FriendId, input.RemarkName, L["AddNewFriendBySearchId"]); } public virtual async Task DeleteAsync(MyFriendOperationDto input) diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Notifications/MyNotificationAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Notifications/MyNotificationAppService.cs new file mode 100644 index 000000000..d8c1c43ea --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Notifications/MyNotificationAppService.cs @@ -0,0 +1,119 @@ +using LINGYUN.Abp.Notifications; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; +using Volo.Abp.Users; + +namespace LINGYUN.Abp.MessageService.Notifications +{ + public class MyNotificationAppService : ApplicationService, IMyNotificationAppService + { + protected INotificationSender NotificationSender { get; } + + protected INotificationStore NotificationStore { get; } + + protected INotificationDefinitionManager NotificationDefinitionManager { get; } + + public MyNotificationAppService( + INotificationStore notificationStore, + INotificationSender notificationSender, + INotificationDefinitionManager notificationDefinitionManager) + { + NotificationStore = notificationStore; + NotificationSender = notificationSender; + NotificationDefinitionManager = notificationDefinitionManager; + } + + public virtual async Task SendNofiterAsync(NotificationSendDto input) + { + UserIdentifier user = null; + if (input.ToUserId.HasValue) + { + user = new UserIdentifier(input.ToUserId.Value, input.ToUserName); + } + await NotificationSender + .SendNofiterAsync( + input.Name, + input.Data, + user, + CurrentTenant.Id, + input.Severity); + } + + public virtual async Task DeleteAsync(long id) + { + await NotificationStore + .DeleteUserNotificationAsync( + CurrentTenant.Id, + CurrentUser.GetId(), + id); + } + + public virtual Task> GetAssignableNotifiersAsync() + { + var groups = new List(); + + foreach (var group in NotificationDefinitionManager.GetGroups()) + { + if (!group.AllowSubscriptionToClients) + { + continue; + + } + var notificationGroup = new NotificationGroupDto + { + Name = group.Name, + DisplayName = group.DisplayName.Localize(StringLocalizerFactory) + }; + + foreach (var notification in group.Notifications) + { + if (!notification.AllowSubscriptionToClients) + { + continue; + } + + var notificationChildren = new NotificationDto + { + Name = notification.Name, + DisplayName = notification.DisplayName.Localize(StringLocalizerFactory), + Description = notification.Description.Localize(StringLocalizerFactory), + Lifetime = notification.NotificationLifetime, + Type = notification.NotificationType + }; + + notificationGroup.Notifications.Add(notificationChildren); + } + + groups.Add(notificationGroup); + } + + return Task.FromResult(new ListResultDto(groups)); + } + + public virtual async Task GetAsync(long id) + { + return await NotificationStore + .GetNotificationOrNullAsync(CurrentTenant.Id, id); + } + + public virtual async Task> GetListAsync(UserNotificationGetByPagedDto input) + { + var notificationCount = await NotificationStore + .GetUserNotificationsCountAsync( + CurrentTenant.Id, + CurrentUser.GetId(), + input.Filter, + input.ReadState); + + var notifications = await NotificationStore + .GetUserNotificationsAsync( + CurrentTenant.Id, CurrentUser.GetId(), + input.Filter, input.Sorting, input.Reverse, + input.ReadState, input.SkipCount, input.MaxResultCount); + + return new PagedResultDto(notificationCount, notifications); + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Notifications/NotificationAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Notifications/NotificationAppService.cs deleted file mode 100644 index f7be4921e..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Notifications/NotificationAppService.cs +++ /dev/null @@ -1,68 +0,0 @@ -using LINGYUN.Abp.MessageService.Permissions; -using LINGYUN.Abp.Notifications; -using Microsoft.AspNetCore.Authorization; -using System.Collections.Generic; -using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Volo.Abp.Users; - -namespace LINGYUN.Abp.MessageService.Notifications -{ - [Authorize] - public class NotificationAppService : ApplicationService, INotificationAppService - { - private readonly INotificationRepository _notificationRepository; - private readonly IUserNotificationRepository _userNotificationRepository; - public NotificationAppService( - INotificationRepository notificationRepository, - IUserNotificationRepository userNotificationRepository) - { - _notificationRepository = notificationRepository; - _userNotificationRepository = userNotificationRepository; - } - - public virtual async Task ChangeUserNotificationReadStateAsync(UserNotificationChangeReadStateDto userNotificationChangeRead) - { - await _userNotificationRepository.ChangeUserNotificationReadStateAsync( - CurrentUser.GetId(), userNotificationChangeRead.NotificationId, userNotificationChangeRead.ReadState); - - } - - [Authorize(MessageServicePermissions.Notification.Delete)] - public virtual async Task DeleteAsync(NotificationGetByIdDto notificationGetById) - { - await _notificationRepository.DeleteAsync(notificationGetById.NotificationId); - } - - public virtual async Task DeleteUserNotificationAsync(NotificationGetByIdDto notificationGetById) - { - var notify = await _userNotificationRepository - .GetByIdAsync(CurrentUser.GetId(), notificationGetById.NotificationId); - await _userNotificationRepository.DeleteAsync(notify.Id); - } - - public virtual async Task GetAsync(NotificationGetByIdDto notificationGetById) - { - var notification = await _notificationRepository.GetByIdAsync(notificationGetById.NotificationId); - - return ObjectMapper.Map(notification); - } - - public virtual async Task> GetUserNotificationsAsync(UserNotificationGetByPagedDto userNotificationGetByPaged) - { - var notificationCount = await _userNotificationRepository - .GetCountAsync(CurrentUser.GetId(), userNotificationGetByPaged.Filter, - userNotificationGetByPaged.ReadState); - - var notifications = await _userNotificationRepository - .GetNotificationsAsync(CurrentUser.GetId(), userNotificationGetByPaged.Filter, - userNotificationGetByPaged.Sorting, userNotificationGetByPaged.ReadState, - userNotificationGetByPaged.SkipCount, userNotificationGetByPaged.MaxResultCount - ); - - return new PagedResultDto(notificationCount, - ObjectMapper.Map, List>(notifications)); - } - } -} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Subscriptions/MySubscriptionAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Subscriptions/MySubscriptionAppService.cs new file mode 100644 index 000000000..77f3db9fc --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Subscriptions/MySubscriptionAppService.cs @@ -0,0 +1,76 @@ +using LINGYUN.Abp.Notifications; +using Microsoft.AspNetCore.Authorization; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; +using Volo.Abp.Users; + +namespace LINGYUN.Abp.MessageService.Subscriptions +{ + [Authorize] + public class MySubscriptionAppService : ApplicationService, IMySubscriptionAppService + { + protected IUserSubscribeRepository UserSubscribeRepository { get; } + protected INotificationSubscriptionManager NotificationSubscriptionManager { get; } + + public MySubscriptionAppService( + IUserSubscribeRepository userSubscribeRepository, + INotificationSubscriptionManager notificationSubscriptionManager) + { + UserSubscribeRepository = userSubscribeRepository; + NotificationSubscriptionManager = notificationSubscriptionManager; + } + + public virtual async Task> GetListAsync(SubscriptionsGetByPagedDto input) + { + var userSubscribedCount = await UserSubscribeRepository.GetCountAsync(CurrentUser.GetId()); + + var userSubscribes = await UserSubscribeRepository + .GetUserSubscribesAsync(CurrentUser.GetId(), input.Sorting, + input.SkipCount, input.MaxResultCount); + + return new PagedResultDto(userSubscribedCount, + userSubscribes.Select(us => new UserSubscreNotificationDto { Name = us.NotificationName }).ToList()); + } + + public virtual async Task> GetAllListAsync() + { + var userSubscribes = await NotificationSubscriptionManager + .GetUserSubscriptionsAsync( + CurrentTenant.Id, + CurrentUser.GetId()); + + return new ListResultDto( + userSubscribes.Select(msn => new UserSubscreNotificationDto { Name = msn.NotificationName }).ToList()); + } + + public virtual async Task IsSubscribedAsync(SubscriptionsGetByNameDto input) + { + var isSubscribed = await NotificationSubscriptionManager + .IsSubscribedAsync(CurrentTenant.Id, CurrentUser.GetId(), input.Name); + + return isSubscribed + ? UserSubscriptionsResult.Subscribed() + : UserSubscriptionsResult.UnSubscribed(); + } + + public virtual async Task SubscribeAsync(SubscriptionsGetByNameDto input) + { + await NotificationSubscriptionManager + .SubscribeAsync( + CurrentTenant.Id, + new UserIdentifier(CurrentUser.GetId(), CurrentUser.UserName), + input.Name); + } + + public virtual async Task UnSubscribeAsync(SubscriptionsGetByNameDto input) + { + await NotificationSubscriptionManager + .UnsubscribeAsync( + CurrentTenant.Id, + new UserIdentifier(CurrentUser.GetId(), CurrentUser.UserName), + input.Name); + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Subscriptions/SubscriptionAppService.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Subscriptions/SubscriptionAppService.cs deleted file mode 100644 index bc198af4d..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Subscriptions/SubscriptionAppService.cs +++ /dev/null @@ -1,65 +0,0 @@ -using LINGYUN.Abp.Notifications; -using Microsoft.AspNetCore.Authorization; -using System.Collections.Generic; -using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Volo.Abp.Users; - -namespace LINGYUN.Abp.MessageService.Subscriptions -{ - [Authorize] - public class SubscriptionAppService : ApplicationService, ISubscriptionAppService - { - private readonly IUserSubscribeRepository _userSubscribeRepository; - - public SubscriptionAppService( - IUserSubscribeRepository userSubscribeRepository) - { - _userSubscribeRepository = userSubscribeRepository; - } - - public virtual async Task> GetSubscribedsAsync(SubscriptionsGetByPagedDto subscriptionsGetByPaged) - { - var userSubscribedCount = await _userSubscribeRepository.GetCountAsync(CurrentUser.GetId()); - - var userSubscribes = await _userSubscribeRepository - .GetUserSubscribesAsync(CurrentUser.GetId(), subscriptionsGetByPaged.Sorting, - subscriptionsGetByPaged.SkipCount, subscriptionsGetByPaged.MaxResultCount); - - return new PagedResultDto(userSubscribedCount, - ObjectMapper.Map, List>(userSubscribes)); - } - - public virtual async Task IsSubscribedAsync(SubscriptionsGetByNameDto subscriptionsGetByName) - { - var isSubscribed = await _userSubscribeRepository - .UserSubscribeExistsAysnc(subscriptionsGetByName.NotificationName, CurrentUser.GetId()); - - return isSubscribed; - } - - public virtual async Task SubscribeAsync(SubscriptionsGetByNameDto subscriptionsGetByName) - { - var isSubscribed = await _userSubscribeRepository - .UserSubscribeExistsAysnc(subscriptionsGetByName.NotificationName, CurrentUser.GetId()); - if (!isSubscribed) - { - UserSubscribe userSubscribe = new UserSubscribe( - subscriptionsGetByName.NotificationName, - CurrentUser.GetId(), CurrentUser.UserName, CurrentTenant.Id); - - await _userSubscribeRepository.InsertAsync(userSubscribe, true); - } - } - - public virtual async Task UnSubscribeAsync(SubscriptionsGetByNameDto subscriptionsGetByName) - { - var userSubscribe = await _userSubscribeRepository.GetUserSubscribeAsync(subscriptionsGetByName.NotificationName, CurrentUser.GetId()); - if (userSubscribe != null) - { - await _userSubscribeRepository.DeleteAsync(userSubscribe.Id, true); - } - } - } -} 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 5c97ed0c0..bad5d57b0 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 @@ -12,4 +12,8 @@ + + + + diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Chat/UserChatFriendConsts.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Chat/UserChatFriendConsts.cs new file mode 100644 index 000000000..6960f4e7b --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Chat/UserChatFriendConsts.cs @@ -0,0 +1,8 @@ +namespace LINGYUN.Abp.MessageService.Chat +{ + public static class UserChatFriendConsts + { + public static int MaxRemarkNameLength { get; set; } = UserChatCardConsts.MaxUserNameLength; + public static int MaxDescriptionLength { get; set; } = UserChatCardConsts.MaxDescriptionLength; + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/ObjectExtending/MessageServiceModuleExtensionConfiguration.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/ObjectExtending/MessageServiceModuleExtensionConfiguration.cs new file mode 100644 index 000000000..79b16fe9d --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/ObjectExtending/MessageServiceModuleExtensionConfiguration.cs @@ -0,0 +1,17 @@ +using System; +using Volo.Abp.ObjectExtending.Modularity; + +namespace LINGYUN.Abp.MessageService.ObjectExtending +{ + public class MessageServiceModuleExtensionConfiguration : ModuleExtensionConfiguration + { + public MessageServiceModuleExtensionConfiguration ConfigureMessage( + Action configureAction) + { + return this.ConfigureEntity( + MessageServiceModuleExtensionConsts.EntityNames.Message, + configureAction + ); + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/ObjectExtending/MessageServiceModuleExtensionConfigurationDictionaryExtensions.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/ObjectExtending/MessageServiceModuleExtensionConfigurationDictionaryExtensions.cs new file mode 100644 index 000000000..61ed02e29 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/ObjectExtending/MessageServiceModuleExtensionConfigurationDictionaryExtensions.cs @@ -0,0 +1,18 @@ +using System; +using Volo.Abp.ObjectExtending.Modularity; + +namespace LINGYUN.Abp.MessageService.ObjectExtending +{ + public static class MessageServiceModuleExtensionConfigurationDictionaryExtensions + { + public static ModuleExtensionConfigurationDictionary ConfigureMessage( + this ModuleExtensionConfigurationDictionary modules, + Action configureAction) + { + return modules.ConfigureModule( + MessageServiceModuleExtensionConsts.ModuleName, + configureAction + ); + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/ObjectExtending/MessageServiceModuleExtensionConsts.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/ObjectExtending/MessageServiceModuleExtensionConsts.cs new file mode 100644 index 000000000..c38cffe54 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/ObjectExtending/MessageServiceModuleExtensionConsts.cs @@ -0,0 +1,12 @@ +namespace LINGYUN.Abp.MessageService.ObjectExtending +{ + public static class MessageServiceModuleExtensionConsts + { + public const string ModuleName = "MessageService"; + + public static class EntityNames + { + public const string Message = "Message"; + } + } +} 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 bf0a3429c..2f19e44ef 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,10 +1,13 @@ -using LINGYUN.Abp.MessageService.Localization; +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 @@ -36,10 +39,17 @@ namespace LINGYUN.Abp.MessageService Configure(options => { - options.MapCodeNamespace("Messages.Group", typeof(MessageServiceResource)); - options.MapCodeNamespace("Messages.User", typeof(MessageServiceResource)); - options.MapCodeNamespace("Messages.UserFriend", typeof(MessageServiceResource)); + options.MapCodeNamespace(MessageServiceErrorCodes.Namespace, typeof(MessageServiceResource)); }); } + + 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/Chat/FriendStore.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/FriendStore.cs index 8690a36b1..04e744451 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/FriendStore.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/FriendStore.cs @@ -2,54 +2,101 @@ using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Caching; -using Volo.Abp.Domain.Services; +using Volo.Abp.DependencyInjection; +using Volo.Abp.MultiTenancy; +using Volo.Abp.Timing; using Volo.Abp.Uow; namespace LINGYUN.Abp.MessageService.Chat { - public class FriendStore : DomainService, IFriendStore + public class FriendStore : IFriendStore, ITransientDependency { - protected IDistributedCache Cache { get; } - protected IUserChatFriendRepository UserChatFriendRepository { get; } - protected IUserChatSettingRepository UserChatSettingRepository { get; } + private readonly IClock _clock; + private readonly ILogger _logger; + private readonly ICurrentTenant _currentTenant; + private readonly IDistributedCache _cache; + private readonly IUserChatFriendRepository _userChatFriendRepository; + private readonly IUserChatSettingRepository _userChatSettingRepository; public FriendStore( + IClock clock, + ILogger logger, + ICurrentTenant currentTenant, IDistributedCache cache, IUserChatFriendRepository userChatFriendRepository, - IUserChatSettingRepository userChatSettingRepository) + IUserChatSettingRepository userChatSettingRepository + ) { - Cache = cache; - UserChatFriendRepository = userChatFriendRepository; - UserChatSettingRepository = userChatSettingRepository; + _clock = clock; + _cache = cache; + _logger = logger; + _currentTenant = currentTenant; + _userChatFriendRepository = userChatFriendRepository; + _userChatSettingRepository = userChatSettingRepository; } public virtual async Task IsFriendAsync( Guid? tenantId, Guid userId, - Guid friendId + Guid friendId, + CancellationToken cancellationToken = default ) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - return await UserChatFriendRepository.IsAddedAsync(userId, friendId); + return await _userChatFriendRepository.IsFriendAsync(userId, friendId, cancellationToken); } } [UnitOfWork] - public virtual async Task AddMemberAsync(Guid? tenantId, Guid userId, Guid friendId, string remarkName = "") + public virtual async Task AddMemberAsync( + Guid? tenantId, + Guid userId, + Guid friendId, + string remarkName = "", + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - if (await UserChatFriendRepository.IsAddedAsync(userId, friendId)) + if (!await _userChatFriendRepository.IsAddedAsync(userId, friendId)) + { + var userFriend = new UserChatFriend(userId, friendId, remarkName); + userFriend.SetStatus(UserFriendStatus.Added); + + await _userChatFriendRepository.InsertAsync(userFriend); + } + + var userChatFriend = await _userChatFriendRepository + .FindByUserFriendIdAsync(friendId, userId); + + userChatFriend.SetStatus(UserFriendStatus.Added); + + await _userChatFriendRepository.UpdateAsync(userChatFriend, cancellationToken: cancellationToken); + } + } + + [UnitOfWork] + public virtual async Task AddRequestAsync( + Guid? tenantId, + Guid userId, + Guid friendId, + string remarkName = "", + string description = "", + CancellationToken cancellationToken = default) + { + using (_currentTenant.Change(tenantId)) + { + if (await _userChatFriendRepository.IsAddedAsync(userId, friendId)) { throw new BusinessException(MessageServiceErrorCodes.UseHasBeenAddedTheFriendOrSendAuthorization); } var status = UserFriendStatus.NeedValidation; - var userChatSetting = await UserChatSettingRepository.FindByUserIdAsync(friendId); + var userChatSetting = await _userChatSettingRepository.FindByUserIdAsync(friendId, cancellationToken); if (userChatSetting != null) { if (!userChatSetting.AllowAddFriend) @@ -62,50 +109,71 @@ namespace LINGYUN.Abp.MessageService.Chat : UserFriendStatus.Added; } - var userChatFriend = new UserChatFriend(userId, friendId, remarkName, status, tenantId) + var userChatFriend = new UserChatFriend(userId, friendId, remarkName, description, tenantId) { - CreationTime = Clock.Now, - CreatorId = userId + CreationTime = _clock.Now, + CreatorId = userId, }; + userChatFriend.SetStatus(status); - await UserChatFriendRepository.InsertAsync(userChatFriend); + await _userChatFriendRepository.InsertAsync(userChatFriend, cancellationToken: cancellationToken); return new UserAddFriendResult(status); } } [UnitOfWork] - public virtual async Task AddShieldMemberAsync(Guid? tenantId, Guid userId, Guid friendId) + public virtual async Task AddShieldMemberAsync( + Guid? tenantId, + Guid userId, + Guid friendId, + CancellationToken cancellationToken = default) { - await ChangeFriendShieldAsync(tenantId, userId, friendId, true); + await ChangeFriendShieldAsync(tenantId, userId, friendId, true, cancellationToken); } public virtual async Task> GetListAsync( Guid? tenantId, Guid userId, string sorting = nameof(UserFriend.UserId), - bool reverse = false + bool reverse = false, + CancellationToken cancellationToken = default ) { - return await GetAllFriendByCacheItemAsync(tenantId, userId, sorting, reverse); + using (_currentTenant.Change(tenantId)) + { + return await GetAllFriendByCacheItemAsync(userId, sorting, reverse, cancellationToken); + } } - public virtual async Task GetCountAsync(Guid? tenantId, Guid userId, string filter = "") + public virtual async Task GetCountAsync( + Guid? tenantId, + Guid userId, + string filter = "", + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - return await UserChatFriendRepository - .GetMembersCountAsync(userId, filter); + return await _userChatFriendRepository + .GetMembersCountAsync(userId, filter, cancellationToken); } } - public virtual async Task> GetPagedListAsync(Guid? tenantId, Guid userId, string filter = "", string sorting = nameof(UserFriend.UserId), bool reverse = false, int skipCount = 0, int maxResultCount = 10) + public virtual async Task> GetPagedListAsync( + Guid? tenantId, + Guid userId, + string filter = "", + string sorting = nameof(UserFriend.UserId), + bool reverse = false, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - return await UserChatFriendRepository + return await _userChatFriendRepository .GetMembersAsync(userId, filter, sorting, reverse, - skipCount, maxResultCount); + skipCount, maxResultCount, cancellationToken); } } @@ -113,85 +181,100 @@ namespace LINGYUN.Abp.MessageService.Chat Guid? tenantId, Guid userId, int skipCount = 0, - int maxResultCount = 10) + int maxResultCount = 10, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - return await UserChatFriendRepository + return await _userChatFriendRepository .GetLastContactMembersAsync(userId, - skipCount, maxResultCount); + skipCount, maxResultCount, cancellationToken); } } - public virtual async Task GetMemberAsync(Guid? tenantId, Guid userId, Guid friendId) + public virtual async Task GetMemberAsync( + Guid? tenantId, + Guid userId, + Guid friendId, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - return await UserChatFriendRepository - .GetMemberAsync(userId, friendId); + return await _userChatFriendRepository + .GetMemberAsync(userId, friendId, cancellationToken); } } [UnitOfWork] - public virtual async Task RemoveMemberAsync(Guid? tenantId, Guid userId, Guid friendId) + public virtual async Task RemoveMemberAsync( + Guid? tenantId, + Guid userId, + Guid friendId, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - var userChatFriend = await UserChatFriendRepository.FindByUserFriendIdAsync(userId, friendId); + var userChatFriend = await _userChatFriendRepository.FindByUserFriendIdAsync(userId, friendId, cancellationToken); if (userChatFriend != null) { - await UserChatFriendRepository.DeleteAsync(userChatFriend); + await _userChatFriendRepository.DeleteAsync(userChatFriend, cancellationToken: cancellationToken); } } } [UnitOfWork] - public virtual async Task RemoveShieldMemberAsync(Guid? tenantId, Guid userId, Guid friendId) + public virtual async Task RemoveShieldMemberAsync( + Guid? tenantId, + Guid userId, + Guid friendId, + CancellationToken cancellationToken = default) { - await ChangeFriendShieldAsync(tenantId, userId, friendId, false); + await ChangeFriendShieldAsync(tenantId, userId, friendId, false, cancellationToken); } - protected virtual async Task ChangeFriendShieldAsync(Guid? tenantId, Guid userId, Guid friendId, bool isBlack = false) + protected virtual async Task ChangeFriendShieldAsync( + Guid? tenantId, + Guid userId, + Guid friendId, + bool isBlack = false, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - var userChatFriend = await UserChatFriendRepository.FindByUserFriendIdAsync(userId, friendId); + var userChatFriend = await _userChatFriendRepository.FindByUserFriendIdAsync(userId, friendId, cancellationToken); if (userChatFriend != null) { userChatFriend.Black = isBlack; - await UserChatFriendRepository.UpdateAsync(userChatFriend); + await _userChatFriendRepository.UpdateAsync(userChatFriend, cancellationToken: cancellationToken); } } } protected virtual async Task> GetAllFriendByCacheItemAsync( - Guid? tenantId, Guid userId, string sorting = nameof(UserFriend.UserId), - bool reverse = false + bool reverse = false, + CancellationToken cancellationToken = default ) { var cacheKey = UserFriendCacheItem.CalculateCacheKey(userId.ToString()); - Logger.LogDebug($"FriendStore.GetCacheItemAsync: {cacheKey}"); + _logger.LogDebug($"FriendStore.GetCacheItemAsync: {cacheKey}"); - var cacheItem = await Cache.GetAsync(cacheKey); + var cacheItem = await _cache.GetAsync(cacheKey, token: cancellationToken); if (cacheItem != null) { - Logger.LogDebug($"Found in the cache: {cacheKey}"); + _logger.LogDebug($"Found in the cache: {cacheKey}"); return cacheItem.Friends; } - Logger.LogDebug($"Not found in the cache: {cacheKey}"); - using (CurrentTenant.Change(tenantId)) - { - var friends = await UserChatFriendRepository - .GetAllMembersAsync(userId, sorting, reverse); - cacheItem = new UserFriendCacheItem(friends); - Logger.LogDebug($"Set item in the cache: {cacheKey}"); - await Cache.SetAsync(cacheKey, cacheItem); - return friends; - } + _logger.LogDebug($"Not found in the cache: {cacheKey}"); + var friends = await _userChatFriendRepository + .GetAllMembersAsync(userId, sorting, reverse, cancellationToken); + cacheItem = new UserFriendCacheItem(friends); + _logger.LogDebug($"Set item in the cache: {cacheKey}"); + await _cache.SetAsync(cacheKey, cacheItem, token: cancellationToken); + return friends; } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatFriendRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatFriendRepository.cs index af38f03b5..debc5aa57 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatFriendRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatFriendRepository.cs @@ -9,11 +9,16 @@ namespace LINGYUN.Abp.MessageService.Chat { public interface IUserChatFriendRepository : IBasicRepository { - Task IsAddedAsync( + Task IsFriendAsync( Guid userId, Guid frientId, CancellationToken cancellationToken = default); + Task IsAddedAsync( + Guid userId, + Guid frientId, + CancellationToken cancellationToken = default); + Task FindByUserFriendIdAsync( Guid userId, Guid friendId, diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatSettingRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatSettingRepository.cs index 6ad18ae70..4941ec873 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatSettingRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/IUserChatSettingRepository.cs @@ -1,4 +1,5 @@ using System; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; @@ -6,7 +7,7 @@ namespace LINGYUN.Abp.MessageService.Chat { public interface IUserChatSettingRepository : IBasicRepository { - Task UserHasOpendImAsync(Guid userId); - Task FindByUserIdAsync(Guid userId); + Task UserHasOpendImAsync(Guid userId, CancellationToken cancellationToken = default); + Task FindByUserIdAsync(Guid userId, CancellationToken cancellationToken = default); } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/Message.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/Message.cs index 07bf27d25..bee4de691 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/Message.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/Message.cs @@ -1,11 +1,12 @@ using LINGYUN.Abp.IM.Messages; using System; +using Volo.Abp.Data; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.MultiTenancy; namespace LINGYUN.Abp.MessageService.Chat { - public abstract class Message : CreationAuditedEntity, IMultiTenant + public abstract class Message : CreationAuditedAggregateRoot, IMultiTenant { /// /// 租户 diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/MessageStore.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/MessageStore.cs index 42a64f200..d632e16b3 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/MessageStore.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/MessageStore.cs @@ -4,57 +4,72 @@ using LINGYUN.Abp.MessageService.Group; using LINGYUN.Abp.MessageService.Utils; using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp; -using Volo.Abp.Domain.Services; +using Volo.Abp.DependencyInjection; +using Volo.Abp.MultiTenancy; +using Volo.Abp.ObjectExtending; using Volo.Abp.ObjectMapping; using Volo.Abp.Uow; namespace LINGYUN.Abp.MessageService.Chat { - public class MessageStore : DomainService, IMessageStore + public class MessageStore : IMessageStore, ITransientDependency { - private IFriendStore _friendStore; - protected IFriendStore FriendStore => LazyGetRequiredService(ref _friendStore); - - private IObjectMapper _objectMapper; - protected IObjectMapper ObjectMapper => LazyGetRequiredService(ref _objectMapper); - - private IUnitOfWorkManager _unitOfWorkManager; - protected IUnitOfWorkManager UnitOfWorkManager => LazyGetRequiredService(ref _unitOfWorkManager); - protected IUserChatSettingRepository UserChatSettingRepository { get; } - protected IMessageRepository MessageRepository { get; } - protected IGroupRepository GroupRepository { get; } - protected ISnowflakeIdGenerator SnowflakeIdGenerator { get; } + private readonly IFriendStore _friendStore; + + private readonly IObjectMapper _objectMapper; + + private readonly ICurrentTenant _currentTenant; + + private readonly IUnitOfWorkManager _unitOfWorkManager; + + private readonly IGroupRepository _groupRepository; + + private readonly IMessageRepository _messageRepository; + + private readonly ISnowflakeIdGenerator _snowflakeIdGenerator; + + private readonly IUserChatSettingRepository _userChatSettingRepository; public MessageStore( + IFriendStore friendStore, + IObjectMapper objectMapper, + ICurrentTenant currentTenant, + IUnitOfWorkManager unitOfWorkManager, IGroupRepository groupRepository, IMessageRepository messageRepository, ISnowflakeIdGenerator snowflakeIdGenerator, IUserChatSettingRepository userChatSettingRepository) { - GroupRepository = groupRepository; - MessageRepository = messageRepository; - SnowflakeIdGenerator = snowflakeIdGenerator; - UserChatSettingRepository = userChatSettingRepository; + _friendStore = friendStore; + _objectMapper = objectMapper; + _currentTenant = currentTenant; + _unitOfWorkManager = unitOfWorkManager; + _groupRepository = groupRepository; + _messageRepository = messageRepository; + _snowflakeIdGenerator = snowflakeIdGenerator; + _userChatSettingRepository = userChatSettingRepository; } - [UnitOfWork] - public virtual async Task StoreMessageAsync(ChatMessage chatMessage) + public virtual async Task StoreMessageAsync( + ChatMessage chatMessage, + CancellationToken cancellationToken = default) { - using (var unitOfWork = UnitOfWorkManager.Begin()) + using (var unitOfWork = _unitOfWorkManager.Begin()) { - using (CurrentTenant.Change(chatMessage.TenantId)) + using (_currentTenant.Change(chatMessage.TenantId)) { if (!chatMessage.GroupId.IsNullOrWhiteSpace()) { long groupId = long.Parse(chatMessage.GroupId); - await StoreGroupMessageAsync(chatMessage, groupId); + await StoreGroupMessageAsync(chatMessage, groupId, cancellationToken); } else { - await StoreUserMessageAsync(chatMessage); + await StoreUserMessageAsync(chatMessage, cancellationToken); } - await unitOfWork.SaveChangesAsync(); + await unitOfWork.SaveChangesAsync(cancellationToken); } } } @@ -67,13 +82,15 @@ namespace LINGYUN.Abp.MessageService.Chat bool reverse = true, MessageType? type = null, int skipCount = 0, - int maxResultCount = 10) + int maxResultCount = 10, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - var groupMessages = await MessageRepository - .GetGroupMessagesAsync(groupId, filter, sorting, reverse, type, skipCount, maxResultCount); - var chatMessages = ObjectMapper.Map, List>(groupMessages); + var groupMessages = await _messageRepository + .GetGroupMessagesAsync(groupId, filter, sorting, reverse, type, skipCount, maxResultCount, cancellationToken); + + var chatMessages = _objectMapper.Map, List>(groupMessages); return chatMessages; } @@ -88,13 +105,15 @@ namespace LINGYUN.Abp.MessageService.Chat bool reverse = true, MessageType? type = null, int skipCount = 0, - int maxResultCount = 10) + int maxResultCount = 10, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - var userMessages = await MessageRepository - .GetUserMessagesAsync(sendUserId, receiveUserId, filter, sorting, reverse, type, skipCount, maxResultCount); - var chatMessages = ObjectMapper.Map, List>(userMessages); + var userMessages = await _messageRepository + .GetUserMessagesAsync(sendUserId, receiveUserId, filter, sorting, reverse, type, skipCount, maxResultCount, cancellationToken); + + var chatMessages = _objectMapper.Map, List>(userMessages); return chatMessages; } @@ -105,13 +124,14 @@ namespace LINGYUN.Abp.MessageService.Chat Guid userId, string sorting = nameof(LastChatMessage.SendTime), bool reverse = true, - int maxResultCount = 10 + int maxResultCount = 10, + CancellationToken cancellationToken = default ) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - return await MessageRepository - .GetLastMessagesByOneFriendAsync(userId, sorting, reverse, maxResultCount); + return await _messageRepository + .GetLastMessagesByOneFriendAsync(userId, sorting, reverse, maxResultCount, cancellationToken); } } @@ -119,11 +139,12 @@ namespace LINGYUN.Abp.MessageService.Chat Guid? tenantId, long groupId, string filter = "", - MessageType? type = null) + MessageType? type = null, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - return await MessageRepository.GetCountAsync(groupId, filter, type); + return await _messageRepository.GetCountAsync(groupId, filter, type, cancellationToken); } } @@ -132,15 +153,18 @@ namespace LINGYUN.Abp.MessageService.Chat Guid sendUserId, Guid receiveUserId, string filter = "", - MessageType? type = null) + MessageType? type = null, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - return await MessageRepository.GetCountAsync(sendUserId, receiveUserId, filter, type); + return await _messageRepository.GetCountAsync(sendUserId, receiveUserId, filter, type, cancellationToken); } } - protected virtual async Task StoreUserMessageAsync(ChatMessage chatMessage) + protected virtual async Task StoreUserMessageAsync( + ChatMessage chatMessage, + CancellationToken cancellationToken = default) { // 检查接收用户 if (!chatMessage.ToUserId.HasValue) @@ -148,9 +172,12 @@ namespace LINGYUN.Abp.MessageService.Chat throw new BusinessException(MessageServiceErrorCodes.UseNotFount); } - var myFriend = await FriendStore.GetMemberAsync(chatMessage.TenantId, chatMessage.ToUserId.Value, chatMessage.FormUserId); + var myFriend = await _friendStore + .GetMemberAsync(chatMessage.TenantId, chatMessage.ToUserId.Value, chatMessage.FormUserId, cancellationToken); + + var userChatSetting = await _userChatSettingRepository + .FindByUserIdAsync(chatMessage.ToUserId.Value, cancellationToken); - var userChatSetting = await UserChatSettingRepository.FindByUserIdAsync(chatMessage.ToUserId.Value); if (userChatSetting != null) { if (!userChatSetting.AllowReceiveMessage) @@ -181,24 +208,30 @@ namespace LINGYUN.Abp.MessageService.Chat { throw new BusinessException(MessageServiceErrorCodes.UserHasBlack); } - var messageId = SnowflakeIdGenerator.Create(); + var messageId = _snowflakeIdGenerator.Create(); var message = new UserMessage(messageId, chatMessage.FormUserId, chatMessage.FormUserName, chatMessage.Content, chatMessage.MessageType); + message.SendToUser(chatMessage.ToUserId.Value); - await MessageRepository.InsertUserMessageAsync(message); + chatMessage.MapExtraPropertiesTo(message); + + await _messageRepository.InsertUserMessageAsync(message, cancellationToken); chatMessage.MessageId = messageId.ToString(); } - protected virtual async Task StoreGroupMessageAsync(ChatMessage chatMessage, long groupId) + protected virtual async Task StoreGroupMessageAsync( + ChatMessage chatMessage, + long groupId, + CancellationToken cancellationToken = default) { - var userHasBlacked = await GroupRepository - .UserHasBlackedAsync(groupId, chatMessage.FormUserId); + var userHasBlacked = await _groupRepository + .UserHasBlackedAsync(groupId, chatMessage.FormUserId, cancellationToken); if (userHasBlacked) { // 当前发送的用户已被拉黑 throw new BusinessException(MessageServiceErrorCodes.GroupUserHasBlack); } - var group = await GroupRepository.GetByIdAsync(groupId); + var group = await _groupRepository.GetByIdAsync(groupId, cancellationToken); if (!group.AllowSendMessage) { // 当前群组不允许发言 @@ -209,11 +242,13 @@ namespace LINGYUN.Abp.MessageService.Chat // 当前群组不允许匿名发言 throw new BusinessException(MessageServiceErrorCodes.GroupNotAllowedToSpeakAnonymously); } - var messageId = SnowflakeIdGenerator.Create(); + var messageId = _snowflakeIdGenerator.Create(); var message = new GroupMessage(messageId, chatMessage.FormUserId, chatMessage.FormUserName, chatMessage.Content, chatMessage.MessageType); message.SendToGroup(groupId); - await MessageRepository.InsertGroupMessageAsync(message); + chatMessage.MapExtraPropertiesTo(message); + + await _messageRepository.InsertGroupMessageAsync(message, cancellationToken); chatMessage.MessageId = messageId.ToString(); } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserCardFinder.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserCardFinder.cs index 661e0b9bb..8f8a50711 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserCardFinder.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserCardFinder.cs @@ -2,34 +2,38 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Volo.Abp.Domain.Services; +using Volo.Abp.DependencyInjection; +using Volo.Abp.MultiTenancy; namespace LINGYUN.Abp.MessageService.Chat { - public class UserCardFinder : DomainService, IUserCardFinder + public class UserCardFinder : IUserCardFinder, ITransientDependency { - protected IUserChatCardRepository UserChatCardRepository { get; } + private readonly ICurrentTenant _currentTenant; + private readonly IUserChatCardRepository _userChatCardRepository; public UserCardFinder( + ICurrentTenant currentTenant, IUserChatCardRepository userChatCardRepository) { - UserChatCardRepository = userChatCardRepository; + _currentTenant = currentTenant; + _userChatCardRepository = userChatCardRepository; } public virtual async Task GetCountAsync(Guid? tenantId, string findUserName = "", int? startAge = null, int? endAge = null, Sex? sex = null) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - return await UserChatCardRepository + return await _userChatCardRepository .GetMemberCountAsync(findUserName, startAge, endAge, sex); } } public virtual async Task> GetListAsync(Guid? tenantId, string findUserName = "", int? startAge = null, int? endAge = null, Sex? sex = null, string sorting = nameof(UserCard.UserId), bool reverse = false, int skipCount = 0, int maxResultCount = 10) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - return await UserChatCardRepository + return await _userChatCardRepository .GetMembersAsync(findUserName, startAge, endAge, sex, sorting, reverse, skipCount, maxResultCount); } @@ -37,9 +41,9 @@ namespace LINGYUN.Abp.MessageService.Chat public virtual async Task GetMemberAsync(Guid? tenantId, Guid findUserId) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - return await UserChatCardRepository + return await _userChatCardRepository .GetMemberAsync(findUserId); } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriend.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriend.cs index d964aa0cc..a7e434c08 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriend.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserChatFriend.cs @@ -35,6 +35,10 @@ namespace LINGYUN.Abp.MessageService.Chat /// 备注名称 /// public virtual string RemarkName { get; set; } + /// + /// 附加说明 + /// + public virtual string Description { get; set; } public virtual UserFriendStatus Status { get; protected set; } @@ -46,19 +50,20 @@ namespace LINGYUN.Abp.MessageService.Chat Guid userId, Guid friendId, string remarkName = "", - UserFriendStatus status = UserFriendStatus.NeedValidation, + string description = "", Guid? tenantId = null) { UserId = userId; FrientId = friendId; RemarkName = remarkName; - Status = status; TenantId = tenantId; + Description = description; + Status = UserFriendStatus.NeedValidation; } public void SetStatus(UserFriendStatus status = UserFriendStatus.NeedValidation) { - if (Status == UserFriendStatus.NeedValidation && status == UserFriendStatus.NeedValidation) + if (Status == UserFriendStatus.NeedValidation && status == UserFriendStatus.Added) { // 如果是后续验证通过的需要单独的事件 AddLocalEvent(new UserChatFriendEto diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserChatFriendEventHandler.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserChatFriendEventHandler.cs index 5af42b75a..3f1bf0bc7 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserChatFriendEventHandler.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserChatFriendEventHandler.cs @@ -1,13 +1,18 @@ using LINGYUN.Abp.IM.Messages; using LINGYUN.Abp.MessageService.Chat; +using LINGYUN.Abp.MessageService.Localization; +using LINGYUN.Abp.MessageService.Notifications; using LINGYUN.Abp.Notifications; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Localization; using System; +using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp.Caching; 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.Local { @@ -18,30 +23,32 @@ namespace LINGYUN.Abp.MessageService.EventBus.Local ILocalEventHandler, ITransientDependency { - private ILogger _logger; + private IStringLocalizer _stringLocalizer; private IMessageSender _messageSender; - private INotificationDispatcher _dispatcher; + private INotificationSender _notificationSender; private IDistributedCache _cache; + private ICurrentUser _currentUser; public UserChatFriendEventHandler( + ICurrentUser currentUser, IMessageSender messageSender, - INotificationDispatcher dispatcher, - ILogger logger) + INotificationSender notificationSender, + IDistributedCache cache, + IStringLocalizer stringLocalizer) { - _logger = logger; - _dispatcher = dispatcher; + _cache = cache; + _currentUser = currentUser; _messageSender = messageSender; + _stringLocalizer = stringLocalizer; + _notificationSender = notificationSender; } public virtual async Task HandleEventAsync(EntityCreatedEventData eventData) { switch (eventData.Entity.Status) { - case IM.Contract.UserFriendStatus.Added: - await SendFriendAddedMessageAsync(eventData.Entity.UserId, eventData.Entity.FrientId, eventData.Entity.TenantId); - break; case IM.Contract.UserFriendStatus.NeedValidation: - await SendFriendValidationNotiferAsync(eventData.Entity.UserId, eventData.Entity.FrientId, eventData.Entity.TenantId); + await SendFriendValidationNotifierAsync(eventData.Entity); break; } await RemoveUserFriendCacheItemAsync(eventData.Entity.UserId); @@ -68,11 +75,51 @@ namespace LINGYUN.Abp.MessageService.EventBus.Local protected virtual async Task SendFriendAddedMessageAsync(Guid userId, Guid friendId, Guid? tenantId = null) { // 发送添加好友的第一条消息 + + var addNewFirendMessage = new ChatMessage + { + TenantId = tenantId, + FormUserId = _currentUser.GetId(), // 本地事件中可以获取到当前用户信息 + FormUserName = _currentUser.UserName, + SendTime = DateTime.Now, + MessageType = MessageType.Text, + ToUserId = friendId, + Content = _stringLocalizer["Messages:NewFriend"] + }; + + await _messageSender.SendMessageAsync(addNewFirendMessage); } - protected virtual async Task SendFriendValidationNotiferAsync(Guid userId, Guid friendId, Guid? tenantId = null) + protected virtual async Task SendFriendValidationNotifierAsync(UserChatFriend userChatFriend) { // 发送好友验证通知 + var userIdentifer = new UserIdentifier(userChatFriend.FrientId, userChatFriend.RemarkName); + + var friendValidationNotifictionData = new NotificationData(); + friendValidationNotifictionData + .WriteLocalizedData( + new LocalizableStringInfo( + LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), + "Notifications:FriendValidation"), + new LocalizableStringInfo( + LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), + "Notifications:RequestAddNewFriend", + new Dictionary { { "name", _currentUser.UserName } }), + DateTime.Now, + _currentUser.UserName, + new LocalizableStringInfo( + LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), + "Notifications:RequestAddNewFriendDetail", + new Dictionary { { "description", userChatFriend.Description } })); + friendValidationNotifictionData.TrySetData("userId", userChatFriend.UserId); + friendValidationNotifictionData.TrySetData("frientId", userChatFriend.FrientId); + + await _notificationSender + .SendNofiterAsync( + MessageServiceNotificationNames.IM.FriendValidation, + friendValidationNotifictionData, + userIdentifer, + userChatFriend.TenantId); } protected virtual async Task RemoveUserFriendCacheItemAsync(Guid userId) diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateJoinIMEventHandler.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateJoinIMEventHandler.cs index 7ca3728c6..d04b5aa68 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateJoinIMEventHandler.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateJoinIMEventHandler.cs @@ -1,8 +1,11 @@ using LINGYUN.Abp.MessageService.Chat; +using LINGYUN.Abp.MessageService.Notifications; +using LINGYUN.Abp.Notifications; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities.Events; using Volo.Abp.EventBus; +using Volo.Abp.Uow; using Volo.Abp.Users; namespace LINGYUN.Abp.MessageService.EventBus.Distributed @@ -10,19 +13,45 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed public class UserCreateJoinIMEventHandler : ILocalEventHandler>, ITransientDependency { private readonly IChatDataSeeder _chatDataSeeder; + private readonly INotificationSubscriptionManager _notificationSubscriptionManager; public UserCreateJoinIMEventHandler( - IChatDataSeeder chatDataSeeder) + IChatDataSeeder chatDataSeeder, + INotificationSubscriptionManager notificationSubscriptionManager) { _chatDataSeeder = chatDataSeeder; + _notificationSubscriptionManager = notificationSubscriptionManager; } /// /// 接收添加用户事件,初始化IM用户种子 /// /// /// - public async Task HandleEventAsync(EntityCreatedEventData eventData) + [UnitOfWork] + public virtual async Task HandleEventAsync(EntityCreatedEventData eventData) { - await _chatDataSeeder.SeedAsync(eventData.Entity); + await SeedChatDataAsync(eventData.Entity); + } + + protected virtual async Task SeedChatDataAsync(IUserData user) + { + await _chatDataSeeder.SeedAsync(user); + } + + protected virtual async Task SeedUserSubscriptionNotifiersAsync(IUserData user) + { + var userIdentifier = new UserIdentifier(user.Id, user.UserName); + + await _notificationSubscriptionManager + .SubscribeAsync( + user.TenantId, + userIdentifier, + MessageServiceNotificationNames.IM.FriendValidation); + + await _notificationSubscriptionManager + .SubscribeAsync( + user.TenantId, + userIdentifier, + MessageServiceNotificationNames.IM.NewFriend); } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateSendWelcomeEventHandler.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateSendWelcomeEventHandler.cs index d2b53d23a..f396b3c1a 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateSendWelcomeEventHandler.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateSendWelcomeEventHandler.cs @@ -1,126 +1,63 @@ using LINGYUN.Abp.MessageService.Localization; using LINGYUN.Abp.Notifications; -using Microsoft.Extensions.Localization; using System; -using System.Globalization; 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.Settings; using Volo.Abp.Users; namespace LINGYUN.Abp.MessageService.EventBus { public class UserCreateSendWelcomeEventHandler : ILocalEventHandler>, ITransientDependency { - private readonly ISettingProvider _settingProvider; - private readonly IStringLocalizer _stringLocalizer; - - private readonly INotificationDispatcher _notificationDispatcher; + private readonly INotificationSender _notificationSender; private readonly INotificationSubscriptionManager _notificationSubscriptionManager; - - // 需要模拟用户令牌 - // 是否有必要 - // private readonly ICurrentPrincipalAccessor _currentPrincipalAccessor; public UserCreateSendWelcomeEventHandler( - ISettingProvider settingProvider, - INotificationDispatcher notificationDispatcher, - IStringLocalizer stringLocalizer, + INotificationSender notificationSender, INotificationSubscriptionManager notificationSubscriptionManager - //ICurrentPrincipalAccessor currentPrincipalAccessor ) { - _settingProvider = settingProvider; - _stringLocalizer = stringLocalizer; - - _notificationDispatcher = notificationDispatcher; + _notificationSender = notificationSender; _notificationSubscriptionManager = notificationSubscriptionManager; - - //_currentPrincipalAccessor = currentPrincipalAccessor; } public async Task HandleEventAsync(EntityCreatedEventData eventData) { - // 获取默认语言 - var userDefaultCultureName = await _settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage); - if (userDefaultCultureName.IsNullOrWhiteSpace()) - { - userDefaultCultureName = CultureInfo.CurrentUICulture.Name; - // CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo(userDefaultCultureName); - } - using (CultureHelper.Use(userDefaultCultureName, userDefaultCultureName)) - { - var userIdentifer = new UserIdentifier(eventData.Entity.Id, eventData.Entity.UserName); - // 订阅用户欢迎消息 - await _notificationSubscriptionManager.SubscribeAsync(eventData.Entity.TenantId, - userIdentifer, UserNotificationNames.WelcomeToApplication); - - // Store未检查已订阅 - //await _notificationStore.InsertUserSubscriptionAsync(eventData.Entity.TenantId, - // userIdentifer, UserNotificationNames.WelcomeToApplication); - - var userWelcomeNotifictionData = NotificationData.CreateUserNotificationData(eventData.Entity.Id, eventData.Entity.UserName); - - userWelcomeNotifictionData.WriteStandardData( - L("WelcomeToApplicationFormUser", eventData.Entity.Name ?? eventData.Entity.UserName), - L("WelcomeToApplicationFormUser", eventData.Entity.Name ?? eventData.Entity.UserName), + 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); - // 换成用户名称,而不是用户名 - // userWelcomeNotifictionData.Properties["message"] = L("WelcomeToApplicationFormUser", eventData.Entity.Name); - - var noticeNormalizerName = NotificationNameNormalizer.NormalizerName(UserNotificationNames.WelcomeToApplication); - await _notificationDispatcher.DispatchAsync(noticeNormalizerName, userWelcomeNotifictionData, eventData.Entity.TenantId); - } - } - - //public async Task HandleEventAsync(EntityCreatedEventData eventData) - //{ - // // 模拟用户令牌 - // var mockUserPrincipal = new ClaimsPrincipal(); - // var mockUserIdentity = new ClaimsIdentity(); - // mockUserIdentity.AddClaim(new Claim(AbpClaimTypes.UserId, eventData.Entity.Id.ToString())); - // mockUserIdentity.AddClaim(new Claim(AbpClaimTypes.UserName, eventData.Entity.UserName)); - // mockUserIdentity.AddClaim(new Claim(AbpClaimTypes.Email, eventData.Entity.Email)); - // mockUserIdentity.AddClaim(new Claim(AbpClaimTypes.PhoneNumber, eventData.Entity.PhoneNumber)); - // if (eventData.Entity.TenantId.HasValue) - // { - // mockUserIdentity.AddClaim(new Claim(AbpClaimTypes.TenantId, eventData.Entity.TenantId.ToString())); - // } - - // mockUserPrincipal.AddIdentity(mockUserIdentity); - // using (_currentPrincipalAccessor.Change(mockUserPrincipal)) - // { - // // 获取默认语言 - // // TODO: 是否采用系统默认语言而不是用户默认语言? - // var userDefaultCultureName = await _settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage); - // if (!userDefaultCultureName.IsNullOrWhiteSpace()) - // { - // CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo(userDefaultCultureName); - // } - // // 订阅用户欢迎消息 - // 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); - // } - //} - - protected string L(string name, params object[] args) - { - return _stringLocalizer[name, args]?.Value; + await _notificationSender + .SendNofiterAsync( + UserNotificationNames.WelcomeToApplication, + userWelcomeNotifictionData, + userIdentifer, + eventData.Entity.TenantId, + NotificationSeverity.Info + ); } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/UserGroupStore.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/UserGroupStore.cs index af94512e6..1bb3a9191 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/UserGroupStore.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Group/UserGroupStore.cs @@ -1,102 +1,131 @@ using LINGYUN.Abp.IM.Group; using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; -using Volo.Abp.Domain.Services; +using Volo.Abp.DependencyInjection; +using Volo.Abp.MultiTenancy; using Volo.Abp.ObjectMapping; using Volo.Abp.Uow; namespace LINGYUN.Abp.MessageService.Group { - public class UserGroupStore : DomainService, IUserGroupStore + public class UserGroupStore : IUserGroupStore, ITransientDependency { - private IObjectMapper _objectMapper; - protected IObjectMapper ObjectMapper => LazyGetRequiredService(ref _objectMapper); - - private IUnitOfWorkManager _unitOfWorkManager; - protected IUnitOfWorkManager UnitOfWorkManager => LazyGetRequiredService(ref _unitOfWorkManager); - - protected IUserChatGroupRepository UserChatGroupRepository { get; } + private readonly IObjectMapper _objectMapper; + private readonly ICurrentTenant _currentTenant; + private readonly IUnitOfWorkManager _unitOfWorkManager; + private readonly IUserChatGroupRepository _userChatGroupRepository; public UserGroupStore( + IObjectMapper objectMapper, + ICurrentTenant currentTenant, + IUnitOfWorkManager unitOfWorkManager, IUserChatGroupRepository userChatGroupRepository) { - UserChatGroupRepository = userChatGroupRepository; + _objectMapper = objectMapper; + _currentTenant = currentTenant; + _unitOfWorkManager = unitOfWorkManager; + _userChatGroupRepository = userChatGroupRepository; } - public virtual async Task MemberHasInGroupAsync(Guid? tenantId, long groupId, Guid userId) + public virtual async Task MemberHasInGroupAsync( + Guid? tenantId, + long groupId, + Guid userId, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - return await UserChatGroupRepository.MemberHasInGroupAsync(groupId, userId); + return await _userChatGroupRepository.MemberHasInGroupAsync(groupId, userId, cancellationToken); } } - [UnitOfWork] - public virtual async Task AddUserToGroupAsync(Guid? tenantId, Guid userId, long groupId, Guid acceptUserId) + public virtual async Task AddUserToGroupAsync( + Guid? tenantId, + Guid userId, + long groupId, + Guid acceptUserId, + CancellationToken cancellationToken = default) { - using (var unitOfWork = UnitOfWorkManager.Begin()) + using (var unitOfWork = _unitOfWorkManager.Begin()) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - var userHasInGroup = await UserChatGroupRepository.MemberHasInGroupAsync(groupId, userId); + var userHasInGroup = await _userChatGroupRepository.MemberHasInGroupAsync(groupId, userId, cancellationToken); if (!userHasInGroup) { var userGroup = new UserChatGroup(groupId, userId, acceptUserId, tenantId); - await UserChatGroupRepository.InsertAsync(userGroup); + await _userChatGroupRepository.InsertAsync(userGroup, cancellationToken: cancellationToken); - await unitOfWork.SaveChangesAsync(); + await unitOfWork.SaveChangesAsync(cancellationToken); } } } } - public async Task GetUserGroupCardAsync(Guid? tenantId, long groupId, Guid userId) + public async Task GetUserGroupCardAsync( + Guid? tenantId, + long groupId, + Guid userId, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - var groupUserCard = await UserChatGroupRepository.GetMemberAsync(groupId, userId); + var groupUserCard = await _userChatGroupRepository.GetMemberAsync(groupId, userId, cancellationToken); return groupUserCard; } } - public async Task> GetMembersAsync(Guid? tenantId, long groupId) + public async Task> GetMembersAsync( + Guid? tenantId, + long groupId, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - return await UserChatGroupRepository.GetMembersAsync(groupId); + return await _userChatGroupRepository.GetMembersAsync(groupId, cancellationToken: cancellationToken); } } - public async Task> GetUserGroupsAsync(Guid? tenantId, Guid userId) + public async Task> GetUserGroupsAsync( + Guid? tenantId, + Guid userId, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - return await UserChatGroupRepository.GetMemberGroupsAsync(userId); + return await _userChatGroupRepository.GetMemberGroupsAsync(userId, cancellationToken); } } - [UnitOfWork] - public async Task RemoveUserFormGroupAsync(Guid? tenantId, Guid userId, long groupId) + public async Task RemoveUserFormGroupAsync( + Guid? tenantId, + Guid userId, + long groupId, + CancellationToken cancellationToken = default) { - using (var unitOfWork = UnitOfWorkManager.Begin()) + using (var unitOfWork = _unitOfWorkManager.Begin()) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - await UserChatGroupRepository.RemoveMemberFormGroupAsync(groupId, userId); + await _userChatGroupRepository.RemoveMemberFormGroupAsync(groupId, userId, cancellationToken); - await unitOfWork.SaveChangesAsync(); + await unitOfWork.SaveChangesAsync(cancellationToken); } } } - public async Task GetMembersCountAsync(Guid? tenantId, long groupId) + public async Task GetMembersCountAsync( + Guid? tenantId, + long groupId, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - return await UserChatGroupRepository.GetMembersCountAsync(groupId); + return await _userChatGroupRepository.GetMembersCountAsync(groupId, cancellationToken); } } @@ -106,11 +135,12 @@ namespace LINGYUN.Abp.MessageService.Group string sorting = nameof(GroupUserCard.UserId), bool reverse = false, int skipCount = 0, - int maxResultCount = 10) + int maxResultCount = 10, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - return await UserChatGroupRepository.GetMembersAsync(groupId, sorting, reverse, skipCount, maxResultCount); + return await _userChatGroupRepository.GetMembersAsync(groupId, sorting, reverse, skipCount, maxResultCount, cancellationToken); } } } 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 index 3bb80c584..bc5f0a3ef 100644 --- 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 @@ -18,8 +18,20 @@ "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!", - "WelcomeToApplicationNotification": "User Welcome Notice", - "NewTenantRegisterdNotification": "Tenants create notification", - "WelcomeToApplicationFormUser": "User :{0} welcome to join us!" + "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 index b6f29bbcb..1f6a464e4 100644 --- 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 @@ -18,8 +18,20 @@ "LINGYUN.Abp.Message:03404": "发送消息失败: 用户不存在或已注销账号!", "LINGYUN.Abp.Message:03410": "用户拒绝添加好友", "LINGYUN.Abp.Message:03411": "对方已是您的好友或已发送验证请求,不能重复操作!", - "WelcomeToApplicationNotification": "用户欢迎通知", - "NewTenantRegisterdNotification": "租户创建通知", - "WelcomeToApplicationFormUser": "用户:{0} 欢迎您的加入!" + "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.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs index 8afedf49d..3e2068b0b 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs @@ -1,11 +1,14 @@ using AutoMapper; using LINGYUN.Abp.IM.Messages; using LINGYUN.Abp.MessageService.Chat; +using LINGYUN.Abp.MessageService.Group; using LINGYUN.Abp.MessageService.Notifications; using LINGYUN.Abp.MessageService.Subscriptions; using LINGYUN.Abp.Notifications; using Newtonsoft.Json; using System; +using Volo.Abp.AutoMapper; +using Volo.Abp.Data; namespace LINGYUN.Abp.MessageService.Mapper { @@ -13,58 +16,62 @@ namespace LINGYUN.Abp.MessageService.Mapper { public MessageServiceDomainAutoMapperProfile() { + //CreateMap() + // .ForMember(dto => dto.Id, map => map.MapFrom(src => src.NotificationId)) + // .ForMember(dto => dto.Name, map => map.MapFrom(src => src.NotificationName)) + // .ForMember(dto => dto.Lifetime, map => map.Ignore()) + // .ForMember(dto => dto.Type, map => map.MapFrom(src => src.Type)) + // .ForMember(dto => dto.Severity, map => map.MapFrom(src => src.Severity)) + // .ForMember(dto => dto.Data, map => map.MapFrom((src, nfi) => + // { + // var dataType = Type.GetType(src.NotificationTypeName); + // var data = JsonConvert.DeserializeObject(src.NotificationData, dataType); + // if(data != null && data is NotificationData notificationData) + // { + // if (notificationData.NeedLocalizer()) + // { + // var title = JsonConvert.DeserializeObject(notificationData.TryGetData("title").ToString()); + // var message = JsonConvert.DeserializeObject(notificationData.TryGetData("message").ToString()); + // notificationData.TrySetData("title", title); + // notificationData.TrySetData("message", message); + // } + // return notificationData; + // } + // return new NotificationData(); + // })); + CreateMap() - .ForMember(dto => dto.Id, map => map.MapFrom(src => src.NotificationId)) - .ForMember(dto => dto.Name, map => map.MapFrom(src => src.NotificationName)) - .ForMember(dto => dto.CateGory, map => map.MapFrom(src => src.NotificationCateGory)) - .ForMember(dto => dto.Lifetime, map => map.Ignore()) - .ForMember(dto => dto.NotificationType, map => map.MapFrom(src => src.Type)) - .ForMember(dto => dto.NotificationSeverity, map => map.MapFrom(src => src.Severity)) - .ForMember(dto => dto.Data, map => map.MapFrom((src, nfi) => - { - var notificationDataType = Type.GetType(src.NotificationTypeName); - var notificationData = JsonConvert.DeserializeObject(src.NotificationData, notificationDataType); - if(notificationData != null) - { - return notificationData as NotificationData; - } - return new NotificationData(); - })); + .ConvertUsing(); CreateMap(); - CreateMap() + CreateMessageMap() .ForMember(dto => dto.Content, map => map.MapFrom(src => src.Content)) .ForMember(dto => dto.GroupId, map => map.MapFrom(src => src.GroupId.ToString())) - .ForMember(dto => dto.MessageId, map => map.MapFrom(src => src.MessageId.ToString())) - .ForMember(dto => dto.FormUserId, map => map.MapFrom(src => src.CreatorId)) - .ForMember(dto => dto.FormUserName, map => map.MapFrom(src => src.SendUserName)) - .ForMember(dto => dto.SendTime, map => map.MapFrom(src => src.CreationTime)) - .ForMember(dto => dto.MessageType, map => map.MapFrom(src => src.Type)) - .ForMember(dto => dto.IsAnonymous, map => map.Ignore()) - .ForMember(dto => dto.ToUserId, map => map.Ignore()); + .Ignore(dto => dto.ToUserId); - CreateMap() - .ForMember(dto => dto.Content, map => map.MapFrom(src => src.Content)) - .ForMember(dto => dto.ToUserId, map => map.MapFrom(src => src.ReceiveUserId)) - .ForMember(dto => dto.MessageId, map => map.MapFrom(src => src.MessageId.ToString())) - .ForMember(dto => dto.FormUserId, map => map.MapFrom(src => src.CreatorId)) - .ForMember(dto => dto.FormUserName, map => map.MapFrom(src => src.SendUserName)) - .ForMember(dto => dto.SendTime, map => map.MapFrom(src => src.CreationTime)) - .ForMember(dto => dto.MessageType, map => map.MapFrom(src => src.Type)) - .ForMember(dto => dto.IsAnonymous, map => map.Ignore()) - .ForMember(dto => dto.GroupId, map => map.Ignore()); + CreateMessageMap() + .ForMember(dto => dto.ToUserId, map => map.MapFrom(src => src.ReceiveUserId)) + .Ignore(dto => dto.GroupId); - CreateMap() + CreateMessageMap() + .ForMember(dto => dto.ToUserId, map => map.MapFrom(src => src.ReceiveUserId)) + .Ignore(dto => dto.GroupId); + } + + protected IMappingExpression CreateMessageMap() + where TSource : Message + where TDestination : ChatMessage + { + return CreateMap() .ForMember(dto => dto.Content, map => map.MapFrom(src => src.Content)) - .ForMember(dto => dto.ToUserId, map => map.MapFrom(src => src.ReceiveUserId)) .ForMember(dto => dto.MessageId, map => map.MapFrom(src => src.MessageId.ToString())) .ForMember(dto => dto.FormUserId, map => map.MapFrom(src => src.CreatorId)) .ForMember(dto => dto.FormUserName, map => map.MapFrom(src => src.SendUserName)) .ForMember(dto => dto.SendTime, map => map.MapFrom(src => src.CreationTime)) .ForMember(dto => dto.MessageType, map => map.MapFrom(src => src.Type)) - .ForMember(dto => dto.IsAnonymous, map => map.Ignore()) - .ForMember(dto => dto.GroupId, map => map.Ignore()); + .ForMember(dto => dto.IsAnonymous, map => map.MapFrom(src => src.GetProperty(nameof(ChatMessage.IsAnonymous), false))) + .MapExtraProperties(); } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/NotificationTypeConverter.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/NotificationTypeConverter.cs new file mode 100644 index 000000000..5c7936b31 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/NotificationTypeConverter.cs @@ -0,0 +1,39 @@ +using AutoMapper; +using LINGYUN.Abp.MessageService.Notifications; +using LINGYUN.Abp.Notifications; +using Newtonsoft.Json; +using System; +using Volo.Abp; +using Volo.Abp.DependencyInjection; + +namespace LINGYUN.Abp.MessageService.Mapper +{ + public class NotificationTypeConverter : ITypeConverter, ISingletonDependency + { + public NotificationInfo Convert(Notification source, NotificationInfo destination, ResolutionContext context) + { + destination = new NotificationInfo + { + Name = source.NotificationName, + Type = source.Type, + Severity = source.Severity + }; + destination.SetId(source.NotificationId); + + var dataType = Type.GetType(source.NotificationTypeName); + Check.NotNull(dataType, source.NotificationTypeName); + + var data = JsonConvert.DeserializeObject(source.NotificationData, dataType); + if (data != null && data is NotificationData notificationData) + { + destination.Data = NotificationDataConverter.Convert(notificationData); + } + else + { + destination.Data = new NotificationData(); + destination.Data.TrySetData("data", source.NotificationData); + } + return destination; + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/AbpMessageServiceNotificationDefinitionProvider.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/AbpMessageServiceNotificationDefinitionProvider.cs index 493cf83d0..5964af111 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/AbpMessageServiceNotificationDefinitionProvider.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/AbpMessageServiceNotificationDefinitionProvider.cs @@ -10,20 +10,71 @@ namespace LINGYUN.Abp.MessageService.Notifications { public override void Define(INotificationDefinitionContext context) { - context.Add(new NotificationDefinition( - UserNotificationNames.WelcomeToApplication, - L("WelcomeToApplicationNotification"), - L("WelcomeToApplicationNotification"), + var tenantsGroup = context.AddGroup( + TenantNotificationNames.GroupName, + L("Notifications:MultiTenancy"), + false); + + tenantsGroup.AddNotification( + TenantNotificationNames.NewTenantRegistered, + L("Notifications:NewTenantRegisterd"), + L("Notifications:NewTenantRegisterd"), notificationType: NotificationType.System, lifetime: NotificationLifetime.OnlyOne, - allowSubscriptionToClients: true)); - context.Add(new NotificationDefinition( - TenantNotificationNames.NewTenantRegistered, - L("NewTenantRegisterdNotification"), - L("NewTenantRegisterdNotification"), + allowSubscriptionToClients: false + ) + .WithProviders(); + + var usersGroup = context.AddGroup( + UserNotificationNames.GroupName, + L("Notifications:Users")); + + usersGroup.AddNotification( + UserNotificationNames.WelcomeToApplication, + L("Notifications:WelcomeToApplication"), + L("Notifications:WelcomeToApplication"), notificationType: NotificationType.System, lifetime: NotificationLifetime.OnlyOne, - allowSubscriptionToClients: true)); + allowSubscriptionToClients: true); + + var imGroup = context.AddGroup( + MessageServiceNotificationNames.IM.GroupName, + L("Notifications:IM")); + imGroup.AddNotification( + MessageServiceNotificationNames.IM.FriendValidation, + L("Notifications:FriendValidation"), + L("Notifications:FriendValidation"), + notificationType: NotificationType.System, + lifetime: NotificationLifetime.Persistent, + allowSubscriptionToClients: true); + imGroup.AddNotification( + MessageServiceNotificationNames.IM.NewFriend, + L("Notifications:NewFriend"), + L("Notifications:NewFriend"), + notificationType: NotificationType.System, + lifetime: NotificationLifetime.Persistent, + allowSubscriptionToClients: true); + imGroup.AddNotification( + MessageServiceNotificationNames.IM.JoinGroup, + L("Notifications:JoinGroup"), + L("Notifications:JoinGroup"), + notificationType: NotificationType.System, + lifetime: NotificationLifetime.Persistent, + allowSubscriptionToClients: true); + imGroup.AddNotification( + MessageServiceNotificationNames.IM.ExitGroup, + L("Notifications:ExitGroup"), + L("Notifications:ExitGroup"), + notificationType: NotificationType.System, + lifetime: NotificationLifetime.Persistent, + allowSubscriptionToClients: true); + imGroup.AddNotification( + MessageServiceNotificationNames.IM.DissolveGroup, + L("Notifications:DissolveGroup"), + L("Notifications:DissolveGroup"), + notificationType: NotificationType.System, + lifetime: NotificationLifetime.Persistent, + allowSubscriptionToClients: true); } protected LocalizableString L(string name) diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/INotificationRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/INotificationRepository.cs index dc91fff44..074456b6a 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/INotificationRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/INotificationRepository.cs @@ -1,12 +1,17 @@ -using System.Threading.Tasks; +using System.Threading; +using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; namespace LINGYUN.Abp.MessageService.Notifications { public interface INotificationRepository : IBasicRepository { - Task GetByIdAsync(long notificationId); + Task GetByIdAsync( + long notificationId, + CancellationToken cancellationToken = default); - Task DeleteExpritionAsync(int batchCount); + Task DeleteExpritionAsync( + int batchCount, + CancellationToken cancellationToken = default); } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/IUserNotificationRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/IUserNotificationRepository.cs index 29ca36a9f..6942ac069 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/IUserNotificationRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/IUserNotificationRepository.cs @@ -1,6 +1,7 @@ using LINGYUN.Abp.Notifications; using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; @@ -8,18 +9,46 @@ namespace LINGYUN.Abp.MessageService.Notifications { public interface IUserNotificationRepository : IBasicRepository { - Task AnyAsync(Guid userId, long notificationId); + Task AnyAsync( + Guid userId, + long notificationId, + CancellationToken cancellationToken = default); - Task InsertUserNotificationsAsync(IEnumerable userNotifications); + Task InsertUserNotificationsAsync( + IEnumerable userNotifications, + CancellationToken cancellationToken = default); - Task GetByIdAsync(Guid userId, long notificationId); + Task GetByIdAsync( + Guid userId, + long notificationId, + CancellationToken cancellationToken = default); - Task> GetNotificationsAsync(Guid userId, NotificationReadState readState = NotificationReadState.UnRead, int maxResultCount = 10); + Task> GetNotificationsAsync( + Guid userId, + NotificationReadState readState = NotificationReadState.UnRead, + int maxResultCount = 10, + CancellationToken cancellationToken = default); - Task GetCountAsync(Guid userId, string filter = "", NotificationReadState readState = NotificationReadState.UnRead); + Task GetCountAsync( + Guid userId, + string filter = "", + NotificationReadState readState = NotificationReadState.UnRead, + CancellationToken cancellationToken = default); - Task> GetNotificationsAsync(Guid userId, string filter = "", string sorting = nameof(Notification.NotificationId), NotificationReadState readState = NotificationReadState.UnRead, int skipCount = 1, int maxResultCount = 10); + Task> GetListAsync( + Guid userId, + string filter = "", + string sorting = nameof(Notification.CreationTime), + bool reverse = true, + NotificationReadState readState = NotificationReadState.UnRead, + int skipCount = 1, + int maxResultCount = 10, + CancellationToken cancellationToken = default); - Task ChangeUserNotificationReadStateAsync(Guid userId, long notificationId, NotificationReadState readState); + Task ChangeUserNotificationReadStateAsync( + Guid userId, + long notificationId, + NotificationReadState readState, + CancellationToken cancellationToken = default); } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/MessageServiceNotificationNames.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/MessageServiceNotificationNames.cs new file mode 100644 index 000000000..7457b5021 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/MessageServiceNotificationNames.cs @@ -0,0 +1,33 @@ +namespace LINGYUN.Abp.MessageService.Notifications +{ + public static class MessageServiceNotificationNames + { + public const string GroupName = "LINGYUN.Abp.Messages"; + + public class IM + { + public const string GroupName = MessageServiceNotificationNames.GroupName + ".IM"; + /// + /// 好友验证通知 + /// + public const string FriendValidation = GroupName + ".FriendValidation"; + /// + /// 新好友通知 + /// + public const string NewFriend = GroupName + ".NewFriend"; + /// + /// 加入群组通知 + /// + public const string JoinGroup = GroupName + ".JoinGroup"; + /// + /// 退出群组通知 + /// + public const string ExitGroup = GroupName + ".ExitGroup"; + /// + /// 群组解散通知 + /// + public const string DissolveGroup = GroupName + ".DissolveGroup"; + } + + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/Notification.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/Notification.cs index 947cc3d65..2b259f551 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/Notification.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/Notification.cs @@ -12,7 +12,6 @@ namespace LINGYUN.Abp.MessageService.Notifications public virtual NotificationSeverity Severity { get; protected set; } public virtual NotificationType Type { get; set; } public virtual long NotificationId { get; protected set; } - public virtual string NotificationCateGory { get; protected set; } public virtual string NotificationName { get; protected set; } public virtual string NotificationData { get; protected set; } public virtual string NotificationTypeName { get; protected set; } @@ -25,19 +24,16 @@ namespace LINGYUN.Abp.MessageService.Notifications Id = id; } - public Notification(long id, string category, string name, string dataType, string data, NotificationSeverity severity = NotificationSeverity.Info) + public Notification(long id, string name, string dataType, string data, + NotificationSeverity severity = NotificationSeverity.Info, + Guid? tenantId = null) { NotificationId = id; Severity = severity; - NotificationCateGory = category; NotificationName = name; NotificationData = data; NotificationTypeName = dataType; Type = NotificationType.Application; - } - - public void SetTenantId(Guid? tenantId) - { TenantId = tenantId; } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs index ae4002684..b3a77f5b0 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs @@ -4,168 +4,271 @@ using LINGYUN.Abp.Notifications; using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using System.Threading.Tasks; -using Volo.Abp.Domain.Services; +using Volo.Abp.DependencyInjection; using Volo.Abp.Json; +using Volo.Abp.MultiTenancy; using Volo.Abp.ObjectMapping; +using Volo.Abp.Timing; using Volo.Abp.Uow; namespace LINGYUN.Abp.MessageService.Notifications { - public class NotificationStore : DomainService, INotificationStore + public class NotificationStore : INotificationStore, ITransientDependency { + private readonly IClock _clock; + private readonly IObjectMapper _objectMapper; - private readonly IUnitOfWorkManager _unitOfWorkManager; - private IJsonSerializer _jsonSerializer; - protected IJsonSerializer JsonSerializer => LazyGetRequiredService(ref _jsonSerializer); + private readonly ICurrentTenant _currentTenant; + + private readonly IJsonSerializer _jsonSerializer; + + private readonly IUnitOfWorkManager _unitOfWorkManager; - private ISnowflakeIdGenerator _snowflakeIdGenerator; - protected ISnowflakeIdGenerator SnowflakeIdGenerator => LazyGetRequiredService(ref _snowflakeIdGenerator); + private readonly ISnowflakeIdGenerator _snowflakeIdGenerator; - private INotificationRepository _notificationRepository; - protected INotificationRepository NotificationRepository => LazyGetRequiredService(ref _notificationRepository); + private readonly INotificationRepository _notificationRepository; - private IUserNotificationRepository _userNotificationRepository; - protected IUserNotificationRepository UserNotificationRepository => LazyGetRequiredService(ref _userNotificationRepository); + private readonly IUserNotificationRepository _userNotificationRepository; - private IUserSubscribeRepository _userSubscribeRepository; - protected IUserSubscribeRepository UserSubscribeRepository => LazyGetRequiredService(ref _userSubscribeRepository); + private readonly IUserSubscribeRepository _userSubscribeRepository; public NotificationStore( + IClock clock, IObjectMapper objectMapper, - IUnitOfWorkManager unitOfWorkManager) + ICurrentTenant currentTenant, + IJsonSerializer jsonSerializer, + IUnitOfWorkManager unitOfWorkManager, + ISnowflakeIdGenerator snowflakeIdGenerator, + INotificationRepository notificationRepository, + IUserSubscribeRepository userSubscribeRepository, + IUserNotificationRepository userNotificationRepository + ) { + _clock = clock; _objectMapper = objectMapper; + _currentTenant = currentTenant; + _jsonSerializer = jsonSerializer; _unitOfWorkManager = unitOfWorkManager; + _snowflakeIdGenerator = snowflakeIdGenerator; + _notificationRepository = notificationRepository; + _userSubscribeRepository = userSubscribeRepository; + _userNotificationRepository = userNotificationRepository; } - [UnitOfWork] - public async Task ChangeUserNotificationReadStateAsync(Guid? tenantId, Guid userId, long notificationId, NotificationReadState readState) + public virtual async Task ChangeUserNotificationReadStateAsync( + Guid? tenantId, + Guid userId, + long notificationId, + NotificationReadState readState, + CancellationToken cancellationToken = default) { using (var unitOfWork = _unitOfWorkManager.Begin()) - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - await UserNotificationRepository.ChangeUserNotificationReadStateAsync(userId, notificationId, readState); + await _userNotificationRepository + .ChangeUserNotificationReadStateAsync(userId, notificationId, readState, cancellationToken); await unitOfWork.SaveChangesAsync(); } } - [UnitOfWork] - public async Task DeleteNotificationAsync(NotificationInfo notification) + public virtual async Task DeleteNotificationAsync( + NotificationInfo notification, + CancellationToken cancellationToken = default) { using (var unitOfWork = _unitOfWorkManager.Begin()) - using (CurrentTenant.Change(notification.TenantId)) + using (_currentTenant.Change(notification.TenantId)) { - var notify = await NotificationRepository.GetByIdAsync(notification.GetId()); - await NotificationRepository.DeleteAsync(notify.Id); + var notify = await _notificationRepository.GetByIdAsync(notification.GetId(), cancellationToken); + await _notificationRepository.DeleteAsync(notify.Id, cancellationToken: cancellationToken); - await unitOfWork.SaveChangesAsync(); + await unitOfWork.SaveChangesAsync(cancellationToken); } } - [UnitOfWork] - public async Task DeleteNotificationAsync(int batchCount) + public virtual async Task DeleteNotificationAsync( + int batchCount, + CancellationToken cancellationToken = default) { using (var unitOfWork = _unitOfWorkManager.Begin()) { - await NotificationRepository.DeleteExpritionAsync(batchCount); + await _notificationRepository.DeleteExpritionAsync(batchCount, cancellationToken); - await unitOfWork.SaveChangesAsync(); + await unitOfWork.SaveChangesAsync(cancellationToken); } } - [UnitOfWork] - public async Task DeleteUserNotificationAsync(Guid? tenantId, Guid userId, long notificationId) + public virtual async Task DeleteUserNotificationAsync( + Guid? tenantId, + Guid userId, + long notificationId, + CancellationToken cancellationToken = default) { using (var unitOfWork = _unitOfWorkManager.Begin()) - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - var notify = await UserNotificationRepository.GetByIdAsync(userId, notificationId); - await UserNotificationRepository.DeleteAsync(notify.Id); + var notify = await _userNotificationRepository + .GetByIdAsync(userId, notificationId, cancellationToken); + await _userNotificationRepository + .DeleteAsync(notify.Id, cancellationToken: cancellationToken); - await unitOfWork.SaveChangesAsync(); + await unitOfWork.SaveChangesAsync(cancellationToken); } } - [UnitOfWork] - public async Task DeleteAllUserSubscriptionAsync(Guid? tenantId, string notificationName) + public virtual async Task DeleteAllUserSubscriptionAsync( + Guid? tenantId, + string notificationName, + CancellationToken cancellationToken = default) { using (var unitOfWork = _unitOfWorkManager.Begin()) - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - await UserSubscribeRepository.DeleteUserSubscriptionAsync(notificationName); + await _userSubscribeRepository + .DeleteUserSubscriptionAsync(notificationName, cancellationToken); - await unitOfWork.SaveChangesAsync(); + await unitOfWork.SaveChangesAsync(cancellationToken); } } - [UnitOfWork] - public async Task DeleteUserSubscriptionAsync(Guid? tenantId, Guid userId, string notificationName) + public virtual async Task DeleteUserSubscriptionAsync( + Guid? tenantId, + Guid userId, + string notificationName, + CancellationToken cancellationToken = default) { using (var unitOfWork = _unitOfWorkManager.Begin()) - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - var userSubscribe = await UserSubscribeRepository.GetUserSubscribeAsync(notificationName, userId); - await UserSubscribeRepository.DeleteAsync(userSubscribe.Id); + var userSubscribe = await _userSubscribeRepository + .GetUserSubscribeAsync(notificationName, userId, cancellationToken); + await _userSubscribeRepository + .DeleteAsync(userSubscribe.Id, cancellationToken: cancellationToken); - await unitOfWork.SaveChangesAsync(); + await unitOfWork.SaveChangesAsync(cancellationToken); } } - [UnitOfWork] - public async Task DeleteUserSubscriptionAsync(Guid? tenantId, IEnumerable identifiers, string notificationName) + public virtual async Task DeleteUserSubscriptionAsync( + Guid? tenantId, + IEnumerable identifiers, + string notificationName, + CancellationToken cancellationToken = default) { using (var unitOfWork = _unitOfWorkManager.Begin()) - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - // TODO:不追踪用户订阅实体? - var userSubscribes = await UserSubscribeRepository.GetSubscribesAsync(notificationName); - - var removeUserSubscribes = userSubscribes.Where(us => identifiers.Any(id => id.UserId.Equals(us.UserId))); - - await UserSubscribeRepository.DeleteUserSubscriptionAsync(removeUserSubscribes); + await _userSubscribeRepository + .DeleteUserSubscriptionAsync(notificationName, identifiers.Select(ids => ids.UserId), cancellationToken); - await unitOfWork.SaveChangesAsync(); + await unitOfWork.SaveChangesAsync(cancellationToken); } } - public async Task GetNotificationOrNullAsync(Guid? tenantId, long notificationId) + public virtual async Task GetNotificationOrNullAsync( + Guid? tenantId, + long notificationId, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - var notification = await NotificationRepository.GetByIdAsync(notificationId); + var notification = await _notificationRepository + .GetByIdAsync(notificationId, cancellationToken); return _objectMapper.Map(notification); } } - public async Task> GetSubscriptionsAsync(Guid? tenantId, string notificationName) + public virtual async Task> GetUserSubscriptionsAsync( + Guid? tenantId, + string notificationName, + IEnumerable identifiers = null, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - var userSubscriptions = await UserSubscribeRepository.GetSubscribesAsync(notificationName); + var userSubscriptions = new List(); + + if (identifiers == null) + { + userSubscriptions = await _userSubscribeRepository + .GetUserSubscribesAsync(notificationName, null, cancellationToken); + } + else + { + userSubscriptions = await _userSubscribeRepository + .GetUserSubscribesAsync( + notificationName, + identifiers.Select(ids => ids.UserId), + cancellationToken); + } return _objectMapper.Map, List>(userSubscriptions); } } - public async Task> GetUserNotificationsAsync(Guid? tenantId, Guid userId, NotificationReadState readState = NotificationReadState.UnRead, int maxResultCount = 10) + public virtual async Task> GetUserNotificationsAsync( + Guid? tenantId, + Guid userId, + NotificationReadState readState = NotificationReadState.UnRead, + int maxResultCount = 10, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - var notifications = await UserNotificationRepository.GetNotificationsAsync(userId, readState, maxResultCount); + var notifications = await _userNotificationRepository + .GetNotificationsAsync(userId, readState, maxResultCount, cancellationToken); return _objectMapper.Map, List>(notifications); } } - public async Task> GetUserSubscriptionsAsync(Guid? tenantId, Guid userId) + public virtual async Task GetUserNotificationsCountAsync( + Guid? tenantId, + Guid userId, + string filter = "", + NotificationReadState readState = NotificationReadState.UnRead, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - var userSubscriptionNames = await UserSubscribeRepository.GetUserSubscribesAsync(userId); + return await _userNotificationRepository + .GetCountAsync(userId, filter, readState, cancellationToken); + } + } + + public virtual async Task> GetUserNotificationsAsync( + Guid? tenantId, + Guid userId, + string filter = "", + string sorting = nameof(NotificationInfo.CreationTime), + bool reverse = true, + NotificationReadState readState = NotificationReadState.UnRead, + int skipCount = 1, + int maxResultCount = 10, + CancellationToken cancellationToken = default) + { + using (_currentTenant.Change(tenantId)) + { + var notifications = await _userNotificationRepository + .GetListAsync(userId, filter, sorting, reverse, readState, skipCount, maxResultCount, cancellationToken); + + return _objectMapper.Map, List>(notifications); + } + } + + public virtual async Task> GetUserSubscriptionsAsync( + Guid? tenantId, + Guid userId, + CancellationToken cancellationToken = default) + { + using (_currentTenant.Change(tenantId)) + { + var userSubscriptionNames = await _userSubscribeRepository + .GetUserSubscribesAsync(userId, cancellationToken); var userSubscriptions = new List(); @@ -181,11 +284,15 @@ namespace LINGYUN.Abp.MessageService.Notifications } } - public virtual async Task> GetUserSubscriptionsAsync(Guid? tenantId, string userName) + public virtual async Task> GetUserSubscriptionsAsync( + Guid? tenantId, + string userName, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { - var userSubscriptions = await UserSubscribeRepository.GetUserSubscribesByNameAsync(userName); + var userSubscriptions = await _userSubscribeRepository + .GetUserSubscribesByNameAsync(userName, cancellationToken); var userSubscriptionInfos = new List(); @@ -201,71 +308,83 @@ namespace LINGYUN.Abp.MessageService.Notifications } } - [UnitOfWork] - public async Task InsertNotificationAsync(NotificationInfo notification) + public virtual async Task InsertNotificationAsync( + NotificationInfo notification, + CancellationToken cancellationToken = default) { using (var unitOfWork = _unitOfWorkManager.Begin()) - using (CurrentTenant.Change(notification.TenantId)) + using (_currentTenant.Change(notification.TenantId)) { // var notifyId = notification.GetId(); - var notifyId = SnowflakeIdGenerator.Create(); + var notifyId = _snowflakeIdGenerator.Create(); // 保存主键,防止前端js long类型溢出 // notification.Data["id"] = notifyId.ToString(); - var notify = new Notification(notifyId, notification.CateGory, notification.Name, + var notify = new Notification(notifyId, notification.Name, notification.Data.GetType().AssemblyQualifiedName, - JsonSerializer.Serialize(notification.Data), notification.NotificationSeverity) + _jsonSerializer.Serialize(notification.Data), + notification.Severity, notification.TenantId) { - CreationTime = Clock.Now, - Type = notification.NotificationType, - ExpirationTime = Clock.Now.AddDays(60) + CreationTime = _clock.Now, + Type = notification.Type, + // TODO: 通知过期时间应该可以配置 + ExpirationTime = _clock.Now.AddDays(60) }; - notify.SetTenantId(notification.TenantId); - await NotificationRepository.InsertAsync(notify); + await _notificationRepository.InsertAsync(notify, cancellationToken: cancellationToken); notification.Id = notify.NotificationId.ToString(); - await unitOfWork.SaveChangesAsync(); + await unitOfWork.SaveChangesAsync(cancellationToken); } } - [UnitOfWork] - public async Task InsertUserNotificationAsync(NotificationInfo notification, Guid userId) + public virtual async Task InsertUserNotificationAsync( + NotificationInfo notification, + Guid userId, + CancellationToken cancellationToken = default) { using (var unitOfWork = _unitOfWorkManager.Begin()) - using (CurrentTenant.Change(notification.TenantId)) + using (_currentTenant.Change(notification.TenantId)) { var userNotification = new UserNotification(notification.GetId(), userId, notification.TenantId); - await UserNotificationRepository.InsertAsync(userNotification); + await _userNotificationRepository + .InsertAsync(userNotification, cancellationToken: cancellationToken); - await unitOfWork.SaveChangesAsync(); + await unitOfWork.SaveChangesAsync(cancellationToken); } } - [UnitOfWork] - public async Task InsertUserSubscriptionAsync(Guid? tenantId, UserIdentifier identifier, string notificationName) + public virtual async Task InsertUserSubscriptionAsync( + Guid? tenantId, + UserIdentifier identifier, + string notificationName, + CancellationToken cancellationToken = default) { using (var unitOfWork = _unitOfWorkManager.Begin()) - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { var userSubscription = new UserSubscribe(notificationName, identifier.UserId, identifier.UserName, tenantId) { - CreationTime = Clock.Now + CreationTime = _clock.Now }; - await UserSubscribeRepository.InsertAsync(userSubscription); + await _userSubscribeRepository + .InsertAsync(userSubscription, cancellationToken: cancellationToken); - await unitOfWork.SaveChangesAsync(); + await unitOfWork.SaveChangesAsync(cancellationToken); } } - [UnitOfWork] - public async Task InsertUserSubscriptionAsync(Guid? tenantId, IEnumerable identifiers, string notificationName) + public virtual async Task InsertUserSubscriptionAsync( + Guid? tenantId, + IEnumerable identifiers, + string notificationName, + CancellationToken cancellationToken = default) { using (var unitOfWork = _unitOfWorkManager.Begin()) - using (CurrentTenant.Change(tenantId)) + using (_currentTenant.Change(tenantId)) { var userSubscribes = new List(); @@ -274,39 +393,47 @@ namespace LINGYUN.Abp.MessageService.Notifications userSubscribes.Add(new UserSubscribe(notificationName, identifier.UserId, identifier.UserName, tenantId)); } - await UserSubscribeRepository.InsertUserSubscriptionAsync(userSubscribes); + await _userSubscribeRepository + .InsertUserSubscriptionAsync(userSubscribes, cancellationToken); - await unitOfWork.SaveChangesAsync(); + await unitOfWork.SaveChangesAsync(cancellationToken); } } - public async Task IsSubscribedAsync(Guid? tenantId, Guid userId, string notificationName) + public virtual async Task IsSubscribedAsync( + Guid? tenantId, + Guid userId, + string notificationName, + CancellationToken cancellationToken = default) { - using (CurrentTenant.Change(tenantId)) - return await UserSubscribeRepository.UserSubscribeExistsAysnc(notificationName, userId); + using (_currentTenant.Change(tenantId)) + return await _userSubscribeRepository + .UserSubscribeExistsAysnc(notificationName, userId, cancellationToken); } - [UnitOfWork] - public async Task InsertUserNotificationsAsync(NotificationInfo notification, IEnumerable userIds) + public virtual async Task InsertUserNotificationsAsync( + NotificationInfo notification, + IEnumerable userIds, + CancellationToken cancellationToken = default) { - // 添加工作单元 using (var unitOfWork = _unitOfWorkManager.Begin()) - using (CurrentTenant.Change(notification.TenantId)) + using (_currentTenant.Change(notification.TenantId)) { var userNofitications = new List(); foreach (var userId in userIds) { // 重复检查 // TODO:如果存在很多个订阅用户,这是个隐患 - if (!await UserNotificationRepository.AnyAsync(userId, notification.GetId())) + if (!await _userNotificationRepository.AnyAsync(userId, notification.GetId(), cancellationToken)) { var userNofitication = new UserNotification(notification.GetId(), userId, notification.TenantId); userNofitications.Add(userNofitication); } } - await UserNotificationRepository.InsertUserNotificationsAsync(userNofitications); + await _userNotificationRepository + .InsertUserNotificationsAsync(userNofitications, cancellationToken); - await unitOfWork.SaveChangesAsync(); + await unitOfWork.SaveChangesAsync(cancellationToken); } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Packages/Emoji.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Packages/Emoji.cs new file mode 100644 index 000000000..99f8d0929 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Packages/Emoji.cs @@ -0,0 +1,29 @@ +using System; +using Volo.Abp.Domain.Entities; + +namespace LINGYUN.Abp.MessageService.Packages +{ + public class Emoji : Entity + { + public virtual string Name { get; protected set; } + public virtual string Title { get; protected set; } + public virtual string LinkUrl { get; protected set; } + protected Emoji() { } + public Emoji( + Guid id, + string name, + string title, + string linkUrl) + :base(id) + { + Name = name; + Title = title; + LinkUrl = linkUrl; + } + + public void SetUrl(string linkUrl) + { + LinkUrl = linkUrl; + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Subscriptions/IUserSubscribeRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Subscriptions/IUserSubscribeRepository.cs index 1b030facb..c30014730 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Subscriptions/IUserSubscribeRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Subscriptions/IUserSubscribeRepository.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; @@ -7,26 +8,59 @@ namespace LINGYUN.Abp.MessageService.Subscriptions { public interface IUserSubscribeRepository : IBasicRepository { - Task UserSubscribeExistsAysnc(string notificationName, Guid userId); + Task UserSubscribeExistsAysnc( + string notificationName, + Guid userId, + CancellationToken cancellationToken = default); - Task GetUserSubscribeAsync(string notificationName, Guid userId); + Task GetUserSubscribeAsync( + string notificationName, + Guid userId, + CancellationToken cancellationToken = default); - Task> GetSubscribesAsync(string notificationName); + Task> GetUserSubscribesAsync( + string notificationName, + IEnumerable userIds = null, + CancellationToken cancellationToken = default); - Task> GetUserSubscribesAsync(Guid userId); + Task> GetUserSubscribesAsync( + Guid userId, + CancellationToken cancellationToken = default); - Task> GetUserSubscribesByNameAsync(string userName); + Task> GetUserSubscribesByNameAsync( + string userName, + CancellationToken cancellationToken = default); - Task> GetUserSubscribesAsync(string notificationName); + Task> GetUserSubscribesAsync( + string notificationName, + CancellationToken cancellationToken = default); - Task InsertUserSubscriptionAsync(IEnumerable userSubscribes); + Task InsertUserSubscriptionAsync( + IEnumerable userSubscribes, + CancellationToken cancellationToken = default); - Task DeleteUserSubscriptionAsync(IEnumerable userSubscribes); + Task DeleteUserSubscriptionAsync( + IEnumerable userSubscribes, + CancellationToken cancellationToken = default); - Task DeleteUserSubscriptionAsync(string notificationName); + Task DeleteUserSubscriptionAsync( + string notificationName, + IEnumerable userIds, + CancellationToken cancellationToken = default); - Task> GetUserSubscribesAsync(Guid userId, string sorting = nameof(UserSubscribe.Id), int skipCount = 1, int maxResultCount = 10); + Task DeleteUserSubscriptionAsync( + string notificationName, + CancellationToken cancellationToken = default); - Task GetCountAsync(Guid userId); + Task> GetUserSubscribesAsync( + Guid userId, + string sorting = nameof(UserSubscribe.Id), + int skipCount = 1, + int maxResultCount = 10, + CancellationToken cancellationToken = default); + + Task GetCountAsync( + Guid userId, + CancellationToken cancellationToken = default); } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs index 4a7dabe34..d03fe28c3 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs @@ -23,7 +23,7 @@ namespace LINGYUN.Abp.MessageService.Chat public virtual async Task FindByUserFriendIdAsync(Guid userId, Guid friendId, CancellationToken cancellationToken = default) { return await DbSet - .Where(ucf => ucf.UserId == userId && ucf.FrientId == friendId && ucf.Status == UserFriendStatus.Added) + .Where(ucf => ucf.UserId == userId && ucf.FrientId == friendId) .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } @@ -194,6 +194,16 @@ namespace LINGYUN.Abp.MessageService.Chat .CountAsync(GetCancellationToken(cancellationToken)); } + public virtual async Task IsFriendAsync( + Guid userId, + Guid frientId, + CancellationToken cancellationToken = default) + { + return await DbSet + .AnyAsync(ucf => ucf.UserId == userId && ucf.FrientId == frientId && ucf.Status == UserFriendStatus.Added, + GetCancellationToken(cancellationToken)); + } + public virtual async Task IsAddedAsync(Guid userId, Guid frientId, CancellationToken cancellationToken = default) { return await DbSet diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatSettingRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatSettingRepository.cs index 69b23a8fd..bfc4563c7 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatSettingRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatSettingRepository.cs @@ -2,6 +2,7 @@ using Microsoft.EntityFrameworkCore; using System; using System.Linq; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; @@ -18,16 +19,16 @@ namespace LINGYUN.Abp.MessageService.Chat { } - public async Task FindByUserIdAsync(Guid userId) + public async Task FindByUserIdAsync(Guid userId, CancellationToken cancellationToken = default) { return await DbSet.Where(x => x.UserId.Equals(userId)) .AsNoTracking() - .FirstOrDefaultAsync(); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } - public async Task UserHasOpendImAsync(Guid userId) + public async Task UserHasOpendImAsync(Guid userId, CancellationToken cancellationToken = default) { - return await DbSet.AnyAsync(x => x.UserId.Equals(userId)); + return await DbSet.AnyAsync(x => x.UserId.Equals(userId), GetCancellationToken(cancellationToken)); } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/AbpMessageServiceEntityFrameworkCoreModule.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/AbpMessageServiceEntityFrameworkCoreModule.cs index 2939391a7..eb9271862 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/AbpMessageServiceEntityFrameworkCoreModule.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/AbpMessageServiceEntityFrameworkCoreModule.cs @@ -1,4 +1,5 @@ using LINGYUN.Abp.MessageService.Chat; +using LINGYUN.Abp.MessageService.Group; using LINGYUN.Abp.MessageService.Notifications; using LINGYUN.Abp.MessageService.Subscriptions; using Microsoft.Extensions.DependencyInjection; diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/IMessageServiceDbContext.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/IMessageServiceDbContext.cs index bbfc5d399..070434a73 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/IMessageServiceDbContext.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/IMessageServiceDbContext.cs @@ -1,4 +1,5 @@ using LINGYUN.Abp.MessageService.Chat; +using LINGYUN.Abp.MessageService.Group; using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContext.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContext.cs index 893d3ba01..bd333d642 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContext.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContext.cs @@ -1,4 +1,5 @@ using LINGYUN.Abp.MessageService.Chat; +using LINGYUN.Abp.MessageService.Group; using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContextModelCreatingExtensions.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContextModelCreatingExtensions.cs index 8fa22cf9b..9c589e5b2 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContextModelCreatingExtensions.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContextModelCreatingExtensions.cs @@ -26,12 +26,10 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore b.ToTable(options.TablePrefix + "Notifications", options.Schema); b.Property(p => p.NotificationName).HasMaxLength(NotificationConsts.MaxNameLength).IsRequired(); - b.Property(p => p.NotificationCateGory).HasMaxLength(NotificationConsts.MaxCateGoryLength).IsRequired(); b.Property(p => p.NotificationTypeName).HasMaxLength(NotificationConsts.MaxTypeNameLength).IsRequired(); b.Property(p => p.NotificationData).HasMaxLength(NotificationConsts.MaxDataLength).IsRequired(); - b.ConfigureMultiTenant(); - b.ConfigureCreationTime(); + b.ConfigureByConvention(); b.HasIndex(p => new { p.TenantId, p.NotificationName }); }); @@ -40,7 +38,7 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore { b.ToTable(options.TablePrefix + "UserNotifications", options.Schema); - b.ConfigureMultiTenant(); + b.ConfigureByConvention(); b.HasIndex(p => new { p.TenantId, p.UserId, p.NotificationId }) .HasName("IX_Tenant_User_Notification_Id"); @@ -56,8 +54,7 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore .HasDefaultValue("/")// 不是必须的 .IsRequired(); - b.ConfigureCreationTime(); - b.ConfigureMultiTenant(); + b.ConfigureByConvention(); b.HasIndex(p => new { p.TenantId, p.UserId, p.NotificationName }) .HasName("IX_Tenant_User_Notification_Name") @@ -71,8 +68,7 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore b.Property(p => p.SendUserName).HasMaxLength(MessageConsts.MaxSendUserNameLength).IsRequired(); b.Property(p => p.Content).HasMaxLength(MessageConsts.MaxContentLength).IsRequired(); - b.ConfigureCreationTime(); - b.ConfigureMultiTenant(); + b.ConfigureByConvention(); b.HasIndex(p => new { p.TenantId, p.ReceiveUserId }); }); @@ -84,8 +80,7 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore b.Property(p => p.SendUserName).HasMaxLength(MessageConsts.MaxSendUserNameLength).IsRequired(); b.Property(p => p.Content).HasMaxLength(MessageConsts.MaxContentLength).IsRequired(); - b.ConfigureCreationTime(); - b.ConfigureMultiTenant(); + b.ConfigureByConvention(); b.HasIndex(p => new { p.TenantId, p.GroupId }); }); @@ -94,7 +89,8 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore { b.ToTable(options.TablePrefix + "UserChatFriends", options.Schema); - b.Property(p => p.RemarkName).HasMaxLength(UserChatCardConsts.MaxUserNameLength); + b.Property(p => p.RemarkName).HasMaxLength(UserChatFriendConsts.MaxRemarkNameLength); + b.Property(p => p.Description).HasMaxLength(UserChatFriendConsts.MaxDescriptionLength); b.ConfigureByConvention(); @@ -133,7 +129,7 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore { b.ToTable(options.TablePrefix + "UserChatSettings", options.Schema); - b.ConfigureMultiTenant(); + b.ConfigureByConvention(); b.HasIndex(p => new { p.TenantId, p.UserId }); }); @@ -160,7 +156,7 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore { b.ToTable(options.TablePrefix + "GroupChatBlacks", options.Schema); - b.ConfigureMultiTenant(); + b.ConfigureByConvention(); b.HasIndex(p => new { p.TenantId, p.GroupId }); }); @@ -176,8 +172,7 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore b.Property(p => p.Address).HasMaxLength(ChatGroupConsts.MaxAddressLength); b.Property(p => p.Description).HasMaxLength(ChatGroupConsts.MaxDescriptionLength); - b.ConfigureAudited(); - b.ConfigureMultiTenant(); + b.ConfigureByConvention(); b.HasIndex(p => new { p.TenantId, p.Name }); }); @@ -186,8 +181,7 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore { b.ToTable(options.TablePrefix + "UserChatGroups", options.Schema); - b.ConfigureCreationAudited(); - b.ConfigureMultiTenant(); + b.ConfigureByConvention(); b.HasIndex(p => new { p.TenantId, p.GroupId, p.UserId }); }); 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 6b274be28..46cb100ad 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 @@ -160,7 +160,7 @@ namespace LINGYUN.Abp.MessageService.Group Guid userId, CancellationToken cancellationToken = default) { - await DeleteAsync(ucg => ucg.GroupId == groupId && ucg.UserId == userId); + await DeleteAsync(ucg => ucg.GroupId == groupId && ucg.UserId == userId, cancellationToken: GetCancellationToken(cancellationToken)); } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreNotificationRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreNotificationRepository.cs index 97b094126..310956eae 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreNotificationRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreNotificationRepository.cs @@ -2,6 +2,7 @@ using Microsoft.EntityFrameworkCore; using System; using System.Linq; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; @@ -18,22 +19,27 @@ namespace LINGYUN.Abp.MessageService.Notifications { } - public async Task DeleteExpritionAsync(int batchCount) + public async Task DeleteExpritionAsync( + int batchCount, + CancellationToken cancellationToken = default) { var batchDeleteNoticeWithIds = await DbSet .Where(x => x.ExpirationTime <= DateTime.Now) .Take(batchCount) .Select(x => new Notification(x.Id)) .AsNoTracking() - .ToArrayAsync(); + .ToArrayAsync(GetCancellationToken(cancellationToken)); DbSet.AttachRange(batchDeleteNoticeWithIds); DbSet.RemoveRange(batchDeleteNoticeWithIds); } - public async Task GetByIdAsync(long notificationId) + public async Task GetByIdAsync( + long notificationId, + CancellationToken cancellationToken = default) { - return await DbSet.Where(x => x.NotificationId.Equals(notificationId)).FirstOrDefaultAsync(); + return await DbSet.Where(x => x.NotificationId.Equals(notificationId)) + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreUserNotificationRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreUserNotificationRepository.cs index 1ae397e76..ee89175f9 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreUserNotificationRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreUserNotificationRepository.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Linq.Dynamic.Core; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; @@ -21,78 +22,112 @@ namespace LINGYUN.Abp.MessageService.Notifications { } - public async Task AnyAsync(Guid userId, long notificationId) + public virtual async Task AnyAsync( + Guid userId, + long notificationId, + CancellationToken cancellationToken = default) { return await DbSet - .AnyAsync(x => x.NotificationId.Equals(notificationId) && x.UserId.Equals(userId)); + .AnyAsync(x => x.NotificationId.Equals(notificationId) && x.UserId.Equals(userId), + GetCancellationToken(cancellationToken)); } - public async Task InsertUserNotificationsAsync(IEnumerable userNotifications) + public virtual async Task InsertUserNotificationsAsync( + IEnumerable userNotifications, + CancellationToken cancellationToken = default) { - await DbSet.AddRangeAsync(userNotifications); + await DbSet.AddRangeAsync(userNotifications, GetCancellationToken(cancellationToken)); } - public async Task ChangeUserNotificationReadStateAsync(Guid userId, long notificationId, NotificationReadState readState) + public virtual async Task ChangeUserNotificationReadStateAsync( + Guid userId, + long notificationId, + NotificationReadState readState, + CancellationToken cancellationToken = default) { - var userNofitication = await GetByIdAsync(userId, notificationId); + var userNofitication = await GetByIdAsync(userId, notificationId, cancellationToken); userNofitication.ChangeReadState(readState); DbSet.Update(userNofitication); } - public async Task GetByIdAsync(Guid userId, long notificationId) + public virtual async Task GetByIdAsync( + Guid userId, + long notificationId, + CancellationToken cancellationToken = default) { var userNofitication = await DbSet .Where(x => x.NotificationId.Equals(notificationId) && x.UserId.Equals(userId)) - .FirstOrDefaultAsync(); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); return userNofitication; } - public async Task> GetNotificationsAsync(Guid userId, NotificationReadState readState = NotificationReadState.UnRead, int maxResultCount = 10) + public virtual async Task> GetNotificationsAsync( + Guid userId, + NotificationReadState readState = NotificationReadState.UnRead, + int maxResultCount = 10, + CancellationToken cancellationToken = default) { - - var userNofitications = await (from un in DbContext.Set() + var userNotifilerQuery = from un in DbContext.Set() join n in DbContext.Set() on un.NotificationId equals n.NotificationId where un.UserId.Equals(userId) && un.ReadStatus.Equals(readState) - orderby n.NotificationId descending - select n) - .Distinct() - .Take(maxResultCount) - .ToListAsync(); - return userNofitications; + select n; + + return await userNotifilerQuery + .OrderBy(nameof(Notification.CreationTime) + " DESC") + .Take(maxResultCount) + .AsNoTracking() + .ToListAsync(GetCancellationToken(cancellationToken)); } - public virtual async Task GetCountAsync(Guid userId, string filter = "", NotificationReadState readState = NotificationReadState.UnRead) + public virtual async Task GetCountAsync( + Guid userId, + string filter = "", + NotificationReadState readState = NotificationReadState.UnRead, + CancellationToken cancellationToken = default) { - var userNofiticationCount = await (from un in DbContext.Set() - join n in DbContext.Set() - on un.NotificationId equals n.NotificationId - where un.UserId.Equals(userId) && un.ReadStatus.Equals(readState) - && (n.NotificationName.Contains(filter) || n.NotificationTypeName.Contains(filter) - || n.NotificationCateGory.Contains(filter)) - select n) - .Distinct() - .LongCountAsync(); - return userNofiticationCount; + var userNotifilerQuery = from un in DbContext.Set() + join n in DbContext.Set() + on un.NotificationId equals n.NotificationId + where un.UserId.Equals(userId) && un.ReadStatus.Equals(readState) + select n; + + return await userNotifilerQuery + .WhereIf(!filter.IsNullOrWhiteSpace(), nf => + nf.NotificationName.Contains(filter) || + nf.NotificationTypeName.Contains(filter)) + .CountAsync(GetCancellationToken(cancellationToken)); } - public virtual async Task> GetNotificationsAsync(Guid userId, string filter = "", string sorting = "NotificationId", NotificationReadState readState = NotificationReadState.UnRead, int skipCount = 1, int maxResultCount = 10) + public virtual async Task> GetListAsync( + Guid userId, + string filter = "", + string sorting = nameof(Notification.CreationTime), + bool reverse = true, + NotificationReadState readState = NotificationReadState.UnRead, + int skipCount = 1, + int maxResultCount = 10, + CancellationToken cancellationToken = default) { - var userNofitications = await (from un in DbContext.Set() - join n in DbContext.Set() - on un.NotificationId equals n.NotificationId - where un.UserId.Equals(userId) && un.ReadStatus.Equals(readState) - && (n.NotificationName.Contains(filter) || n.NotificationTypeName.Contains(filter) - || n.NotificationCateGory.Contains(filter)) - orderby sorting ?? nameof(Notification.NotificationId) descending - select n) - .Distinct() - .Page(skipCount, maxResultCount) - .AsNoTracking() - .ToListAsync(); - return userNofitications; + sorting ??= nameof(Notification.CreationTime); + sorting = reverse ? sorting + " DESC" : sorting; + + var userNotifilerQuery = from un in DbContext.Set() + join n in DbContext.Set() + on un.NotificationId equals n.NotificationId + where un.UserId.Equals(userId) && un.ReadStatus.Equals(readState) + select n; + + return await userNotifilerQuery + .WhereIf(!filter.IsNullOrWhiteSpace(), nf => + nf.NotificationName.Contains(filter) || + nf.NotificationTypeName.Contains(filter)) + .OrderBy(sorting) + .PageBy(skipCount, maxResultCount) + .AsNoTracking() + .ToListAsync(GetCancellationToken(cancellationToken)); } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Subscriptions/EfCoreUserSubscribeRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Subscriptions/EfCoreUserSubscribeRepository.cs index 622a053ec..7a613198b 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Subscriptions/EfCoreUserSubscribeRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Subscriptions/EfCoreUserSubscribeRepository.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Linq.Dynamic.Core; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; @@ -20,83 +21,123 @@ namespace LINGYUN.Abp.MessageService.Subscriptions { } - public async Task> GetSubscribesAsync(string notificationName) + public async Task> GetUserSubscribesAsync( + string notificationName, + IEnumerable userIds = null, + CancellationToken cancellationToken = default) { var userSubscribes = await DbSet .Distinct() .Where(x => x.NotificationName.Equals(notificationName)) + .WhereIf(userIds != null, x => userIds.Contains(x.UserId)) .AsNoTracking() - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); return userSubscribes; } - public async Task GetUserSubscribeAsync(string notificationName, Guid userId) + public async Task GetUserSubscribeAsync( + string notificationName, + Guid userId, + CancellationToken cancellationToken = default) { var userSubscribe = await DbSet .Where(x => x.UserId.Equals(userId) && x.NotificationName.Equals(notificationName)) .AsNoTracking() - .FirstOrDefaultAsync(); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); return userSubscribe; } - public async Task> GetUserSubscribesAsync(Guid userId) + public async Task> GetUserSubscribesAsync( + Guid userId, + CancellationToken cancellationToken = default) { var userSubscribeNames = await DbSet .Distinct() .Where(x => x.UserId.Equals(userId)) .Select(x => x.NotificationName) - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); return userSubscribeNames; } - public async Task> GetUserSubscribesByNameAsync(string userName) + public async Task> GetUserSubscribesByNameAsync( + string userName, + CancellationToken cancellationToken = default) { var userSubscribeNames = await DbSet .Distinct() .Where(x => x.UserName.Equals(userName)) .AsNoTracking() - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); return userSubscribeNames; } - public async Task> GetUserSubscribesAsync(string notificationName) + public async Task> GetUserSubscribesAsync( + string notificationName, + CancellationToken cancellationToken = default) { var subscribeUsers = await DbSet .Distinct() .Where(x => x.NotificationName.Equals(notificationName)) .Select(x => x.UserId) - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); return subscribeUsers; } - public async Task InsertUserSubscriptionAsync(IEnumerable userSubscribes) + public async Task InsertUserSubscriptionAsync( + IEnumerable userSubscribes, + CancellationToken cancellationToken = default) { - await DbSet.AddRangeAsync(userSubscribes); + await DbSet.AddRangeAsync(userSubscribes, GetCancellationToken(cancellationToken)); } - public async Task DeleteUserSubscriptionAsync(string notificationName) + public async Task DeleteUserSubscriptionAsync( + string notificationName, + CancellationToken cancellationToken = default) { - var userSubscribes = await DbSet.Where(x => x.NotificationName.Equals(notificationName)).ToListAsync(); + var userSubscribes = await DbSet.Where(x => x.NotificationName.Equals(notificationName)) + .ToListAsync(GetCancellationToken(cancellationToken)); DbSet.RemoveRange(userSubscribes); } - public Task DeleteUserSubscriptionAsync(IEnumerable userSubscribes) + public Task DeleteUserSubscriptionAsync( + IEnumerable userSubscribes, + CancellationToken cancellationToken = default) { DbSet.RemoveRange(userSubscribes); return Task.CompletedTask; } - public async Task UserSubscribeExistsAysnc(string notificationName, Guid userId) + public virtual async Task DeleteUserSubscriptionAsync( + string notificationName, + IEnumerable userIds, + CancellationToken cancellationToken = default) { - return await DbSet.AnyAsync(x => x.UserId.Equals(userId) && x.NotificationName.Equals(notificationName)); + await DeleteAsync(usr => usr.NotificationName == notificationName && userIds.Contains(usr.UserId), + false, + GetCancellationToken(cancellationToken)); } - public virtual async Task> GetUserSubscribesAsync(Guid userId, string sorting = "Id", int skipCount = 1, int maxResultCount = 10) + public async Task UserSubscribeExistsAysnc( + string notificationName, + Guid userId, + CancellationToken cancellationToken = default) + { + return await DbSet + .AnyAsync(x => x.UserId.Equals(userId) && x.NotificationName.Equals(notificationName), + GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetUserSubscribesAsync( + Guid userId, + string sorting = "Id", + int skipCount = 1, + int maxResultCount = 10, + CancellationToken cancellationToken = default) { var userSubscribes = await DbSet .Distinct() @@ -104,17 +145,19 @@ namespace LINGYUN.Abp.MessageService.Subscriptions .OrderBy(sorting ?? nameof(UserSubscribe.Id)) .Page(skipCount, maxResultCount) .AsNoTracking() - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); return userSubscribes; } - public virtual async Task GetCountAsync(Guid userId) + public virtual async Task GetCountAsync( + Guid userId, + CancellationToken cancellationToken = default) { var userSubscribedCount = await DbSet .Distinct() .Where(x => x.UserId.Equals(userId)) - .LongCountAsync(); + .LongCountAsync(GetCancellationToken(cancellationToken)); return userSubscribedCount; } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/MyFriendController.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/MyFriendController.cs index bbb24a1e5..f7b5ce34c 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/MyFriendController.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Chat/MyFriendController.cs @@ -24,6 +24,13 @@ namespace LINGYUN.Abp.MessageService.Chat await MyFriendAppService.CreateAsync(input); } + [HttpPost] + [Route("add-request")] + public virtual async Task AddRequestAsync(MyFriendAddRequestDto input) + { + await MyFriendAppService.AddRequestAsync(input); + } + [HttpDelete] public virtual async Task DeleteAsync(MyFriendOperationDto input) { diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Notifications/MyNotificationController.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Notifications/MyNotificationController.cs new file mode 100644 index 000000000..b1761ee5d --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Notifications/MyNotificationController.cs @@ -0,0 +1,55 @@ +using LINGYUN.Abp.Notifications; +using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; + +namespace LINGYUN.Abp.MessageService.Notifications +{ + [RemoteService(Name = AbpMessageServiceConsts.RemoteServiceName)] + [Route("api/my-notifilers")] + public class MyNotificationController : AbpController, IMyNotificationAppService + { + protected IMyNotificationAppService MyNotificationAppService { get; } + + public MyNotificationController( + IMyNotificationAppService myNotificationAppService) + { + MyNotificationAppService = myNotificationAppService; + } + + [HttpPost] + public virtual async Task SendNofiterAsync(NotificationSendDto input) + { + await MyNotificationAppService.SendNofiterAsync(input); + } + + [HttpDelete] + [Route("{id}")] + public virtual async Task DeleteAsync(long id) + { + await MyNotificationAppService.DeleteAsync(id); + } + + [HttpGet] + [Route("assignables")] + public virtual async Task> GetAssignableNotifiersAsync() + { + return await MyNotificationAppService.GetAssignableNotifiersAsync(); + } + + [HttpGet] + [Route("{id}")] + public virtual async Task GetAsync(long id) + { + return await MyNotificationAppService.GetAsync(id); + } + + [HttpGet] + public virtual async Task> GetListAsync(UserNotificationGetByPagedDto input) + { + return await MyNotificationAppService.GetListAsync(input); + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Notifications/NotificationController.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Notifications/NotificationController.cs deleted file mode 100644 index b96047ec6..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Notifications/NotificationController.cs +++ /dev/null @@ -1,56 +0,0 @@ -using LINGYUN.Abp.Notifications; -using Microsoft.AspNetCore.Mvc; -using System.Threading.Tasks; -using Volo.Abp; -using Volo.Abp.Application.Dtos; -using Volo.Abp.AspNetCore.Mvc; - -namespace LINGYUN.Abp.MessageService.Notifications -{ - [RemoteService(Name = AbpMessageServiceConsts.RemoteServiceName)] - [Route("api/notifications")] - public class NotificationController : AbpController, INotificationAppService - { - private readonly INotificationAppService _notificationAppService; - public NotificationController( - INotificationAppService notificationAppService) - { - _notificationAppService = notificationAppService; - } - - [HttpPut] - [Route("ChangeReadState")] - public virtual async Task ChangeUserNotificationReadStateAsync(UserNotificationChangeReadStateDto userNotificationChangeRead) - { - await _notificationAppService.ChangeUserNotificationReadStateAsync(userNotificationChangeRead); - } - - [HttpDelete] - [Route("{NotificationId}")] - public virtual async Task DeleteAsync(NotificationGetByIdDto notificationGetById) - { - await _notificationAppService.DeleteAsync(notificationGetById); - } - - [HttpDelete] - [Route("User/{NotificationId}")] - public virtual async Task DeleteUserNotificationAsync(NotificationGetByIdDto notificationGetById) - { - await _notificationAppService.DeleteUserNotificationAsync(notificationGetById); - } - - [HttpGet] - [Route("{NotificationId}")] - public virtual async Task GetAsync(NotificationGetByIdDto notificationGetById) - { - return await _notificationAppService.GetAsync(notificationGetById); - } - - [HttpGet] - [Route("User/{NotificationId}")] - public virtual async Task> GetUserNotificationsAsync(UserNotificationGetByPagedDto userNotificationGetByPaged) - { - return await _notificationAppService.GetUserNotificationsAsync(userNotificationGetByPaged); - } - } -} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Subscriptions/MySubscriptionController.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Subscriptions/MySubscriptionController.cs new file mode 100644 index 000000000..26e767b5d --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Subscriptions/MySubscriptionController.cs @@ -0,0 +1,53 @@ +using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; + +namespace LINGYUN.Abp.MessageService.Subscriptions +{ + [RemoteService(Name = AbpMessageServiceConsts.RemoteServiceName)] + [Route("api/my-subscribes")] + public class MySubscriptionController : AbpController, IMySubscriptionAppService + { + private readonly IMySubscriptionAppService _subscriptionAppService; + + public MySubscriptionController( + IMySubscriptionAppService subscriptionAppService) + { + _subscriptionAppService = subscriptionAppService; + } + + [HttpGet] + [Route("all")] + public virtual async Task> GetAllListAsync() + { + return await _subscriptionAppService.GetAllListAsync(); + } + + [HttpGet] + public virtual async Task> GetListAsync(SubscriptionsGetByPagedDto input) + { + return await _subscriptionAppService.GetListAsync(input); + } + + [HttpGet] + [Route("is-subscribed/{Name}")] + public virtual async Task IsSubscribedAsync(SubscriptionsGetByNameDto input) + { + return await _subscriptionAppService.IsSubscribedAsync(input); + } + + [HttpPost] + public virtual async Task SubscribeAsync(SubscriptionsGetByNameDto input) + { + await _subscriptionAppService.SubscribeAsync(input); + } + + [HttpDelete] + public virtual async Task UnSubscribeAsync(SubscriptionsGetByNameDto input) + { + await _subscriptionAppService.UnSubscribeAsync(input); + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Subscriptions/SubscriptionController.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Subscriptions/SubscriptionController.cs deleted file mode 100644 index 2c09799d2..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Subscriptions/SubscriptionController.cs +++ /dev/null @@ -1,47 +0,0 @@ -using LINGYUN.Abp.Notifications; -using Microsoft.AspNetCore.Mvc; -using System.Threading.Tasks; -using Volo.Abp; -using Volo.Abp.Application.Dtos; -using Volo.Abp.AspNetCore.Mvc; - -namespace LINGYUN.Abp.MessageService.Subscriptions -{ - [RemoteService(Name = AbpMessageServiceConsts.RemoteServiceName)] - [Route("api/subscribes")] - public class SubscriptionController : AbpController, ISubscriptionAppService - { - private readonly ISubscriptionAppService _subscriptionAppService; - - public SubscriptionController( - ISubscriptionAppService subscriptionAppService) - { - _subscriptionAppService = subscriptionAppService; - } - - [HttpGet] - public virtual async Task> GetSubscribedsAsync(SubscriptionsGetByPagedDto subscriptionsGetByPaged) - { - return await _subscriptionAppService.GetSubscribedsAsync(subscriptionsGetByPaged); - } - - [HttpGet] - [Route("IsSubscribed/{NotificationName}")] - public virtual async Task IsSubscribedAsync(SubscriptionsGetByNameDto subscriptionsGetByName) - { - return await _subscriptionAppService.IsSubscribedAsync(subscriptionsGetByName); - } - - [HttpPost] - public virtual async Task SubscribeAsync(SubscriptionsGetByNameDto subscriptionsGetByName) - { - await _subscriptionAppService.SubscribeAsync(subscriptionsGetByName); - } - - [HttpDelete] - public virtual async Task UnSubscribeAsync(SubscriptionsGetByNameDto subscriptionsGetByName) - { - await _subscriptionAppService.UnSubscribeAsync(subscriptionsGetByName); - } - } -} diff --git a/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN.Abp.WeChat.csproj b/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN.Abp.WeChat.csproj new file mode 100644 index 000000000..a31890133 --- /dev/null +++ b/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN.Abp.WeChat.csproj @@ -0,0 +1,24 @@ + + + + + + netstandard2.0 + + + + + + + + + + + + + + + + + + diff --git a/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/AbpWeChatModule.cs b/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/AbpWeChatModule.cs new file mode 100644 index 000000000..74bb1c0f0 --- /dev/null +++ b/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/AbpWeChatModule.cs @@ -0,0 +1,27 @@ +using LINGYUN.Abp.WeChat.Localization; +using Volo.Abp.Features; +using Volo.Abp.Localization; +using Volo.Abp.Modularity; +using Volo.Abp.VirtualFileSystem; + +namespace LINGYUN.Abp.WeChat +{ + [DependsOn(typeof(AbpFeaturesModule))] + public class AbpWeChatModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Add("zh-Hans") + .AddVirtualJson("/LINGYUN/Abp/WeChat/Localization/Resources"); + }); + } + } +} diff --git a/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Features/WeChatFeatureDefinitionProvider.cs b/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Features/WeChatFeatureDefinitionProvider.cs new file mode 100644 index 000000000..3a255e923 --- /dev/null +++ b/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Features/WeChatFeatureDefinitionProvider.cs @@ -0,0 +1,19 @@ +using LINGYUN.Abp.WeChat.Localization; +using Volo.Abp.Features; +using Volo.Abp.Localization; + +namespace LINGYUN.Abp.WeChat.Features +{ + public class WeChatFeatureDefinitionProvider : FeatureDefinitionProvider + { + public override void Define(IFeatureDefinitionContext context) + { + context.AddGroup(WeChatFeatures.GroupName, L("Features:WeChat")); + } + + protected LocalizableString L(string name) + { + return LocalizableString.Create(name); + } + } +} diff --git a/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Features/WeChatFeatures.cs b/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Features/WeChatFeatures.cs new file mode 100644 index 000000000..497ddad1c --- /dev/null +++ b/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Features/WeChatFeatures.cs @@ -0,0 +1,7 @@ +namespace LINGYUN.Abp.WeChat.Features +{ + public static class WeChatFeatures + { + public const string GroupName = "Abp.WeChat"; + } +} diff --git a/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/Resources/en.json b/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/Resources/en.json new file mode 100644 index 000000000..1d424e365 --- /dev/null +++ b/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/Resources/en.json @@ -0,0 +1,6 @@ +{ + "culture": "en", + "texts": { + "Features:WeChat": "WeChat" + } +} \ No newline at end of file diff --git a/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/Resources/zh-Hans.json b/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/Resources/zh-Hans.json new file mode 100644 index 000000000..c7811659b --- /dev/null +++ b/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/Resources/zh-Hans.json @@ -0,0 +1,6 @@ +{ + "culture": "zh-Hans", + "texts": { + "Features:WeChat": "微信开发" + } +} \ No newline at end of file diff --git a/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/WeChatResource.cs b/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/WeChatResource.cs new file mode 100644 index 000000000..764c804bc --- /dev/null +++ b/aspnet-core/modules/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/WeChatResource.cs @@ -0,0 +1,9 @@ +using Volo.Abp.Localization; + +namespace LINGYUN.Abp.WeChat.Localization +{ + [LocalizationResourceName("WeChat")] + public class WeChatResource + { + } +} diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db index e31aebbf53c0f08566e37e0a15f9dd035601480f..f25a991e6b2790e162ce85629a45615e4fc30df6 100644 GIT binary patch literal 40960 zcmeHQTWlQF8J@MBjg#0cESJzqZH845i5d^*Hdm=4i(?YY&c-+nB2ER~*n_j+*v4K5 zQk1q7gLnYm5UTosRMCo;st<)qeSxTbXjQ4IO8Zn*l`2(5YE`LHE7Yoa=yzsjXJ_s8 z?i#$>DV&9k_un%+^UpWm{O303`_DZ*S*iN^6Dw<1%2l0fw`!S;c0$)RO}mNrLA(#( z-50$F@VEBL)IPNMds8!nKAiivHZWAwZrPW6f2cV8%NE?*vYhC zU90%(b2@xFN@?R!gDr{+3qIUlC|CVz<%%C4BPbkucD1tRuNSe~c!Q+h!A9q* zP8-a9FW8y=hwr^N^Ae4(;j};RSFVPau=crc`xUGeb^ihi(i)PvQ)??5t6MI366^F| zbhGstHoNF{U-t0Cy{#^K?Fxn0yk_+yqzuZivJdaR+(+``VD7)Uj|N`u`-(KSyaxZ1 zz3usa`qIV0(a|IM={JA)^^^b5uF}cz(y0sQOGa_Eatb%VGv#Z>*j3y`4{of>?-s-F zaBDqLSscAwUS9Nr;*;fSx&D)p(<|#$<0^fwaM~{~;8rhq&lNz>k@@n{(xvkJQzOf` zl?&eT#?sR9py0~-;z(to;1wumgt?qi%XT^CoS0UjzDfAA!Y6Ptv9s#6RrpXid+AAk zz8ZbMj#HI4J-&w@;BW&U+rh|R2L<) z@!fXF3fGSp9w{$vz=P)sK-HhAdox1G2s3AD-WY-~&RsWls<^s3E-{=LJ2x{@oSK54 zXZ-5r75Uwnm4(U^*YHhrx?W-0pI+Ih`i1M)<(ZC9O&k72cJp+0DCEV3fETk9uMWPo znhsttVKS4r7UhIkj&P#OAo1)4FF4gf3S11rTJT~Ar}vx}oX*s|FiF~&qX!V)5r*@jC^obDc%sA&+FyO!Bmbv3%?qwZ@}T_w1LeN!rgyNyXG zur14>R-H(v`(q-F21F{lX(AGJ1mT35PHO5m(-ZB8)Wqp-5lMQ3pu`Da>ZpR-1(Cvi zQ-^YAYfwUwWe`W8`m0lEysu6rG@)lFj=lJ$6vZUsP)1R~5z}Sqh)Jf$NSm0{#Odx) zi4ntgY~tGX-cyNDg9r=Ng1sdw0R(0^Hsxq9CAgGn;L?S!{`Q^6PNbySOygOqqn@i^M6}L36!Z2 zPzWdl6aoqXg@8gpA)pXY2q**;0t$iMA&_}0KXvHM2W}9pplO-MV7zkqn?$<@#>4q3 z?e+IGqUkVB!npoEN{+y=^QD{L{rm}{-Hn6&0mkZwFb>1`HH;H4<2QG~_-VfM_wT(5 z<4zdw=1YIO^Dj4ub_a~N^QFJO|1JFHb{OA*@#NjuEDz%~7>|yk+RB8$`Qhs6U&@&wfq(7~{pmp>gd`cflBnjGw*s=T+@cXiVPm zxwlregP}2TQ~u^aWc-n1v%$!C`wf)rkBnfdH5(bhWZAyR2xdD5A|n{F?vIRM%(3rK zfA&B=8Z;V)*TH$nzv`tBPzWdl6aoqXg@8gpA)pXY2q**;0tx|zz^4)cIsdQv|DVcB zt4>NGpb$_9Cy)5Kssx1QY@>0&@O8izWZV?;N^(;0xK`?Xdno-d=rB z2*e1e_5X__9qK|Pmc_SO)Ye3_VDA?qsrCQ6kQkAw3{95O_gG3ot^dcWb+!IKsi~7# zxVyWsq}KmSITW@2Uuri=ai)(=B(?ru@<^@!uj_n$0xGHX|Dcju|Nn`&R9_X}s@eTn zTmN6z-3t5vo;LjMp$hu{9}K+I=f(Xy^+6%9BLbV_Lk%hXrDP3xPC`wGxHg!RfAa{v&S;i$T#wbf#$2UKBD^*^2iK;XlC|6m7yH#~`)| zp{;rp+8jT$g-gNmsMK%?3Zon{TQ;;)Qo<$2Guv^giPPQUlJv&l4&xSQ9Vy!Ef=j`^ z1=JTonxr}sxP&4Hx~9b8EWxGI2V*W3rP5Zox-K1D5~kGAvl+CJ@S*4GNTDDn;u3Au zI%@88SGa`Ulk~=594bZT9;zeN&(vV130cx4mBOPkXtps|G>Enxh^ZuXk7vWRnQ5UC zlQK`lrj~^un}RA1Ft!Uz7)fp7bhoG!gbwCHfwn_|+g<4Y1^Wj2kUZTgB^eai0s0WB`-0)VIYM_j7uZU-yFQ^O^TIRx6a5Z<&?!X?|o1YF!Q3B=`-dhBwBr-{?u z;*#{nfcmwdoz-xiww4fp!(Cez&~IpY*NPw|Y1($ZwIuuhnc*L3_+Pyg0tx|zfI>ha zpb$_9C$|^x96xhfWhGz=ugqpf5CX}3yjYNG@Ln!$u4MBz|Jb09n z7==`{?FiMx>2489dSe7F5KD9^Mg@nkkrNoXI=4^?MGjJu3b3s{m4-w}TA0H2nV?A> zNkgZEQg~W~BP|#c$QSAKx=Af#6!92G&9`%t8ZoM=(_Nudy)5ct1DU~{|> zHIgm{J-R55P&yh(rezDu#WD$s2k}_1pZ~|;9Ud4&ThnZjw4J)mo!N9Pd zr}T(R7Y60Jq$rD7O1Na29Nt={i+MxZ^TA8RCCg*N6Rg!p6BYg&<%^$+0n&>cm|7A2=Q+(f|Me delta 3220 zcmeHKO=w(I6ux;GCYj97o0*_A#@azft3odK|L1Ki7Kte&ZJE^4refM8QgovWLD1Gj zhCri2<)L)p&bTRLk;bhxf{QL(#DEJIF50DTT3je}k>scfHkJ@A_o*E<$Jw?h@R?pFE?7?rtw``eQ@>L-+!X`VYg};>6C;dc!+Jrn)ng zO0lsvOxG7ij~_qMJky@&Y_`Hvm)7f)5UQmz!boX|A>j}8)iK?oDxfT&DtvQk@?g!y zjdKk>pVnYWrLr`<-*}0TDV86`l4;JYWrUF_3MrF47aOItW+uF{JW)K;Zk}rQz+s9D zEw$yA^}!)FhtpdFaGEI`Vlfj$YNo>njp>s;cp$@t)I`Yxcpzn{FpTid+e=F;E6Xd( z-I=jI$~u3%`(F3Hqs%8tGtPu%LTJuKNLNz!FG%1sezL%VDPvSG$WlMZ{okfzkaeOsCD2hS6fiAgA_1ffxDBX` zh&)i^hy;{L4JJ$p77-bt#13Vau6F(1?E(`QQ8B__zEo{Tu#={?+)Zed?~ACtJ#YABxX6=We%u-X*9C!7KzG zTP3Ih!LjDt*T3FA2ElM~2;TWGKHqGidJ=qmv)w{|61;j3GPNXlp|jjV)g*8_fhtMh z-cnSKg7|fKHj<#Dz@VGENQ)kWz_lEW0)lG7EgHE+hFasLC(y7LpyGaE-3#Jtd+lj2 z3@+6{1OAt!UWxp#N)k-(z1~$5k4Cg=4#SZpgB2Gy7V2ppgFY%nqosZtmU?~?TTQ{i@Jv*B z`cTkY$slL5ws&XBAdH1~Vu0r&FEsbd>xaT`*Eedyf&-wIz=wh{al^@4j0D66j5>Uk z-inakSg5o4G>;V+2oj!t?L-5x<=+B0u~YhB-WxvqNM)yR?PbqHXy-zAvrv!8+e6i_ z%9l%z7x%W;c8ia8XX^QGikzBL?bN9;E{WDK=dgidgt6HYu%6uOQwBGe)`a--E8{G- zMJ|siSOF6;n0Su-ET)`-w-6bJu~CbT3CO_8?%~iMKGqsW++>`Snj4+3_!J~nm?~mzpL?qffOIP^qmf8!j0Uj% zhL;D>_r&nBzM34RtHD}HNudLoeT%7#bK1g~4|+^USxl6&jQ3Jm9YE=JZ;Fyy@XnkY zW)$gdHVb5ivcD!r>1wdB8oZ1%OHsp5X3iXP5*i@@&7d=fl+kV&bk=Zq$K40!7LCB| S{^@W(N4D1<48dsse)vz5%oJb% diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/ApiGatewayHttpApiHostModule.cs b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/ApiGatewayHttpApiHostModule.cs index c276632cb..dc2992118 100644 --- a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/ApiGatewayHttpApiHostModule.cs +++ b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/ApiGatewayHttpApiHostModule.cs @@ -200,6 +200,7 @@ namespace LINGYUN.ApiGateway public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); + var configuration = context.GetConfiguration(); // http调用链 app.UseCorrelationId(); // 虚拟文件系统 @@ -225,7 +226,7 @@ namespace LINGYUN.ApiGateway // 路由 app.UseConfiguredEndpoints(); - if (context.GetEnvironment().IsDevelopment()) + if (configuration.GetSection("ApiGateway:SeedInitScript").Get()) { SeedData(context); } diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/AbpMessageServiceHttpApiHostModule.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/AbpMessageServiceHttpApiHostModule.cs index a9d571ad5..3d760bd27 100644 --- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/AbpMessageServiceHttpApiHostModule.cs +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/AbpMessageServiceHttpApiHostModule.cs @@ -1,5 +1,6 @@ using DotNetCore.CAP; using Hangfire; +using LINGYUN.Abp.AspNetCore.SignalR.Protocol.Json; using LINGYUN.Abp.BackgroundJobs.Hangfire; using LINGYUN.Abp.EventBus.CAP; using LINGYUN.Abp.ExceptionHandling; @@ -60,6 +61,7 @@ namespace LINGYUN.Abp.MessageService typeof(AbpNotificationsSignalRModule), typeof(AbpNotificationsWeChatWeAppModule), typeof(AbpNotificationsExceptionHandlingModule), + typeof(AbpAspNetCoreSignalRProtocolJsonModule), typeof(AbpCAPEventBusModule), typeof(AbpBackgroundJobsHangfireModule), typeof(AbpHangfireMySqlStorageModule), diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Distributed/ChatMessageEventHandler.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Distributed/ChatMessageEventHandler.cs new file mode 100644 index 000000000..eeafa90a0 --- /dev/null +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Distributed/ChatMessageEventHandler.cs @@ -0,0 +1,52 @@ +using LINGYUN.Abp.IM; +using LINGYUN.Abp.IM.Messages; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.Extensions.Options; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.EventBus.Distributed; + +namespace LINGYUN.Abp.MessageService.EventBus.Distributed +{ + public class ChatMessageEventHandler : IDistributedEventHandler, ITransientDependency + { + /// + /// Reference to . + /// + public ILogger Logger { get; set; } + /// + /// Reference to . + /// + protected AbpIMOptions Options { get; } + + protected IMessageStore MessageStore { get; } + protected IMessageSenderProviderManager MessageSenderProviderManager { get; } + + public ChatMessageEventHandler( + IOptions options, + IMessageStore messageStore, + IMessageSenderProviderManager messageSenderProviderManager) + { + Options = options.Value; + MessageStore = messageStore; + MessageSenderProviderManager = messageSenderProviderManager; + + Logger = NullLogger.Instance; + } + + public virtual async Task HandleEventAsync(ChatMessage eventData) + { + Logger.LogDebug($"Persistent chat message."); + + await MessageStore.StoreMessageAsync(eventData); + + // 发送消息 + foreach (var provider in MessageSenderProviderManager.Providers) + { + Logger.LogDebug($"Sending message with provider {provider.Name}"); + await provider.SendMessageAsync(eventData); + } + } + } +} 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 ec9408620..7e367046e 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,4 +1,5 @@ -using LINGYUN.Abp.Notifications; +using LINGYUN.Abp.MessageService.Utils; +using LINGYUN.Abp.Notifications; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; @@ -9,6 +10,7 @@ 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 @@ -31,6 +33,14 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed /// protected AbpNotificationOptions Options { get; } /// + /// Reference to . + /// + protected IJsonSerializer JsonSerializer { get; } + /// + /// Reference to . + /// + protected ISnowflakeIdGenerator SnowflakeIdGenerator { get; } + /// /// Reference to . /// protected IBackgroundJobManager BackgroundJobManager { get; } @@ -39,6 +49,10 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed /// protected INotificationStore NotificationStore { get; } /// + /// Reference to . + /// + protected INotificationDefinitionManager NotificationDefinitionManager { get; } + /// /// Reference to . /// protected INotificationSubscriptionManager NotificationSubscriptionManager { get; } @@ -51,15 +65,21 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed /// Initializes a new instance of the class. /// public NotificationEventHandler( + IJsonSerializer jsonSerializer, IBackgroundJobManager backgroundJobManager, IOptions options, INotificationStore notificationStore, + ISnowflakeIdGenerator snowflakeIdGenerator, + INotificationDefinitionManager notificationDefinitionManager, INotificationSubscriptionManager notificationSubscriptionManager, INotificationPublishProviderManager notificationPublishProviderManager) { - BackgroundJobManager = backgroundJobManager; Options = options.Value; + JsonSerializer = jsonSerializer; + BackgroundJobManager = backgroundJobManager; NotificationStore = notificationStore; + SnowflakeIdGenerator = snowflakeIdGenerator; + NotificationDefinitionManager = notificationDefinitionManager; NotificationSubscriptionManager = notificationSubscriptionManager; NotificationPublishProviderManager = notificationPublishProviderManager; @@ -69,12 +89,31 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed [UnitOfWork] public virtual async Task HandleEventAsync(NotificationEventData eventData) { - var notificationInfo = eventData.ToNotificationInfo(); + var notification = NotificationDefinitionManager.Get(eventData.Name); + + 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(SnowflakeIdGenerator.Create()); + + 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, notificationInfo); + await PublishFromProvidersAsync(providers, eventData.Users, notificationInfo); } /// @@ -83,43 +122,54 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed /// 提供者列表 /// 通知信息 /// - protected async Task PublishFromProvidersAsync(IEnumerable providers, + protected async Task PublishFromProvidersAsync( + IEnumerable providers, + IEnumerable users, NotificationInfo notificationInfo) { - Logger.LogDebug($"Persistent notification {notificationInfo.Name}"); - - // 持久化通知 - await NotificationStore.InsertNotificationAsync(notificationInfo); - - // TODO: 某些情况下,不能直接在服务内订阅消息,目前只能通过将订阅内容放进消息内部,需要重构通知系统设计了 - if (notificationInfo.Data.HasUserNotification(out Guid userId, out string userName)) + // 检查是够已订阅消息 + Logger.LogDebug($"Gets a list of user subscriptions {notificationInfo.Name}"); + List userSubscriptions; + if (users == null) { - await NotificationSubscriptionManager.SubscribeAsync(notificationInfo.TenantId, - new UserIdentifier(userId, userName), notificationInfo.Name); + // 获取用户订阅列表 + userSubscriptions = await NotificationSubscriptionManager + .GetUserSubscriptionsAsync(notificationInfo.TenantId, notificationInfo.Name); } - - Logger.LogDebug($"Gets a list of user subscriptions {notificationInfo.Name}"); - // 获取用户订阅列表 - var userSubscriptions = await NotificationSubscriptionManager.GetSubscriptionsAsync(notificationInfo.TenantId, notificationInfo.Name); - - Logger.LogDebug($"Persistent user notifications {notificationInfo.Name}"); - // 持久化用户通知 - var subscriptionUserIdentifiers = userSubscriptions.Select(us => new UserIdentifier(us.UserId, us.UserName)); - - await NotificationStore.InsertUserNotificationsAsync(notificationInfo, - subscriptionUserIdentifiers.Select(u => u.UserId)); - - // 发布通知 - foreach (var provider in providers) + else { - await PublishAsync(provider, notificationInfo, subscriptionUserIdentifiers); + // 过滤未订阅的用户 + userSubscriptions = await NotificationSubscriptionManager + .GetUsersSubscriptionsAsync(notificationInfo.TenantId, notificationInfo.Name, users); } - if (notificationInfo.Lifetime == NotificationLifetime.OnlyOne) + users = userSubscriptions.Select(us => new UserIdentifier(us.UserId, us.UserName)); + + if (users.Count() > 0) { - // 一次性通知在发送完成后就取消用户订阅 - await NotificationStore.DeleteAllUserSubscriptionAsync(notificationInfo.TenantId, - notificationInfo.Name); + // 持久化用户通知 + Logger.LogDebug($"Persistent user notifications {notificationInfo.Name}"); + await NotificationStore + .InsertUserNotificationsAsync( + notificationInfo, + users.Select(u => u.UserId)); + + // 发布通知 + foreach (var provider in providers) + { + await PublishAsync(provider, notificationInfo, users, async () => + { + if (notificationInfo.Lifetime == NotificationLifetime.OnlyOne) + { + // 一次性通知在发送完成后就取消用户订阅 + await NotificationStore + .DeleteUserSubscriptionAsync( + notificationInfo.TenantId, + users, + notificationInfo.Name); + } + }); + } } } /// @@ -129,14 +179,17 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed /// 通知信息 /// 订阅用户列表 /// - protected async Task PublishAsync(INotificationPublishProvider provider, NotificationInfo notificationInfo, - IEnumerable subscriptionUserIdentifiers) + protected async Task PublishAsync( + INotificationPublishProvider provider, + NotificationInfo notificationInfo, + IEnumerable subscriptionUserIdentifiers, + Action callback = null) { try { Logger.LogDebug($"Sending notification with provider {provider.Name}"); var notifacationDataMapping = Options.NotificationDataMappings - .GetMapItemOrNull(provider.Name, notificationInfo.CateGory); + .GetMapItemOrNull(notificationInfo.Name, provider.Name); if (notifacationDataMapping != null) { notificationInfo.Data = notifacationDataMapping.MappingFunc(notificationInfo.Data); @@ -161,6 +214,10 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed subscriptionUserIdentifiers.ToList(), notificationInfo.TenantId)); } + finally + { + callback?.Invoke(); + } } } } 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 f7aeb94ec..ec1fa8927 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 @@ -20,14 +20,12 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed protected ICurrentTenant CurrentTenant { get; } protected ISettingProvider SettingProvider { get; } protected IStringLocalizer StringLocalizer { get; } - protected INotificationDispatcher NotificationDispatcher { get; } - protected INotificationSubscriptionManager NotificationSubscriptionManager { get; } + protected INotificationSender NotificationSender { get; } public TenantCreateEventHandler( ICurrentTenant currentTenant, ISettingProvider settingProvider, - INotificationDispatcher notificationDispatcher, - INotificationSubscriptionManager notificationSubscriptionManager, + INotificationSender notificationSender, IStringLocalizer stringLocalizer, ILogger logger) { @@ -35,8 +33,7 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed CurrentTenant = currentTenant; SettingProvider = settingProvider; StringLocalizer = stringLocalizer; - NotificationDispatcher = notificationDispatcher; - NotificationSubscriptionManager = notificationSubscriptionManager; + NotificationSender = notificationSender; } public async Task HandleEventAsync(CreateEventData eventData) @@ -49,21 +46,22 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed // 使用系统区域语言发布通知 using (CultureHelper.Use(userDefaultCultureName, userDefaultCultureName)) { - var noticeNormalizerName = NotificationNameNormalizer.NormalizerName(TenantNotificationNames.NewTenantRegistered); var tenantAdminUserIdentifier = new UserIdentifier(eventData.AdminUserId, eventData.AdminEmailAddress); - // 管理用户订阅租户创建通知 - await NotificationSubscriptionManager.SubscribeAsync(eventData.Id, tenantAdminUserIdentifier, noticeNormalizerName.Name); - - var notificationData = NotificationData.CreateTenantNotificationData(eventData.Id); + var notificationData = new NotificationData(); notificationData.WriteStandardData( L("NewTenantRegisteredNotificationTitle"), L("NewTenantRegisteredNotificationMessage", eventData.Name), DateTime.Now, eventData.AdminEmailAddress); // 发布租户创建通知 - await NotificationDispatcher.DispatchAsync(noticeNormalizerName, notificationData, - eventData.Id, NotificationSeverity.Success); + await NotificationSender + .SendNofiterAsync( + TenantNotificationNames.NewTenantRegistered, + notificationData, + tenantAdminUserIdentifier, + eventData.Id, + NotificationSeverity.Success); } } diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Hangfire/HangfireDashboardRouteOptions.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Hangfire/HangfireDashboardRouteOptions.cs index 3aa788757..596fbd634 100644 --- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Hangfire/HangfireDashboardRouteOptions.cs +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Hangfire/HangfireDashboardRouteOptions.cs @@ -56,19 +56,19 @@ namespace Hangfire private void InitDefaultRoutes() { - WithPermission("/hangfire", AbpMessageServicePermissions.Hangfire.Default); - WithPermission("/stats", AbpMessageServicePermissions.Hangfire.Default); - WithPermission("/servers", AbpMessageServicePermissions.Hangfire.Default); - WithPermission("/retries", AbpMessageServicePermissions.Hangfire.Default); - WithPermission("/recurring", AbpMessageServicePermissions.Hangfire.Default); - WithPermission("/jobs/enqueued", AbpMessageServicePermissions.Hangfire.ManageQueue); - WithPermission("/jobs/processing", AbpMessageServicePermissions.Hangfire.ManageQueue); - WithPermission("/jobs/scheduled", AbpMessageServicePermissions.Hangfire.ManageQueue); - WithPermission("/jobs/failed", AbpMessageServicePermissions.Hangfire.ManageQueue); - WithPermission("/jobs/deleted", AbpMessageServicePermissions.Hangfire.ManageQueue); - WithPermission("/jobs/awaiting", AbpMessageServicePermissions.Hangfire.ManageQueue); - WithPermission("/jobs/actions", AbpMessageServicePermissions.Hangfire.ManageQueue); - WithPermission("/jobs/details", AbpMessageServicePermissions.Hangfire.ManageQueue); + WithPermission("/hangfire", MessageServicePermissions.Hangfire.Default); + WithPermission("/stats", MessageServicePermissions.Hangfire.Default); + WithPermission("/servers", MessageServicePermissions.Hangfire.Default); + WithPermission("/retries", MessageServicePermissions.Hangfire.Default); + WithPermission("/recurring", MessageServicePermissions.Hangfire.Default); + WithPermission("/jobs/enqueued", MessageServicePermissions.Hangfire.ManageQueue); + WithPermission("/jobs/processing", MessageServicePermissions.Hangfire.ManageQueue); + WithPermission("/jobs/scheduled", MessageServicePermissions.Hangfire.ManageQueue); + WithPermission("/jobs/failed", MessageServicePermissions.Hangfire.ManageQueue); + WithPermission("/jobs/deleted", MessageServicePermissions.Hangfire.ManageQueue); + WithPermission("/jobs/awaiting", MessageServicePermissions.Hangfire.ManageQueue); + WithPermission("/jobs/actions", MessageServicePermissions.Hangfire.ManageQueue); + WithPermission("/jobs/details", MessageServicePermissions.Hangfire.ManageQueue); } } } diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN.Abp.MessageService.HttpApi.Host.csproj b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN.Abp.MessageService.HttpApi.Host.csproj index d6a28c954..d69092ad6 100644 --- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN.Abp.MessageService.HttpApi.Host.csproj +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN.Abp.MessageService.HttpApi.Host.csproj @@ -42,6 +42,7 @@ + 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 4c657e174..26ddf61ad 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,8 +2,6 @@ "culture": "en", "texts": { "NewTenantRegisteredNotificationTitle": "Tenants create notification", - "NewTenantRegisteredNotificationMessage": "New tenants to create success, the tenant name: {0}!", - "Permission:Hangfire": "Hangfire dashboard", - "Permission:ManageQueue": "Manage queue" + "NewTenantRegisteredNotificationMessage": "New tenants to create success, the tenant name: {0}!" } -} \ No newline at end of file +} 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 746d37822..d7b22055b 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,8 +2,6 @@ "culture": "zh-Hans", "texts": { "NewTenantRegisteredNotificationTitle": "租户创建通知", - "NewTenantRegisteredNotificationMessage": "新租户创建成功,租户名称:{0}!", - "Permission:Hangfire": "Hangfire仪表板", - "Permission:ManageQueue": "管理队列" + "NewTenantRegisteredNotificationMessage": "新租户创建成功,租户名称:{0}!" } -} \ No newline at end of file +} diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201029102936_Add-UserChatFriend-Column-Description.Designer.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201029102936_Add-UserChatFriend-Column-Description.Designer.cs new file mode 100644 index 000000000..0ee715669 --- /dev/null +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201029102936_Add-UserChatFriend-Column-Description.Designer.cs @@ -0,0 +1,588 @@ +// +using System; +using LINGYUN.Abp.MessageService.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Abp.MessageService.Migrations +{ + [DbContext(typeof(MessageServiceHostMigrationsDbContext))] + [Migration("20201029102936_Add-UserChatFriend-Column-Description")] + partial class AddUserChatFriendColumnDescription + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.7") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatCard", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Age") + .HasColumnType("int"); + + b.Property("AvatarUrl") + .HasColumnType("varchar(512) CHARACTER SET utf8mb4") + .HasMaxLength(512); + + b.Property("Birthday") + .HasColumnType("datetime(6)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("NickName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("Sex") + .HasColumnType("int"); + + b.Property("Sign") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserChatCards"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatFriend", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Black") + .HasColumnType("tinyint(1)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("DontDisturb") + .HasColumnType("tinyint(1)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("FrientId") + .HasColumnType("char(36)"); + + b.Property("RemarkName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("SpecialFocus") + .HasColumnType("tinyint(1)"); + + b.Property("Status") + .HasColumnType("tinyint unsigned"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId", "FrientId"); + + b.ToTable("AppUserChatFriends"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("AllowAddFriend") + .HasColumnType("tinyint(1)"); + + b.Property("AllowAnonymous") + .HasColumnType("tinyint(1)"); + + b.Property("AllowReceiveMessage") + .HasColumnType("tinyint(1)"); + + b.Property("AllowSendMessage") + .HasColumnType("tinyint(1)"); + + b.Property("RequireAddFriendValition") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserChatSettings"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Content") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(1048576); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnType("char(36)"); + + b.Property("MessageId") + .HasColumnType("bigint"); + + b.Property("ReceiveUserId") + .HasColumnType("char(36)"); + + b.Property("SendState") + .HasColumnType("tinyint"); + + b.Property("SendUserName") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ReceiveUserId"); + + b.ToTable("AppUserMessages"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Group.ChatGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Address") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("AdminUserId") + .HasColumnType("char(36)"); + + b.Property("AllowAnonymous") + .HasColumnType("tinyint(1)"); + + b.Property("AllowSendMessage") + .HasColumnType("tinyint(1)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MaxUserCount") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.Property("Notice") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Tag") + .HasColumnType("varchar(512) CHARACTER SET utf8mb4") + .HasMaxLength(512); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AppChatGroups"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Group.GroupChatBlack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnType("char(36)"); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("ShieldUserId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "GroupId"); + + b.ToTable("AppGroupChatBlacks"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Group.GroupMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Content") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(1048576); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnType("char(36)"); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("MessageId") + .HasColumnType("bigint"); + + b.Property("SendState") + .HasColumnType("tinyint"); + + b.Property("SendUserName") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "GroupId"); + + b.ToTable("AppGroupMessages"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Group.UserChatGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "GroupId", "UserId"); + + b.ToTable("AppUserChatGroups"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Group.UserGroupCard", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsAdmin") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("NickName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("SilenceEnd") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserGroupCards"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("ExpirationTime") + .HasColumnType("datetime(6)"); + + b.Property("NotificationData") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(1048576); + + b.Property("NotificationId") + .HasColumnType("bigint"); + + b.Property("NotificationName") + .IsRequired() + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("NotificationTypeName") + .IsRequired() + .HasColumnType("varchar(512) CHARACTER SET utf8mb4") + .HasMaxLength(512); + + b.Property("Severity") + .HasColumnType("tinyint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "NotificationName"); + + b.ToTable("AppNotifications"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.UserNotification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("NotificationId") + .HasColumnType("bigint"); + + b.Property("ReadStatus") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId", "NotificationId") + .HasName("IX_Tenant_User_Notification_Id"); + + b.ToTable("AppUserNotifications"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Subscriptions.UserSubscribe", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("NotificationName") + .IsRequired() + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("UserName") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128) + .HasDefaultValue("/"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId", "NotificationName") + .IsUnique() + .HasName("IX_Tenant_User_Notification_Name"); + + b.ToTable("AppUserSubscribes"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201029102936_Add-UserChatFriend-Column-Description.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201029102936_Add-UserChatFriend-Column-Description.cs new file mode 100644 index 000000000..9a155f6df --- /dev/null +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201029102936_Add-UserChatFriend-Column-Description.cs @@ -0,0 +1,116 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace LINGYUN.Abp.MessageService.Migrations +{ + public partial class AddUserChatFriendColumnDescription : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AppUserChatBlacks"); + + migrationBuilder.DropTable( + name: "AppUserSpecialFocuss"); + + migrationBuilder.DropColumn( + name: "NotificationCateGory", + table: "AppNotifications"); + + migrationBuilder.AddColumn( + name: "ConcurrencyStamp", + table: "AppUserChatFriends", + maxLength: 40, + nullable: true); + + migrationBuilder.AddColumn( + name: "Description", + table: "AppUserChatFriends", + maxLength: 50, + nullable: true); + + migrationBuilder.AddColumn( + name: "ExtraProperties", + table: "AppUserChatFriends", + nullable: true); + + migrationBuilder.AddColumn( + name: "Status", + table: "AppUserChatFriends", + nullable: false, + defaultValue: (byte)0); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ConcurrencyStamp", + table: "AppUserChatFriends"); + + migrationBuilder.DropColumn( + name: "Description", + table: "AppUserChatFriends"); + + migrationBuilder.DropColumn( + name: "ExtraProperties", + table: "AppUserChatFriends"); + + migrationBuilder.DropColumn( + name: "Status", + table: "AppUserChatFriends"); + + migrationBuilder.AddColumn( + name: "NotificationCateGory", + table: "AppNotifications", + type: "varchar(50) CHARACTER SET utf8mb4", + maxLength: 50, + nullable: false, + defaultValue: ""); + + migrationBuilder.CreateTable( + name: "AppUserChatBlacks", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CreationTime = table.Column(type: "datetime(6)", nullable: false), + CreatorId = table.Column(type: "char(36)", nullable: true), + ShieldUserId = table.Column(type: "char(36)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: true), + UserId = table.Column(type: "char(36)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AppUserChatBlacks", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AppUserSpecialFocuss", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CreationTime = table.Column(type: "datetime(6)", nullable: false), + CreatorId = table.Column(type: "char(36)", nullable: true), + FocusUserId = table.Column(type: "char(36)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: true), + UserId = table.Column(type: "char(36)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AppUserSpecialFocuss", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_AppUserChatBlacks_TenantId_UserId", + table: "AppUserChatBlacks", + columns: new[] { "TenantId", "UserId" }); + + migrationBuilder.CreateIndex( + name: "IX_AppUserSpecialFocuss_TenantId_UserId", + table: "AppUserSpecialFocuss", + columns: new[] { "TenantId", "UserId" }); + } + } +} diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201030032219_Based-Message-Entity-To-AggregateRoot.Designer.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201030032219_Based-Message-Entity-To-AggregateRoot.Designer.cs new file mode 100644 index 000000000..73806e490 --- /dev/null +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201030032219_Based-Message-Entity-To-AggregateRoot.Designer.cs @@ -0,0 +1,612 @@ +// +using System; +using LINGYUN.Abp.MessageService.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Abp.MessageService.Migrations +{ + [DbContext(typeof(MessageServiceHostMigrationsDbContext))] + [Migration("20201030032219_Based-Message-Entity-To-AggregateRoot")] + partial class BasedMessageEntityToAggregateRoot + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.7") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatCard", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Age") + .HasColumnType("int"); + + b.Property("AvatarUrl") + .HasColumnType("varchar(512) CHARACTER SET utf8mb4") + .HasMaxLength(512); + + b.Property("Birthday") + .HasColumnType("datetime(6)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("NickName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("Sex") + .HasColumnType("int"); + + b.Property("Sign") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserChatCards"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatFriend", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Black") + .HasColumnType("tinyint(1)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("DontDisturb") + .HasColumnType("tinyint(1)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("FrientId") + .HasColumnType("char(36)"); + + b.Property("RemarkName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("SpecialFocus") + .HasColumnType("tinyint(1)"); + + b.Property("Status") + .HasColumnType("tinyint unsigned"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId", "FrientId"); + + b.ToTable("AppUserChatFriends"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("AllowAddFriend") + .HasColumnType("tinyint(1)"); + + b.Property("AllowAnonymous") + .HasColumnType("tinyint(1)"); + + b.Property("AllowReceiveMessage") + .HasColumnType("tinyint(1)"); + + b.Property("AllowSendMessage") + .HasColumnType("tinyint(1)"); + + b.Property("RequireAddFriendValition") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserChatSettings"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("Content") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(1048576); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("MessageId") + .HasColumnType("bigint"); + + b.Property("ReceiveUserId") + .HasColumnType("char(36)"); + + b.Property("SendState") + .HasColumnType("tinyint"); + + b.Property("SendUserName") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ReceiveUserId"); + + b.ToTable("AppUserMessages"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Group.ChatGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Address") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("AdminUserId") + .HasColumnType("char(36)"); + + b.Property("AllowAnonymous") + .HasColumnType("tinyint(1)"); + + b.Property("AllowSendMessage") + .HasColumnType("tinyint(1)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MaxUserCount") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.Property("Notice") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Tag") + .HasColumnType("varchar(512) CHARACTER SET utf8mb4") + .HasMaxLength(512); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AppChatGroups"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Group.GroupChatBlack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("ShieldUserId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "GroupId"); + + b.ToTable("AppGroupChatBlacks"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Group.GroupMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("Content") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(1048576); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("MessageId") + .HasColumnType("bigint"); + + b.Property("SendState") + .HasColumnType("tinyint"); + + b.Property("SendUserName") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "GroupId"); + + b.ToTable("AppGroupMessages"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Group.UserChatGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "GroupId", "UserId"); + + b.ToTable("AppUserChatGroups"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Group.UserGroupCard", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsAdmin") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("NickName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("SilenceEnd") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserGroupCards"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("ExpirationTime") + .HasColumnType("datetime(6)"); + + b.Property("NotificationData") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(1048576); + + b.Property("NotificationId") + .HasColumnType("bigint"); + + b.Property("NotificationName") + .IsRequired() + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("NotificationTypeName") + .IsRequired() + .HasColumnType("varchar(512) CHARACTER SET utf8mb4") + .HasMaxLength(512); + + b.Property("Severity") + .HasColumnType("tinyint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "NotificationName"); + + b.ToTable("AppNotifications"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.UserNotification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("NotificationId") + .HasColumnType("bigint"); + + b.Property("ReadStatus") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId", "NotificationId") + .HasName("IX_Tenant_User_Notification_Id"); + + b.ToTable("AppUserNotifications"); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Subscriptions.UserSubscribe", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("NotificationName") + .IsRequired() + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("UserName") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128) + .HasDefaultValue("/"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId", "NotificationName") + .IsUnique() + .HasName("IX_Tenant_User_Notification_Name"); + + b.ToTable("AppUserSubscribes"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201030032219_Based-Message-Entity-To-AggregateRoot.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201030032219_Based-Message-Entity-To-AggregateRoot.cs new file mode 100644 index 000000000..0b853d840 --- /dev/null +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/20201030032219_Based-Message-Entity-To-AggregateRoot.cs @@ -0,0 +1,51 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace LINGYUN.Abp.MessageService.Migrations +{ + public partial class BasedMessageEntityToAggregateRoot : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ConcurrencyStamp", + table: "AppUserMessages", + maxLength: 40, + nullable: true); + + migrationBuilder.AddColumn( + name: "ExtraProperties", + table: "AppUserMessages", + nullable: true); + + migrationBuilder.AddColumn( + name: "ConcurrencyStamp", + table: "AppGroupMessages", + maxLength: 40, + nullable: true); + + migrationBuilder.AddColumn( + name: "ExtraProperties", + table: "AppGroupMessages", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ConcurrencyStamp", + table: "AppUserMessages"); + + migrationBuilder.DropColumn( + name: "ExtraProperties", + table: "AppUserMessages"); + + migrationBuilder.DropColumn( + name: "ConcurrencyStamp", + table: "AppGroupMessages"); + + migrationBuilder.DropColumn( + name: "ExtraProperties", + table: "AppGroupMessages"); + } + } +} diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/MessageServiceHostMigrationsDbContextModelSnapshot.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/MessageServiceHostMigrationsDbContextModelSnapshot.cs index 8082abdb1..8fcd36cd5 100644 --- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/MessageServiceHostMigrationsDbContextModelSnapshot.cs +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Migrations/MessageServiceHostMigrationsDbContextModelSnapshot.cs @@ -19,24 +19,27 @@ namespace LINGYUN.Abp.MessageService.Migrations .HasAnnotation("ProductVersion", "3.1.7") .HasAnnotation("Relational:MaxIdentifierLength", 64); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.ChatGroup", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatCard", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("bigint"); - b.Property("Address") - .HasColumnType("varchar(256) CHARACTER SET utf8mb4") - .HasMaxLength(256); + b.Property("Age") + .HasColumnType("int"); - b.Property("AdminUserId") - .HasColumnType("char(36)"); + b.Property("AvatarUrl") + .HasColumnType("varchar(512) CHARACTER SET utf8mb4") + .HasMaxLength(512); - b.Property("AllowAnonymous") - .HasColumnType("tinyint(1)"); + b.Property("Birthday") + .HasColumnType("datetime(6)"); - b.Property("AllowSendMessage") - .HasColumnType("tinyint(1)"); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); b.Property("CreationTime") .HasColumnName("CreationTime") @@ -47,11 +50,12 @@ namespace LINGYUN.Abp.MessageService.Migrations .HasColumnType("char(36)"); b.Property("Description") - .HasColumnType("varchar(128) CHARACTER SET utf8mb4") - .HasMaxLength(128); + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); - b.Property("GroupId") - .HasColumnType("bigint"); + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property("LastModificationTime") .HasColumnName("LastModificationTime") @@ -61,122 +65,117 @@ namespace LINGYUN.Abp.MessageService.Migrations .HasColumnName("LastModifierId") .HasColumnType("char(36)"); - b.Property("MaxUserCount") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("varchar(20) CHARACTER SET utf8mb4") - .HasMaxLength(20); + b.Property("NickName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); - b.Property("Notice") - .HasColumnType("varchar(64) CHARACTER SET utf8mb4") - .HasMaxLength(64); + b.Property("Sex") + .HasColumnType("int"); - b.Property("Tag") - .HasColumnType("varchar(512) CHARACTER SET utf8mb4") - .HasMaxLength(512); + b.Property("Sign") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); - b.HasKey("Id"); - - b.HasIndex("TenantId", "Name"); - - b.ToTable("AppChatGroups"); - }); - - modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.GroupChatBlack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)"); - - b.Property("CreatorId") - .HasColumnType("char(36)"); - - b.Property("GroupId") - .HasColumnType("bigint"); - - b.Property("ShieldUserId") + b.Property("UserId") .HasColumnType("char(36)"); - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("char(36)"); + b.Property("UserName") + .IsRequired() + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); b.HasKey("Id"); - b.HasIndex("TenantId", "GroupId"); + b.HasIndex("TenantId", "UserId"); - b.ToTable("AppGroupChatBlacks"); + b.ToTable("AppUserChatCards"); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.GroupMessage", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatFriend", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("bigint"); - b.Property("Content") - .IsRequired() - .HasColumnType("longtext CHARACTER SET utf8mb4") - .HasMaxLength(1048576); + b.Property("Black") + .HasColumnType("tinyint(1)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); b.Property("CreationTime") .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); b.Property("CreatorId") + .HasColumnName("CreatorId") .HasColumnType("char(36)"); - b.Property("GroupId") - .HasColumnType("bigint"); + b.Property("Description") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); - b.Property("MessageId") - .HasColumnType("bigint"); + b.Property("DontDisturb") + .HasColumnType("tinyint(1)"); - b.Property("SendState") - .HasColumnType("tinyint"); + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("SendUserName") - .IsRequired() - .HasColumnType("varchar(64) CHARACTER SET utf8mb4") - .HasMaxLength(64); + b.Property("FrientId") + .HasColumnType("char(36)"); + + b.Property("RemarkName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("SpecialFocus") + .HasColumnType("tinyint(1)"); + + b.Property("Status") + .HasColumnType("tinyint unsigned"); b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); - b.Property("Type") - .HasColumnType("int"); + b.Property("UserId") + .HasColumnType("char(36)"); b.HasKey("Id"); - b.HasIndex("TenantId", "GroupId"); + b.HasIndex("TenantId", "UserId", "FrientId"); - b.ToTable("AppGroupMessages"); + b.ToTable("AppUserChatFriends"); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatBlack", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatSetting", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("bigint"); - b.Property("CreationTime") - .HasColumnType("datetime(6)"); + b.Property("AllowAddFriend") + .HasColumnType("tinyint(1)"); - b.Property("CreatorId") - .HasColumnType("char(36)"); + b.Property("AllowAnonymous") + .HasColumnType("tinyint(1)"); - b.Property("ShieldUserId") - .HasColumnType("char(36)"); + b.Property("AllowReceiveMessage") + .HasColumnType("tinyint(1)"); + + b.Property("AllowSendMessage") + .HasColumnType("tinyint(1)"); + + b.Property("RequireAddFriendValition") + .HasColumnType("tinyint(1)"); b.Property("TenantId") .HasColumnName("TenantId") @@ -189,31 +188,26 @@ namespace LINGYUN.Abp.MessageService.Migrations b.HasIndex("TenantId", "UserId"); - b.ToTable("AppUserChatBlacks"); + b.ToTable("AppUserChatSettings"); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatCard", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserMessage", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("bigint"); - b.Property("Age") - .HasColumnType("int"); - - b.Property("AvatarUrl") - .HasColumnType("varchar(512) CHARACTER SET utf8mb4") - .HasMaxLength(512); - - b.Property("Birthday") - .HasColumnType("datetime(6)"); - b.Property("ConcurrencyStamp") .IsConcurrencyToken() .HasColumnName("ConcurrencyStamp") .HasColumnType("varchar(40) CHARACTER SET utf8mb4") .HasMaxLength(40); + b.Property("Content") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(1048576); + b.Property("CreationTime") .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); @@ -222,59 +216,55 @@ namespace LINGYUN.Abp.MessageService.Migrations .HasColumnName("CreatorId") .HasColumnType("char(36)"); - b.Property("Description") - .HasColumnType("varchar(50) CHARACTER SET utf8mb4") - .HasMaxLength(50); - b.Property("ExtraProperties") .HasColumnName("ExtraProperties") .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime(6)"); + b.Property("MessageId") + .HasColumnType("bigint"); - b.Property("LastModifierId") - .HasColumnName("LastModifierId") + b.Property("ReceiveUserId") .HasColumnType("char(36)"); - b.Property("NickName") - .HasColumnType("varchar(256) CHARACTER SET utf8mb4") - .HasMaxLength(256); - - b.Property("Sex") - .HasColumnType("int"); + b.Property("SendState") + .HasColumnType("tinyint"); - b.Property("Sign") - .HasColumnType("varchar(30) CHARACTER SET utf8mb4") - .HasMaxLength(30); + b.Property("SendUserName") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); - b.Property("UserId") - .HasColumnType("char(36)"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("varchar(256) CHARACTER SET utf8mb4") - .HasMaxLength(256); + b.Property("Type") + .HasColumnType("int"); b.HasKey("Id"); - b.HasIndex("TenantId", "UserId"); + b.HasIndex("TenantId", "ReceiveUserId"); - b.ToTable("AppUserChatCards"); + b.ToTable("AppUserMessages"); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatFriend", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Group.ChatGroup", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("bigint"); - b.Property("Black") + b.Property("Address") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("AdminUserId") + .HasColumnType("char(36)"); + + b.Property("AllowAnonymous") + .HasColumnType("tinyint(1)"); + + b.Property("AllowSendMessage") .HasColumnType("tinyint(1)"); b.Property("CreationTime") @@ -285,34 +275,49 @@ namespace LINGYUN.Abp.MessageService.Migrations .HasColumnName("CreatorId") .HasColumnType("char(36)"); - b.Property("DontDisturb") - .HasColumnType("tinyint(1)"); + b.Property("Description") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); - b.Property("FrientId") + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") .HasColumnType("char(36)"); - b.Property("RemarkName") - .HasColumnType("varchar(256) CHARACTER SET utf8mb4") - .HasMaxLength(256); + b.Property("MaxUserCount") + .HasColumnType("int"); - b.Property("SpecialFocus") - .HasColumnType("tinyint(1)"); + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.Property("Notice") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Tag") + .HasColumnType("varchar(512) CHARACTER SET utf8mb4") + .HasMaxLength(512); b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); - b.Property("UserId") - .HasColumnType("char(36)"); - b.HasKey("Id"); - b.HasIndex("TenantId", "UserId", "FrientId"); + b.HasIndex("TenantId", "Name"); - b.ToTable("AppUserChatFriends"); + b.ToTable("AppChatGroups"); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatGroup", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Group.GroupChatBlack", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -329,56 +334,21 @@ namespace LINGYUN.Abp.MessageService.Migrations b.Property("GroupId") .HasColumnType("bigint"); - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("char(36)"); - - b.Property("UserId") + b.Property("ShieldUserId") .HasColumnType("char(36)"); - b.HasKey("Id"); - - b.HasIndex("TenantId", "GroupId", "UserId"); - - b.ToTable("AppUserChatGroups"); - }); - - modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatSetting", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("AllowAddFriend") - .HasColumnType("tinyint(1)"); - - b.Property("AllowAnonymous") - .HasColumnType("tinyint(1)"); - - b.Property("AllowReceiveMessage") - .HasColumnType("tinyint(1)"); - - b.Property("AllowSendMessage") - .HasColumnType("tinyint(1)"); - - b.Property("RequireAddFriendValition") - .HasColumnType("tinyint(1)"); - b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); - b.Property("UserId") - .HasColumnType("char(36)"); - b.HasKey("Id"); - b.HasIndex("TenantId", "UserId"); + b.HasIndex("TenantId", "GroupId"); - b.ToTable("AppUserChatSettings"); + b.ToTable("AppGroupChatBlacks"); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserGroupCard", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Group.GroupMessage", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -390,6 +360,11 @@ namespace LINGYUN.Abp.MessageService.Migrations .HasColumnType("varchar(40) CHARACTER SET utf8mb4") .HasMaxLength(40); + b.Property("Content") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(1048576); + b.Property("CreationTime") .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); @@ -402,99 +377,107 @@ namespace LINGYUN.Abp.MessageService.Migrations .HasColumnName("ExtraProperties") .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("IsAdmin") - .HasColumnType("tinyint(1)"); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime(6)"); + b.Property("GroupId") + .HasColumnType("bigint"); - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("char(36)"); + b.Property("MessageId") + .HasColumnType("bigint"); - b.Property("NickName") - .HasColumnType("varchar(256) CHARACTER SET utf8mb4") - .HasMaxLength(256); + b.Property("SendState") + .HasColumnType("tinyint"); - b.Property("SilenceEnd") - .HasColumnType("datetime(6)"); + b.Property("SendUserName") + .IsRequired() + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); - b.Property("UserId") - .HasColumnType("char(36)"); + b.Property("Type") + .HasColumnType("int"); b.HasKey("Id"); - b.HasIndex("TenantId", "UserId"); + b.HasIndex("TenantId", "GroupId"); - b.ToTable("AppUserGroupCards"); + b.ToTable("AppGroupMessages"); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserMessage", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Group.UserChatGroup", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("bigint"); - b.Property("Content") - .IsRequired() - .HasColumnType("longtext CHARACTER SET utf8mb4") - .HasMaxLength(1048576); - b.Property("CreationTime") .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); b.Property("CreatorId") + .HasColumnName("CreatorId") .HasColumnType("char(36)"); - b.Property("MessageId") + b.Property("GroupId") .HasColumnType("bigint"); - b.Property("ReceiveUserId") - .HasColumnType("char(36)"); - - b.Property("SendState") - .HasColumnType("tinyint"); - - b.Property("SendUserName") - .IsRequired() - .HasColumnType("varchar(64) CHARACTER SET utf8mb4") - .HasMaxLength(64); - b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); - b.Property("Type") - .HasColumnType("int"); + b.Property("UserId") + .HasColumnType("char(36)"); b.HasKey("Id"); - b.HasIndex("TenantId", "ReceiveUserId"); + b.HasIndex("TenantId", "GroupId", "UserId"); - b.ToTable("AppUserMessages"); + b.ToTable("AppUserChatGroups"); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserSpecialFocus", b => + modelBuilder.Entity("LINGYUN.Abp.MessageService.Group.UserGroupCard", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("bigint"); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + b.Property("CreationTime") + .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); b.Property("CreatorId") + .HasColumnName("CreatorId") .HasColumnType("char(36)"); - b.Property("FocusUserId") + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsAdmin") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") .HasColumnType("char(36)"); + b.Property("NickName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("SilenceEnd") + .HasColumnType("datetime(6)"); + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); @@ -506,7 +489,7 @@ namespace LINGYUN.Abp.MessageService.Migrations b.HasIndex("TenantId", "UserId"); - b.ToTable("AppUserSpecialFocuss"); + b.ToTable("AppUserGroupCards"); }); modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.Notification", b => @@ -522,11 +505,6 @@ namespace LINGYUN.Abp.MessageService.Migrations b.Property("ExpirationTime") .HasColumnType("datetime(6)"); - b.Property("NotificationCateGory") - .IsRequired() - .HasColumnType("varchar(50) CHARACTER SET utf8mb4") - .HasMaxLength(50); - b.Property("NotificationData") .IsRequired() .HasColumnType("longtext CHARACTER SET utf8mb4") diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Notifications/MessageServiceDefinitionProvider.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Notifications/MessageServiceDefinitionProvider.cs deleted file mode 100644 index 144ee3b3a..000000000 --- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Notifications/MessageServiceDefinitionProvider.cs +++ /dev/null @@ -1,25 +0,0 @@ -using LINGYUN.Abp.MessageService.Localization; -using LINGYUN.Abp.Notifications; -using Volo.Abp.Localization; - -namespace LINGYUN.Abp.MessageService.Notifications -{ - public class MessageServiceDefinitionProvider : NotificationDefinitionProvider - { - public override void Define(INotificationDefinitionContext context) - { - context.Add(new NotificationDefinition( - "TestApplicationNotofication", - L("TestApplicationNotofication"), - L("TestApplicationNotofication"), - notificationType: NotificationType.Application, - lifetime: NotificationLifetime.OnlyOne, - allowSubscriptionToClients: true)); - } - - protected LocalizableString L(string name) - { - return LocalizableString.Create(name); - } - } -} diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Permissions/AbpMessageServicePermissionDefinitionProvider.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Permissions/AbpMessageServicePermissionDefinitionProvider.cs deleted file mode 100644 index c5ba7020a..000000000 --- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Permissions/AbpMessageServicePermissionDefinitionProvider.cs +++ /dev/null @@ -1,22 +0,0 @@ -using LINGYUN.Abp.MessageService.Localization; -using Volo.Abp.Authorization.Permissions; -using Volo.Abp.Localization; - -namespace LINGYUN.Abp.MessageService.Permissions -{ - public class AbpMessageServicePermissionDefinitionProvider : PermissionDefinitionProvider - { - public override void Define(IPermissionDefinitionContext context) - { - var group = context.GetGroup(MessageServicePermissions.GroupName); - - var hangfirePermission = group.AddPermission(AbpMessageServicePermissions.Hangfire.Default, L("Permission:Hangfire")); - hangfirePermission.AddChild(AbpMessageServicePermissions.Hangfire.ManageQueue, L("Permission:ManageQueue")); - } - - private static LocalizableString L(string name) - { - return LocalizableString.Create(name); - } - } -} diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Permissions/AbpMessageServicePermissions.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Permissions/AbpMessageServicePermissions.cs deleted file mode 100644 index ff2aeb98f..000000000 --- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Permissions/AbpMessageServicePermissions.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace LINGYUN.Abp.MessageService.Permissions -{ - public class AbpMessageServicePermissions - { - public class Hangfire - { - public const string Default = MessageServicePermissions.GroupName + ".Hangfire"; - - public const string ManageQueue = Default + ".ManageQueue"; - } - } -} diff --git a/vueJs/package-lock.json b/vueJs/package-lock.json index 03671975a..a6c66486a 100644 --- a/vueJs/package-lock.json +++ b/vueJs/package-lock.json @@ -2019,37 +2019,12 @@ "glob-to-regexp": "^0.3.0" } }, - "@nodelib/fs.scandir": { - "version": "2.1.3", - "resolved": "https://registry.npm.taobao.org/@nodelib/fs.scandir/download/@nodelib/fs.scandir-2.1.3.tgz", - "integrity": "sha1-Olgr21OATGum0UZXnEblITDPSjs=", - "requires": { - "@nodelib/fs.stat": "2.0.3", - "run-parallel": "^1.1.9" - }, - "dependencies": { - "@nodelib/fs.stat": { - "version": "2.0.3", - "resolved": "https://registry.npm.taobao.org/@nodelib/fs.stat/download/@nodelib/fs.stat-2.0.3.tgz", - "integrity": "sha1-NNxfTKu8cg9OYPdadH5+zWwXW9M=" - } - } - }, "@nodelib/fs.stat": { "version": "1.1.3", "resolved": "https://registry.npm.taobao.org/@nodelib/fs.stat/download/@nodelib/fs.stat-1.1.3.tgz", "integrity": "sha1-K1o6s/kYzKSKjHVMCBaOPwPrphs=", "dev": true }, - "@nodelib/fs.walk": { - "version": "1.2.4", - "resolved": "https://registry.npm.taobao.org/@nodelib/fs.walk/download/@nodelib/fs.walk-1.2.4.tgz", - "integrity": "sha1-ARuSAqcKY2bkNspcBlhEUoqwSXY=", - "requires": { - "@nodelib/fs.scandir": "2.1.3", - "fastq": "^1.6.0" - } - }, "@samverschueren/stream-to-observable": { "version": "0.3.0", "resolved": "https://registry.npm.taobao.org/@samverschueren/stream-to-observable/download/@samverschueren/stream-to-observable-0.3.0.tgz", @@ -4688,7 +4663,8 @@ "big.js": { "version": "5.2.2", "resolved": "https://registry.npm.taobao.org/big.js/download/big.js-5.2.2.tgz", - "integrity": "sha1-ZfCvOC9Xi83HQr2cKB6cstd2gyg=" + "integrity": "sha1-ZfCvOC9Xi83HQr2cKB6cstd2gyg=", + "dev": true }, "binary-extensions": { "version": "1.13.1", @@ -7587,7 +7563,8 @@ "emojis-list": { "version": "3.0.0", "resolved": "https://registry.npm.taobao.org/emojis-list/download/emojis-list-3.0.0.tgz", - "integrity": "sha1-VXBmIEatKeLpFucariYKvf9Pang=" + "integrity": "sha1-VXBmIEatKeLpFucariYKvf9Pang=", + "dev": true }, "encodeurl": { "version": "1.0.2", @@ -8823,14 +8800,6 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, - "fastq": { - "version": "1.8.0", - "resolved": "https://registry.npm.taobao.org/fastq/download/fastq-1.8.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffastq%2Fdownload%2Ffastq-1.8.0.tgz", - "integrity": "sha1-VQ4fn1m7xl/hhctqm02VNXEH9IE=", - "requires": { - "reusify": "^1.0.4" - } - }, "faye-websocket": { "version": "0.10.0", "resolved": "https://registry.npm.taobao.org/faye-websocket/download/faye-websocket-0.10.0.tgz", @@ -11002,7 +10971,8 @@ "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npm.taobao.org/is-extglob/download/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true }, "is-finite": { "version": "1.1.0", @@ -11025,6 +10995,7 @@ "version": "4.0.1", "resolved": "https://registry.npm.taobao.org/is-glob/download/is-glob-4.0.1.tgz", "integrity": "sha1-dWfb6fL14kZ7x3q4PEopSCQHpdw=", + "dev": true, "requires": { "is-extglob": "^2.1.1" } @@ -14494,6 +14465,7 @@ "version": "2.1.3", "resolved": "https://registry.npm.taobao.org/json5/download/json5-2.1.3.tgz", "integrity": "sha1-ybD3+pIzv+WAf+ZvzzpWF+1ZfUM=", + "dev": true, "requires": { "minimist": "^1.2.5" } @@ -14562,11 +14534,6 @@ "integrity": "sha1-p5yezIbuHOP6YgbRIWxQHxR/wH4=", "dev": true }, - "klona": { - "version": "2.0.4", - "resolved": "https://registry.npm.taobao.org/klona/download/klona-2.0.4.tgz?cache=0&sync_timestamp=1600226641291&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fklona%2Fdownload%2Fklona-2.0.4.tgz", - "integrity": "sha1-e7Hjr/sMuGJFR+9+j2cI6i4538A=" - }, "launch-editor": { "version": "2.2.1", "resolved": "https://registry.npm.taobao.org/launch-editor/download/launch-editor-2.2.1.tgz", @@ -16182,7 +16149,8 @@ "merge2": { "version": "1.3.0", "resolved": "https://registry.npm.taobao.org/merge2/download/merge2-1.3.0.tgz", - "integrity": "sha1-WzZu6DsvFYLEj4fkfPGpNSEDyoE=" + "integrity": "sha1-WzZu6DsvFYLEj4fkfPGpNSEDyoE=", + "dev": true }, "methods": { "version": "1.1.2", @@ -16681,7 +16649,8 @@ "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npm.taobao.org/normalize-path/download/normalize-path-3.0.0.tgz", - "integrity": "sha1-Dc1p/yOhybEf0JeDFmRKA4ghamU=" + "integrity": "sha1-Dc1p/yOhybEf0JeDFmRKA4ghamU=", + "dev": true }, "normalize-range": { "version": "0.1.2", @@ -17287,7 +17256,8 @@ "picomatch": { "version": "2.2.2", "resolved": "https://registry.npm.taobao.org/picomatch/download/picomatch-2.2.2.tgz", - "integrity": "sha1-IfMz6ba46v8CRo9RRupAbTRfTa0=" + "integrity": "sha1-IfMz6ba46v8CRo9RRupAbTRfTa0=", + "dev": true }, "pify": { "version": "4.0.1", @@ -18802,11 +18772,6 @@ "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", "dev": true }, - "reusify": { - "version": "1.0.4", - "resolved": "https://registry.npm.taobao.org/reusify/download/reusify-1.0.4.tgz", - "integrity": "sha1-kNo4Kx4SbvwCFG6QhFqI2xKSXXY=" - }, "rgb-regex": { "version": "1.0.1", "resolved": "https://registry.npm.taobao.org/rgb-regex/download/rgb-regex-1.0.1.tgz", @@ -18849,11 +18814,6 @@ "integrity": "sha1-hEDsz5nqPnC9QJ1JqriOEMGJpFU=", "dev": true }, - "run-parallel": { - "version": "1.1.9", - "resolved": "https://registry.npm.taobao.org/run-parallel/download/run-parallel-1.1.9.tgz", - "integrity": "sha1-yd06fPn0ssS2JE4XOm7YZuYd1nk=" - }, "run-queue": { "version": "1.0.3", "resolved": "https://registry.npm.taobao.org/run-queue/download/run-queue-1.0.3.tgz", @@ -19979,125 +19939,6 @@ } } }, - "stylus-loader": { - "version": "4.1.1", - "resolved": "https://registry.npm.taobao.org/stylus-loader/download/stylus-loader-4.1.1.tgz", - "integrity": "sha1-DpT11idJMqLa0FTRpzazIUasepk=", - "requires": { - "fast-glob": "^3.2.4", - "klona": "^2.0.4", - "loader-utils": "^2.0.0", - "normalize-path": "^3.0.0", - "schema-utils": "^3.0.0" - }, - "dependencies": { - "@nodelib/fs.stat": { - "version": "2.0.3", - "resolved": "https://registry.npm.taobao.org/@nodelib/fs.stat/download/@nodelib/fs.stat-2.0.3.tgz", - "integrity": "sha1-NNxfTKu8cg9OYPdadH5+zWwXW9M=" - }, - "@types/json-schema": { - "version": "7.0.6", - "resolved": "https://registry.npm.taobao.org/@types/json-schema/download/@types/json-schema-7.0.6.tgz", - "integrity": "sha1-9MfsQ+gbMZqYFRFQMXCfJph4kfA=" - }, - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npm.taobao.org/ajv/download/ajv-6.12.6.tgz?cache=0&sync_timestamp=1603561543180&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fajv%2Fdownload%2Fajv-6.12.6.tgz", - "integrity": "sha1-uvWmLoArB9l3A0WG+MO69a3ybfQ=", - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ajv-keywords": { - "version": "3.5.2", - "resolved": "https://registry.npm.taobao.org/ajv-keywords/download/ajv-keywords-3.5.2.tgz?cache=0&sync_timestamp=1603565974467&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fajv-keywords%2Fdownload%2Fajv-keywords-3.5.2.tgz", - "integrity": "sha1-MfKdpatuANHC0yms97WSlhTVAU0=" - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npm.taobao.org/braces/download/braces-3.0.2.tgz", - "integrity": "sha1-NFThpGLujVmeI23zNs2epPiv4Qc=", - "requires": { - "fill-range": "^7.0.1" - } - }, - "fast-glob": { - "version": "3.2.4", - "resolved": "https://registry.npm.taobao.org/fast-glob/download/fast-glob-3.2.4.tgz?cache=0&sync_timestamp=1592290276588&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffast-glob%2Fdownload%2Ffast-glob-3.2.4.tgz", - "integrity": "sha1-0grvv5lXk4Pn88xmUpFYybmFVNM=", - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", - "merge2": "^1.3.0", - "micromatch": "^4.0.2", - "picomatch": "^2.2.1" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npm.taobao.org/fill-range/download/fill-range-7.0.1.tgz", - "integrity": "sha1-GRmmp8df44ssfHflGYU12prN2kA=", - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "glob-parent": { - "version": "5.1.1", - "resolved": "https://registry.npm.taobao.org/glob-parent/download/glob-parent-5.1.1.tgz", - "integrity": "sha1-tsHvQXxOVmPqSY8cRa+saRa7wik=", - "requires": { - "is-glob": "^4.0.1" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npm.taobao.org/is-number/download/is-number-7.0.0.tgz", - "integrity": "sha1-dTU0W4lnNNX4DE0GxQlVUnoU8Ss=" - }, - "loader-utils": { - "version": "2.0.0", - "resolved": "https://registry.npm.taobao.org/loader-utils/download/loader-utils-2.0.0.tgz?cache=0&sync_timestamp=1584445172927&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Floader-utils%2Fdownload%2Floader-utils-2.0.0.tgz", - "integrity": "sha1-5MrOW4FtQloWa18JfhDNErNgZLA=", - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - } - }, - "micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npm.taobao.org/micromatch/download/micromatch-4.0.2.tgz", - "integrity": "sha1-T8sJmb+fvC/L3SEvbWKbmlbDklk=", - "requires": { - "braces": "^3.0.1", - "picomatch": "^2.0.5" - } - }, - "schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npm.taobao.org/schema-utils/download/schema-utils-3.0.0.tgz", - "integrity": "sha1-Z1AvaqK2ai1AMrQnmilEl4oJE+8=", - "requires": { - "@types/json-schema": "^7.0.6", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npm.taobao.org/to-regex-range/download/to-regex-range-5.0.1.tgz", - "integrity": "sha1-FkjESq58jZiKMmAY7XL1tN0DkuQ=", - "requires": { - "is-number": "^7.0.0" - } - } - } - }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-5.5.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-5.5.0.tgz", diff --git a/vueJs/package.json b/vueJs/package.json index 6eb1f57b7..2970d1cf1 100644 --- a/vueJs/package.json +++ b/vueJs/package.json @@ -42,7 +42,6 @@ "script-loader": "^0.7.2", "simple-progress-webpack-plugin": "^1.1.2", "sortablejs": "^1.10.2", - "stylus-loader": "^4.1.1", "tinymce": "^5.2.1", "tui-editor": "^1.4.10", "view-design": "^4.2.0", diff --git a/vueJs/src/api/instant-message.ts b/vueJs/src/api/instant-message.ts index f95129b1e..5c6585b85 100644 --- a/vueJs/src/api/instant-message.ts +++ b/vueJs/src/api/instant-message.ts @@ -9,6 +9,11 @@ export default class ImApiService { return ApiService.Post(_url, payload, serviceUrl) } + public static addRequest(payload: RequestUserFriend) { + const _url = '/api/im/my-friends/add-request' + return ApiService.Post(_url, payload, serviceUrl) + } + public static getMyFriends(payload: MyFriendGetByPaged) { let _url = '/api/im/my-friends' _url += '?filter=' + payload.filter @@ -49,6 +54,16 @@ export default class ImApiService { export class AddUserFriend { friendId!: string + + constructor( + friendId: string + ) { + this.friendId = friendId + } +} + +export class RequestUserFriend { + friendId!: string remarkName!: string constructor( diff --git a/vueJs/src/api/notification.ts b/vueJs/src/api/notification.ts new file mode 100644 index 000000000..9e53f0279 --- /dev/null +++ b/vueJs/src/api/notification.ts @@ -0,0 +1,116 @@ +import VueI18n from 'vue-i18n' +import { urlStringify } from '@/utils' + +import ApiService from './serviceBase' +import { ListResultDto, PagedAndSortedResultRequestDto, PagedResultDto } from './types' + +const serviceUrl = process.env.VUE_APP_BASE_API + +export default class NotificationApiService { + public static getNotifications(payload: UserNotificationGetByPaged) { + let _url = '/api/my-notifilers?' + _url += urlStringify(payload) + return ApiService.Get>(_url, serviceUrl) + } + + public static getAssignableNotifiers() { + const _url = '/api/my-notifilers/assignables' + return ApiService.Get>(_url, serviceUrl) + } + + public static getMySubscribedNotifiers() { + const _url = '/api/my-subscribes/all' + return ApiService.Get>(_url, serviceUrl) + } + + public static subscribeNotifier(name: string) { + const _url = '/api/my-subscribes' + const payload = new UserSubscreNotification() + payload.name = name + return ApiService.Post(_url, payload, serviceUrl) + } + + public static unSubscribeNotifier(name: string) { + const _url = '/api/my-subscribes?name=' + name + return ApiService.Delete(_url, serviceUrl) + } +} + +export enum NotificationReadState { + Read = 0, + UnRead = 1 +} + +export enum NotificationLifetime { + Persistent = 0, + OnlyOne = 1 +} + +export enum NotificationType { + Application = 0, + System = 10, + User = 20 +} + +export enum NotificationSeverity { + Success = 0, + Info = 10, + Warn = 20, + Error = 30, + Fatal = 40 +} + +export class NotificationData { + properties: {[key: string]: any} = {} +} + +export class NotificationInfo { + tenantId? = '' + name = '' + id = '' + data!: NotificationData + creationTime!: Date + lifetime!: NotificationLifetime + type!: NotificationType + severity!: NotificationSeverity + + public static tryParseNotifier(notifier: NotificationInfo, l: VueI18n) { + const data = new NotificationData() + data.properties = notifier.data.properties + if (notifier.data.properties.localizer) { + data.properties.title = l.t(data.properties.title.resourceName + '.' + data.properties.title.name, data.properties.title.values) + data.properties.message = l.t(data.properties.message.resourceName + '.' + data.properties.message.name, data.properties.message.values) + if (data.properties.description) { + data.properties.description = l.t(data.properties.description.resourceName + '.' + data.properties.description.name, data.properties.description.values) + } + notifier.data = data + } + return notifier + } +} + +export class UserNotificationGetByPaged extends PagedAndSortedResultRequestDto { + skipCount = 0 + maxResultCount = 10 + filter = '' + reverse = true + readState = NotificationReadState.UnRead +} + +export class Notification { + name = '' + displayName = '' + description = '' + lifetime = NotificationLifetime.Persistent + type = NotificationType.User +} + +export class NotificationGroup { + name = '' + displayName = '' + notifications = new Array() +} + +export class UserSubscreNotification { + name = '' +} diff --git a/vueJs/src/assets/im-images/top-buttom.png b/vueJs/src/assets/im-images/top-buttom.png new file mode 100644 index 0000000000000000000000000000000000000000..bc1d8fe1bf03f0bf053a9f66e339ad55a577744c GIT binary patch literal 5520 zcmV;B6>sW^P)niB8{K$~>%CLp&7)Z_hByw4^lJh}pHmmdL!pZ$6Nrm7tynK1(3kpPVV zuul<<|0;o(gQeGflC)-Zyx)gKY^&(3yCeXDkxxf}=yZTiCD3pHzM@;ov;kVjtiQtG z=hr1_{?c)BxNEt~0HCGQ3BEA^8-IDHD-2Enc%F%$Ul*@g+35r=)v?L-|MBOnHl+*yq$CKqcA#3fKXsmRO3 z>a-tKrvgAQnjTGrtHBg$KNGZLOGJwa^guG+|Ih8%s%2B10sz67cDSVDY9?G>B*QcT zv=QJ&G5*va;KKoQ6Qg%V#f%1tr2CUf|Gzn_={&H}%-(i(WSn`K|(UUvJc- z4Pbr^5+%X(4rQC(NiN>+|J?8nkN@OAuIhFeh!11tAQ6Ux5pu(;P#p#yX4Y?Am#BH) zE1pjIbQl1Fv2+wn*AsAzQ=wba6KJK5+{?sR*`r6*%2oCKKW_^^ySj&-{%-fZdiOsT z$Qj$u6T$cafL?a>EWUqCgjANWLuyLFH+3wx01K0q9P+?$ZN|AphMC^dba{vURTSpUee-)HrBNI0|HM>DuK9@Hmqnp1HjM;n+NGq^;-aX+6zawsfz!4d%E(W2t_mVM5hD- zPV(wz(Gvh1ewMa(&u&=GK+vwsnCOaB-2WRpx^ny;j%n91<2Di9CC0I96Y`rPv_&5Q zLeX>rpb2)u5aG;ZT>hgST{(XbMj9hTx?*PoB6>?lc5GXx&^C_%!RVHm1nFj5fju0y z?Aq$;--nF-ps&=k*H!^N7O09mRe;Wvq)h+_#WH7ud6As}#P~@vAwO(KSNZ;p1)8s- ztLzuZjLX|{cibPQTUCIS0;mFoAm~wVgrp7+s$*G0?*1NHb zYXF3z=|upYUFm!`W*4s$j%e30*(?kRi`BSn*%xLlx&naELWSuuHQ~QNT-6GtnFT_T z%%dPa-*Ppt^99L8fybO$(G>tfG3^yFPBLwb@kUnqdd!CS0U`?-r!tov{ZX-x`c>&Y zUIbY>n{4ROT^i-oLB=rvf|2xjL}Z1uFF`y;jR%&OT~8HJ;ZQ7n0+@^=^SvyZxkXjv zUpf)PF#tjl?R9G;@=dA|nB_!>3ayw0LecaLfNrs%-VWyD)kHw(INspn2mqmI;{||j zbzS?e-tDUq>ly}a6H}=|<-`I*CV$XZYU;HLz<*fOyF*pvpNsN!2msBvv|fp8>!B@^9e z@iQ(}6Y|L-Vh90XXsq!_o%IbC48NpocCgzQI3j{pXuh$)uyNcg+at3UjKj>Q(aL#0|9ED)ZMKA$Ce)RYC$f2nc5`C?Jz zAjo*n2ZE^!mkvH-of7y{8}z7Db!mZN!``gU9yDmX`5Q!jR8;~OTCuks0YcIABLEe? z)gx?Ci;PV1ZCnGk(4?g;+6oWl9NHKFPBOKrFKk%!3OxKtz8@#{EC^K#x6G z%zvEs%1Ss=CmdxgbaWkSeciEP`b27Tz@?e@bMLBs5Cp*p`k)hILz9G!GbdA=hzLO+;U6Hpz2kFioOvmIRSY|YqM6?SZ1U)qwyBE0pX(7|*tpHTvfZn{v|ws)Rt=OCed?pj_1aN2p-gnp48ZU0$m7?-);AzZxxxZBi_!z+5(`)H=cT$_z3PsX4 zfM~86MXtK%fb~!I-eS5?v=YdO*2RFuBTeZ-Rq1cO2yvn9?0QZBu=FryAU&g&YMin! zD(?mSE~p@2|1BmFUYtJJ2yp3L2}ZSZ2zb(>gDu|>SWW?1^f(v>B6Ooe0^5O`~B0d14O>h zZs6O&FxqocQgyXt8@8>eyzAL`o;A#g&|o}JH-)ZrRL6oi6xIG0z`=z`jP*fMkte$v z0qkD=sETa6jTBXKP6IDxb{-G7u9j?NC?@aO^~|C=w$Kq_+4RX|?o{iLVJNB@3w5(t z%F9$mHf_t&c;RT{G={#%wx&fs)};edi~1W|oHmzP3wSP(-~#ZQ)>hZml5L#9V)C9{ z&qfTNGz1J-~$~7o=qw8cvmBUoe!W+`Y5l$qR(EylR>C= zXq1QQYRNYEQjvMz55g4=<-VY<*3z@u5xY<{{WU<{3r_*`cvA73#$>cv17s!u`F(l8 z;$^UcnU8Xx>T0Y3;UH1%nQ`2VDfF5heKC2@ZQwCFL;Nm;uxjVtICJ-2~R))~g57-L(QKhPpzGYD@o zn~&0bwADiq+bvWms=W%}ghCAvkV-1D?LOS8QmyIdKFJ5_S@iRNg>{!+N;})aYxlah zJkH+(LBDCLkxRh4GV^KfR+Y<#%h@vHT>8j6&U<{rbv zwm=#44@DYJ1L>wQ775l{z+F?6wFQSnwj3;xWE?e`6ken%fzr(J)5*aVj%p7xaIxv| zE)bf>b_6h(hoYJF02`h;h06A?n^3cHiEJ#SDy1DQ5Q=CYf^dLYlRh6Exn`l?h}~#f zga8nXY7Y@`i8&X2f*P+8+rPJ?fl9e4J6{cv`Cn)X$d3TA^dvAnWjYCfA4n+y&u+I$ zx#PUjEfmSz3*w)e&&>F>nviX8SA|A^e4?bi`WUZJ3SKz^Nb9U0*OA$;yfSQ8;1itC z_#Kk;HvpJ>WRq{S8t-Qtr9}t;`B5OE-2sAy11R02Dt^yyxVl0|bd-$YXnGEVZZvP7 zm#a#^G>${-dg1_xZ9M^;GY*9;78LsN#ZGb3QAY19?H(Qb=b<@nGX8$^JVb<_sd3pj zNwqD)0LYI5(e$4HD)Yl@`T)|z90L{}t zdLqcqqg9WnN{wy!*dp1dq}dLMeL6&9-|GN+m?>&pNG0RqfjS(G0C^C^wB_LZB~8IX zguf=^vT@N;DIQzE?pPi~>#M$Q8nODhfx@ql90MR2)h;I3xIr`Ds3ropdaQq0v)h$k z#@g}3Mc`=10BBwdWL^f?@=YKE=cW|d^z5Lld()xvyCR1h8Q2OvmCJJzc?eplSyuoE z$F}^CS$f%8589gBxg)&(+5L-p9qQ1QU6MQ$OTP%F)2xIi=u?tPjZ>dWXMrMH3t)Q^ z)l9rrRb;DhW?iyF+EeIIG;<%oHm9uovZ@3u0b;slbF0kYa~cnjcIK9vxg)pYTiF`A zG;%1ST?5K{Mp+hSoRvz*=5IJHYP*^OTKL)dqy4*Grm1SeZ|CP{r)ODx4@R_cM6k`2 z&fw`OC1CnI+|Foi0ziI27|YxMW?KQ6@T1P2`rXc0?e#qv&HR|aw)uhy^oOM4x6C78 zCv%$tkOx6jGZI8kv29GiLBWnksecbf(|0zfoVO`NuhCB5>B+@?g<=AGz6NN`Fds>z zNA;^<%lNe|Req@|vQ@})JJn0}yIt6~R*I*koPO%sXKE~>w~3j_lM%pZsyTCL)kd=? zO0C5q;CDMIedUJuQB7iEmNwOKv5$Iw#oZSJbgGc1f>*sFygUPd(b$lfHcVm&X0xO} z6YEzd6M=U{1T9sXA(6}x60wniWrT>1UazG*1%RPIaMISnl*@@l4Pkr)qWP-gzgI;0 zQlkmy18~rEfCq`_MxeT+;x~;CEW%@V8qWb>G%zf-b>A%K)>wED?Is7kqC>yETmnuG zjcCW{l<#=qRBuGMG#Qs4a?{CHb&3LjmIfUxYMQGs9`Z@u=C6tG`<~Z|b_#woSqiP! zrUORji)2}Ek-B(S>_r7YeoBaCW)X9pgAPbD>$j&8H6@jNA{zAu#v{# zNJ2Y}I{=#l2PrDJ0qQO~-s-m54iZ84PFy7~04&|`Lq9}DnL`f@aR z%`?`1{ch!Isn;$5$b+EyiP=4tzHEiH*#_o%<~$H=gF&>_AYRlru5aP1iZKwgN%m;g z-1Ak{-7i@EM#I!H5wE&FtZ9suR_Yb?$fK)HHm(%!m=7C zn?7I|>lg;&;Q)ngJ5-z?XLS6I9XziiAJ%p_06ZTJ3Uq*xT`Q^hooq#6|N2I}r+23` zV)rrW^SlbN=Ux(rxr5u%kVxI&gvODO^hpF5k4sFFREcoflcq|?z}1W7Pef`DJxd#? zce4z@EW&1Ynok&52whs(nRYXsVg%UTQb(NqasO_<>PZqwlk)SeCxsqS75_ydtb)<> zV+1k{t|-Ezg~oU%p|ifQDYtWBvDPL|nrm-fdA9Y#lMn z;5|69`4}Hn8*lI0QobPIDUxX6+Nb^IaTeRsf=6{bJpfwt96Dj!Ag1hT3^F2?jRx_7 zPHn)17gBL~tW~{GEb}6m-FVo(N1zp8UO`;-^4djxt>P;>6}@QmT?PQVTOd4P>+wwb zXofzTC=ZH#M65*2W0Q$M!7Qhuj+ndJ`4q$}pwkMfqUFhj{vLgERcn<>|LYA<%043Ls4z5abRg`W#X5>v;sPoXMO1vrQp$25&-zt znjzL0)me{Q{wmBDsfoZNt!bK_Gt9H27__;aP2VlGmrf-I0HdP>=JCy{BJbZC03pl# z$cC!|?n)`L>AQT-$L4loSegKcq=$mY@JO;4&3Q&L5ty9^OjI+XY5%tc`Ip?&Uz2)* zta2!}QG&{v;e(o$Icq`?v3ou9Y(lS$s8@XS&hq90P(h0+L2qy0$|t# zZNIF9_pPF7fayMvPJmScC*Gtg0rN#=J9btvnkrcUG>-z>wIG=0%o8&xU!^L6lJ#0H zX#gPagxQz`c!*eM??JUnRpho``MPYpJ*t&90PR}sYD*z~SG*kdk0YI5s zpv={;i~tn?l(_}UT>Z)jPys-hTcFI -
-
- -
-
- - - - - diff --git a/vueJs/src/components/InstantMessage/components/AddFriend.vue b/vueJs/src/components/Lemon-IMUI/components/AddFriend.vue similarity index 95% rename from vueJs/src/components/InstantMessage/components/AddFriend.vue rename to vueJs/src/components/Lemon-IMUI/components/AddFriend.vue index fe02efacd..6dedffc4a 100644 --- a/vueJs/src/components/InstantMessage/components/AddFriend.vue +++ b/vueJs/src/components/Lemon-IMUI/components/AddFriend.vue @@ -80,7 +80,7 @@ import EventBusMiXin from '@/mixins/EventBusMiXin' import Component, { mixins } from 'vue-class-component' import { User } from '@/api/users' -import ImApiService, { AddUserFriend } from '@/api/instant-message' +import ImApiService, { RequestUserFriend } from '@/api/instant-message' import UserLookupApiService from '@/api/user-lookup' import { abpPagerFormat } from '@/utils' @@ -153,12 +153,11 @@ export default class extends mixins(EventBusMiXin) { } private onAddFriendClick(user: User) { - const addFriend = new AddUserFriend(user.id, user.userName) + const requestFriend = new RequestUserFriend(user.id, user.userName) ImApiService - .addFriend(addFriend) + .addRequest(requestFriend) .then(() => { this.$message.success('已发送用户好友申请') - this.trigger('onUserFriendAdded', user) }) } } diff --git a/vueJs/src/components/Lemon-IMUI/components/Avatar.vue b/vueJs/src/components/Lemon-IMUI/components/Avatar.vue deleted file mode 100644 index a9a1efd7e..000000000 --- a/vueJs/src/components/Lemon-IMUI/components/Avatar.vue +++ /dev/null @@ -1,54 +0,0 @@ - - - diff --git a/vueJs/src/components/Lemon-IMUI/index.vue b/vueJs/src/components/Lemon-IMUI/index.vue index e69de29bb..8f54a773c 100644 --- a/vueJs/src/components/Lemon-IMUI/index.vue +++ b/vueJs/src/components/Lemon-IMUI/index.vue @@ -0,0 +1,773 @@ + + + + + diff --git a/vueJs/src/components/Notification/components/UserNofitications.vue b/vueJs/src/components/Notification/components/UserNofitications.vue index a40ca1b74..4d5cc440b 100644 --- a/vueJs/src/components/Notification/components/UserNofitications.vue +++ b/vueJs/src/components/Notification/components/UserNofitications.vue @@ -1,7 +1,12 @@