diff --git a/aspnet-core/LINGYUN.MicroService.All.sln b/aspnet-core/LINGYUN.MicroService.All.sln index e4a9ea883..6738df512 100644 --- a/aspnet-core/LINGYUN.MicroService.All.sln +++ b/aspnet-core/LINGYUN.MicroService.All.sln @@ -408,7 +408,23 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Platform.Theme.VueV EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Platform.Settings.VueVbenAdmin", "modules\platform\LINGYUN.Platform.Settings.VueVbenAdmin\LINGYUN.Platform.Settings.VueVbenAdmin.csproj", "{8DF55DAB-4C1D-46F7-9324-0050F47B3BED}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Notifications.TextTemplating", "modules\common\LINGYUN.Abp.Notifications.TextTemplating\LINGYUN.Abp.Notifications.TextTemplating.csproj", "{06FF5EFA-DEDA-4E12-A482-8FCE4077F68A}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "text-templating", "text-templating", "{ABD89F39-62D9-439E-8662-BE4F36BFA04F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TextTemplating.Domain.Shared", "modules\text-templating\LINGYUN.Abp.TextTemplating.Domain.Shared\LINGYUN.Abp.TextTemplating.Domain.Shared.csproj", "{D4B4800F-6238-4EA9-A9BB-298D668C26C4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TextTemplating.Domain", "modules\text-templating\LINGYUN.Abp.TextTemplating.Domain\LINGYUN.Abp.TextTemplating.Domain.csproj", "{F9AC4123-7987-47D3-85D6-CD13928F3683}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TextTemplating.Application.Contracts", "modules\text-templating\LINGYUN.Abp.TextTemplating.Application.Contracts\LINGYUN.Abp.TextTemplating.Application.Contracts.csproj", "{22BDDF5C-F911-4978-B83F-981F3652BF45}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TextTemplating.Application", "modules\text-templating\LINGYUN.Abp.TextTemplating.Application\LINGYUN.Abp.TextTemplating.Application.csproj", "{0C824BB4-81FC-4B28-B7B1-07B2B2BB70A0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TextTemplating.HttpApi", "modules\text-templating\LINGYUN.Abp.TextTemplating.HttpApi\LINGYUN.Abp.TextTemplating.HttpApi.csproj", "{4711320B-F98D-4CB0-BFEB-B9685B6CBCB7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TextTemplating.EntityFrameworkCore", "modules\text-templating\LINGYUN.Abp.TextTemplating.EntityFrameworkCore\LINGYUN.Abp.TextTemplating.EntityFrameworkCore.csproj", "{130F8ED1-A64F-48DE-BF43-18EAD19CAF63}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TextTemplating.HttpApi.Client", "modules\text-templating\LINGYUN.Abp.TextTemplating.HttpApi.Client\LINGYUN.Abp.TextTemplating.HttpApi.Client.csproj", "{A53FE09E-6B1C-46C0-9422-C313D14AE9E4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Notifications.Common", "modules\common\LINGYUN.Abp.Notifications.Common\LINGYUN.Abp.Notifications.Common.csproj", "{0CE035CF-2D8A-4559-93EC-ADBEC4237C61}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -1056,10 +1072,38 @@ Global {8DF55DAB-4C1D-46F7-9324-0050F47B3BED}.Debug|Any CPU.Build.0 = Debug|Any CPU {8DF55DAB-4C1D-46F7-9324-0050F47B3BED}.Release|Any CPU.ActiveCfg = Release|Any CPU {8DF55DAB-4C1D-46F7-9324-0050F47B3BED}.Release|Any CPU.Build.0 = Release|Any CPU - {06FF5EFA-DEDA-4E12-A482-8FCE4077F68A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {06FF5EFA-DEDA-4E12-A482-8FCE4077F68A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {06FF5EFA-DEDA-4E12-A482-8FCE4077F68A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {06FF5EFA-DEDA-4E12-A482-8FCE4077F68A}.Release|Any CPU.Build.0 = Release|Any CPU + {D4B4800F-6238-4EA9-A9BB-298D668C26C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D4B4800F-6238-4EA9-A9BB-298D668C26C4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D4B4800F-6238-4EA9-A9BB-298D668C26C4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D4B4800F-6238-4EA9-A9BB-298D668C26C4}.Release|Any CPU.Build.0 = Release|Any CPU + {F9AC4123-7987-47D3-85D6-CD13928F3683}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F9AC4123-7987-47D3-85D6-CD13928F3683}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F9AC4123-7987-47D3-85D6-CD13928F3683}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F9AC4123-7987-47D3-85D6-CD13928F3683}.Release|Any CPU.Build.0 = Release|Any CPU + {22BDDF5C-F911-4978-B83F-981F3652BF45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {22BDDF5C-F911-4978-B83F-981F3652BF45}.Debug|Any CPU.Build.0 = Debug|Any CPU + {22BDDF5C-F911-4978-B83F-981F3652BF45}.Release|Any CPU.ActiveCfg = Release|Any CPU + {22BDDF5C-F911-4978-B83F-981F3652BF45}.Release|Any CPU.Build.0 = Release|Any CPU + {0C824BB4-81FC-4B28-B7B1-07B2B2BB70A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C824BB4-81FC-4B28-B7B1-07B2B2BB70A0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0C824BB4-81FC-4B28-B7B1-07B2B2BB70A0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0C824BB4-81FC-4B28-B7B1-07B2B2BB70A0}.Release|Any CPU.Build.0 = Release|Any CPU + {4711320B-F98D-4CB0-BFEB-B9685B6CBCB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4711320B-F98D-4CB0-BFEB-B9685B6CBCB7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4711320B-F98D-4CB0-BFEB-B9685B6CBCB7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4711320B-F98D-4CB0-BFEB-B9685B6CBCB7}.Release|Any CPU.Build.0 = Release|Any CPU + {130F8ED1-A64F-48DE-BF43-18EAD19CAF63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {130F8ED1-A64F-48DE-BF43-18EAD19CAF63}.Debug|Any CPU.Build.0 = Debug|Any CPU + {130F8ED1-A64F-48DE-BF43-18EAD19CAF63}.Release|Any CPU.ActiveCfg = Release|Any CPU + {130F8ED1-A64F-48DE-BF43-18EAD19CAF63}.Release|Any CPU.Build.0 = Release|Any CPU + {A53FE09E-6B1C-46C0-9422-C313D14AE9E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A53FE09E-6B1C-46C0-9422-C313D14AE9E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A53FE09E-6B1C-46C0-9422-C313D14AE9E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A53FE09E-6B1C-46C0-9422-C313D14AE9E4}.Release|Any CPU.Build.0 = Release|Any CPU + {0CE035CF-2D8A-4559-93EC-ADBEC4237C61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0CE035CF-2D8A-4559-93EC-ADBEC4237C61}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0CE035CF-2D8A-4559-93EC-ADBEC4237C61}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0CE035CF-2D8A-4559-93EC-ADBEC4237C61}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1259,7 +1303,15 @@ Global {88502844-D83C-4541-96AC-A8291E261F63} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} {67DC7FA0-506A-4977-95F6-BC739B2BC4BA} = {F4923692-D343-4318-AECA-96F580B1A563} {8DF55DAB-4C1D-46F7-9324-0050F47B3BED} = {F4923692-D343-4318-AECA-96F580B1A563} - {06FF5EFA-DEDA-4E12-A482-8FCE4077F68A} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} + {ABD89F39-62D9-439E-8662-BE4F36BFA04F} = {C5CAD011-DF84-4914-939C-0C029DCEF26F} + {D4B4800F-6238-4EA9-A9BB-298D668C26C4} = {ABD89F39-62D9-439E-8662-BE4F36BFA04F} + {F9AC4123-7987-47D3-85D6-CD13928F3683} = {ABD89F39-62D9-439E-8662-BE4F36BFA04F} + {22BDDF5C-F911-4978-B83F-981F3652BF45} = {ABD89F39-62D9-439E-8662-BE4F36BFA04F} + {0C824BB4-81FC-4B28-B7B1-07B2B2BB70A0} = {ABD89F39-62D9-439E-8662-BE4F36BFA04F} + {4711320B-F98D-4CB0-BFEB-B9685B6CBCB7} = {ABD89F39-62D9-439E-8662-BE4F36BFA04F} + {130F8ED1-A64F-48DE-BF43-18EAD19CAF63} = {ABD89F39-62D9-439E-8662-BE4F36BFA04F} + {A53FE09E-6B1C-46C0-9422-C313D14AE9E4} = {ABD89F39-62D9-439E-8662-BE4F36BFA04F} + {0CE035CF-2D8A-4559-93EC-ADBEC4237C61} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718} 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 9b0725319..3b6c49a28 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 @@ -8,16 +8,6 @@ - - - - - - - - - - @@ -25,7 +15,7 @@ - + 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 deleted file mode 100644 index 4416c951d..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpExceptionHandlingNotificationDefinitionProvider.cs +++ /dev/null @@ -1,36 +0,0 @@ -using LINGYUN.Abp.ExceptionHandling.Localization; -using LINGYUN.Abp.Notifications; -using Volo.Abp.Localization; - -namespace LINGYUN.Abp.ExceptionHandling.Notifications -{ - public class AbpExceptionHandlingNotificationDefinitionProvider : NotificationDefinitionProvider - { - public override void Define(INotificationDefinitionContext context) - { - 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) - // 指定通知提供程序 - .WithProviders( - NotificationProviderNames.SignalR, - NotificationProviderNames.Emailing) - // 设定为模板通知 - .WithTemplate(typeof(ExceptionHandlingResource)); - } - - 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 deleted file mode 100644 index 9c8b2caa2..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpExceptionHandlingNotificationNames.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace LINGYUN.Abp.ExceptionHandling.Notifications -{ - public class AbpExceptionHandlingNotificationNames - { - 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 1f9d501f9..2ee8d8294 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,29 +1,12 @@ -using LINGYUN.Abp.ExceptionHandling.Localization; -using LINGYUN.Abp.Notifications; -using Volo.Abp.Localization; +using LINGYUN.Abp.Notifications.Common; using Volo.Abp.Modularity; -using Volo.Abp.VirtualFileSystem; namespace LINGYUN.Abp.ExceptionHandling.Notifications { [DependsOn( typeof(AbpExceptionHandlingModule), - typeof(AbpNotificationModule))] + typeof(AbpNotificationsCommonModule))] 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 c168dd3fb..0507d8211 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 @@ -25,9 +25,9 @@ namespace LINGYUN.Abp.ExceptionHandling.Notifications var notificationSender = context.ServiceProvider.GetRequiredService(); // 发送错误模板消息 await notificationSender.SendNofiterAsync( - AbpExceptionHandlingNotificationNames.NotificationName, + NotificationsCommonNotificationNames.ExceptionHandling, new NotificationTemplate( - AbpExceptionHandlingNotificationNames.NotificationName, + NotificationsCommonNotificationNames.ExceptionHandling, formUser: "System", data: new Dictionary { 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 deleted file mode 100644 index 16edd1673..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/Localization/Resources/en.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "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 deleted file mode 100644 index 9649f9c04..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/Localization/Resources/zh-Hans.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "culture": "zh-Hans", - "texts": { - "Notifications:Exception": "异常通知", - "Notifications:ExceptionNotifier": "异常推送" - } -} \ No newline at end of file diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/FodyWeavers.xml b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/FodyWeavers.xml similarity index 100% rename from aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/FodyWeavers.xml rename to aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/FodyWeavers.xml diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/FodyWeavers.xsd b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/FodyWeavers.xsd similarity index 100% rename from aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/FodyWeavers.xsd rename to aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/FodyWeavers.xsd diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN.Abp.Notifications.Common.csproj b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN.Abp.Notifications.Common.csproj new file mode 100644 index 000000000..a1cf305d7 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN.Abp.Notifications.Common.csproj @@ -0,0 +1,31 @@ + + + + + + + netstandard2.0 + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/AbpNotificationsCommonModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/AbpNotificationsCommonModule.cs new file mode 100644 index 000000000..19b1664bd --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/AbpNotificationsCommonModule.cs @@ -0,0 +1,26 @@ +using LINGYUN.Abp.Notifications.Localization; +using Volo.Abp.Localization; +using Volo.Abp.Modularity; +using Volo.Abp.VirtualFileSystem; + +namespace LINGYUN.Abp.Notifications.Common; + +[DependsOn( + typeof(AbpNotificationModule))] +public class AbpNotificationsCommonModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Get() + .AddVirtualJson("/LINGYUN/Abp/Notifications/Localization/Common"); + }); + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/Emailing/NotificationsCommonTemplateProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/Emailing/NotificationsCommonTemplateProvider.cs new file mode 100644 index 000000000..2678d777a --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/Emailing/NotificationsCommonTemplateProvider.cs @@ -0,0 +1,23 @@ +using Volo.Abp.TextTemplating; + +namespace LINGYUN.Abp.Notifications; + +public class NotificationsCommonTemplateProvider : TemplateDefinitionProvider +{ + public override void Define(ITemplateDefinitionContext context) + { + context.Add(CreateEmailTemplate()); + } + + protected virtual TemplateDefinition[] CreateEmailTemplate() + { + return new TemplateDefinition[] + { + new TemplateDefinition( + name: "EmailNotifierLayout", + defaultCultureName: "en", + isLayout: true) + .WithVirtualFilePath( "/LINGYUN/Abp/Notifications/Emailing/Templates/layout.tpl", isInlineLocalized: true) + }; + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/Localization/Common/en.json b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/Localization/Common/en.json new file mode 100644 index 000000000..b12c0c053 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/Localization/Common/en.json @@ -0,0 +1,11 @@ +{ + "culture": "en", + "texts": { + "Notifications:MultiTenancy": "Multi Tenancy", + "Notifications:Users": "Users", + "Notifications:NewTenantRegisterd": "Tenant creation notification", + "Notifications:WelcomeToApplication": "User Welcome Notice", + "Notifications:Primitives": "Primitives", + "Notifications:ExceptionNotifier": "Exception Notifier" + } +} \ No newline at end of file diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/Localization/Common/zh-Hans.json b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/Localization/Common/zh-Hans.json new file mode 100644 index 000000000..bde90e888 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/Localization/Common/zh-Hans.json @@ -0,0 +1,11 @@ +{ + "culture": "zh-Hans", + "texts": { + "Notifications:MultiTenancy": "租户通知", + "Notifications:Users": "用户通知", + "Notifications:NewTenantRegisterd": "租户创建通知", + "Notifications:WelcomeToApplication": "用户欢迎通知", + "Notifications:Primitives": "标准通知", + "Notifications:ExceptionNotifier": "异常通知推送" + } +} \ No newline at end of file diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/NotificationsCommonNotificationDefinitionProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/NotificationsCommonNotificationDefinitionProvider.cs new file mode 100644 index 000000000..fd60c0863 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/NotificationsCommonNotificationDefinitionProvider.cs @@ -0,0 +1,82 @@ +using LINGYUN.Abp.Notifications.Localization; +using Volo.Abp.Localization; +using Volo.Abp.MultiTenancy; +using Volo.Abp.TextTemplating; +using Volo.Abp.Users; + +namespace LINGYUN.Abp.Notifications; +public class NotificationsCommonNotificationDefinitionProvider : NotificationDefinitionProvider +{ + public override void Define(INotificationDefinitionContext context) + { + var commonGroup = context.AddGroup( + NotificationsCommonNotificationNames.GroupName, + L("Notifications:Primitives"), + false); + + commonGroup.AddNotification( + name: NotificationsCommonNotificationNames.ExceptionHandling, + displayName: L("Notifications:ExceptionNotifier"), + description: L("Notifications:ExceptionNotifier"), + notificationType: NotificationType.System, + lifetime: NotificationLifetime.Persistent, + allowSubscriptionToClients: false) + // 指定通知提供程序 + .WithProviders( + NotificationProviderNames.SignalR, + NotificationProviderNames.Emailing) + // 设定为模板通知 + .WithTemplate(typeof(NotificationsResource), layout: "EmailNotifierLayout") + .WithTemplate(template => + { + template.WithVirtualFilePath("/LINGYUN/Abp/Notifications/Emailing/Templates/ExceptionNotifier", isInlineLocalized: false); + }); + + 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: false + ) + .WithProviders( + NotificationProviderNames.SignalR, + NotificationProviderNames.Emailing) + .WithTemplate(typeof(NotificationsResource), layout: "EmailNotifierLayout") + .WithTemplate(template => + { + template.WithVirtualFilePath("/LINGYUN/Abp/Notifications/Emailing/Templates/NewTenantRegisterd", isInlineLocalized: false); + }); + + 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) + .WithProviders( + NotificationProviderNames.SignalR, + NotificationProviderNames.Emailing) + .WithTemplate(typeof(NotificationsResource), layout: "EmailNotifierLayout") + .WithTemplate(template => + { + template.WithVirtualFilePath("/LINGYUN/Abp/Notifications/Emailing/Templates/WelcomeToApplication", isInlineLocalized: false); + }); + } + + protected LocalizableString L(string name) + { + return LocalizableString.Create(name); + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/NotificationsCommonNotificationNames.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/NotificationsCommonNotificationNames.cs new file mode 100644 index 000000000..071c35ed4 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/NotificationsCommonNotificationNames.cs @@ -0,0 +1,11 @@ +namespace LINGYUN.Abp.Notifications +{ + public class NotificationsCommonNotificationNames + { + public const string GroupName = "LINGYUN.Abp.Notifications.Primitives"; + /// + /// 异常处理 + /// + public const string ExceptionHandling = GroupName + ".ExceptionHandling"; + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/Volo/Abp/MultiTenancy/TenantNotificationNames.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/Volo/Abp/MultiTenancy/TenantNotificationNames.cs similarity index 100% rename from aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/Volo/Abp/MultiTenancy/TenantNotificationNames.cs rename to aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/Volo/Abp/MultiTenancy/TenantNotificationNames.cs diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/Volo/Abp/Users/UserNotificationNames.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/Volo/Abp/Users/UserNotificationNames.cs similarity index 100% rename from aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/Volo/Abp/Users/UserNotificationNames.cs rename to aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/Volo/Abp/Users/UserNotificationNames.cs diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/LINGYUN/Abp/Notifications/TextTemplating/AbpNotificationsTextTemplatingModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/LINGYUN/Abp/Notifications/TextTemplating/AbpNotificationsTextTemplatingModule.cs deleted file mode 100644 index 3cfb08970..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/LINGYUN/Abp/Notifications/TextTemplating/AbpNotificationsTextTemplatingModule.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Volo.Abp.Modularity; -using Volo.Abp.TextTemplating; - -namespace LINGYUN.Abp.Notifications.TextTemplating; - -[DependsOn( - typeof(AbpNotificationModule), - typeof(AbpTextTemplatingCoreModule))] -public class AbpNotificationsTextTemplatingModule : AbpModule -{ - -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/LINGYUN/Abp/Notifications/TextTemplating/NotificationTemplateContentContributor.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/LINGYUN/Abp/Notifications/TextTemplating/NotificationTemplateContentContributor.cs deleted file mode 100644 index 97ec8f2ba..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/LINGYUN/Abp/Notifications/TextTemplating/NotificationTemplateContentContributor.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; -using Volo.Abp.TextTemplating; - -namespace LINGYUN.Abp.Notifications.TextTemplating; - -public class NotificationTemplateContentContributor : ITemplateContentContributor, ITransientDependency -{ - public async virtual Task GetOrNullAsync(TemplateContentContributorContext context) - { - var notificationDefinitionManager = context.ServiceProvider.GetRequiredService(); - var notification = notificationDefinitionManager.GetOrNull(context.TemplateDefinition.Name); - if (notification == null) - { - return null; - } - - var store = context.ServiceProvider.GetRequiredService(); - - return await store.GetContentOrNullAsync(context.TemplateDefinition.Name, context.Culture); - } -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationTemplateStore.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationTemplateStore.cs deleted file mode 100644 index 785df7a31..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationTemplateStore.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; - -namespace LINGYUN.Abp.Notifications; - -public interface INotificationTemplateStore -{ - Task GetContentOrNullAsync(string templateName, string culture = null, CancellationToken cancellationToken = default); -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Localization/Resources/en.json b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Localization/Resources/en.json index 974a19e4f..a45236c6c 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Localization/Resources/en.json +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Localization/Resources/en.json @@ -1,12 +1,24 @@ { "culture": "en", "texts": { + "Notifications": "Notifications", + "Notifications:Title": "Title", + "Notifications:Content": "Content", + "Notifications:Type": "Type", + "Notifications:SendTime": "SendTime", + "Notifications:System": "System", + "Notifications:Application": "Platform", + "Notifications:User": "User", "Notifications:Internal": "Internal", "Notifications:OnsideNotice": "Onside", "Notifications:OnsideNoticeDesc": "In-app notification push", "Notifications:ActivityNotice": "Activity", "Notifications:ActivityNoticeDesc": "The administrator delivers an event notification push", "Notifications:SystemNotice": "System", - "Notifications:SystemNoticeDesc": "System global notification push" + "Notifications:SystemNoticeDesc": "System global notification push", + "MarkSelectedAsRead": "Mark selected as read", + "MarkAs": "Mark as", + "Read": "Read", + "UnRead": "Un Read" } } \ No newline at end of file diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Localization/Resources/zh-Hans.json b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Localization/Resources/zh-Hans.json index c5ea0dec4..65fdcd866 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Localization/Resources/zh-Hans.json @@ -1,12 +1,24 @@ { "culture": "zh-Hans", "texts": { + "Notifications": "通知列表", + "Notifications:Title": "标题", + "Notifications:Content": "内容", + "Notifications:Type": "类型", + "Notifications:SendTime": "发送时间", + "Notifications:System": "系统", + "Notifications:Application": "平台", + "Notifications:User": "用户", "Notifications:Internal": "内置通知", "Notifications:OnsideNotice": "站内通知", "Notifications:OnsideNoticeDesc": "应用内部通知推送", "Notifications:ActivityNotice": "活动通知", "Notifications:ActivityNoticeDesc": "管理员下发活动通知推送", "Notifications:SystemNotice": "系统通知", - "Notifications:SystemNoticeDesc": "系统全局消息推送" + "Notifications:SystemNoticeDesc": "系统全局消息推送", + "MarkSelectedAsRead": "标记选中已读", + "MarkAs": "标记为", + "Read": "已读", + "UnRead": "未读" } } \ No newline at end of file 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 f92d28bf5..199e4b9c7 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 @@ -106,6 +106,23 @@ namespace LINGYUN.Abp.Notifications return this; } + public virtual NotificationDefinition WithTemplate(Action setup) + { + if (Template != null) + { + setup(Template); + } + else + { + var template = new TemplateDefinition(Name); + setup(template); + + Template = template; + } + + return this; + } + public virtual NotificationDefinition WithProperty(string key, object value) { Properties[key] = value; diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NullNotificationTemplateStore.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NullNotificationTemplateStore.cs deleted file mode 100644 index 697aa77b7..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NullNotificationTemplateStore.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; - -namespace LINGYUN.Abp.Notifications; - -[Dependency(TryRegister = true)] -public class NullNotificationTemplateStore : INotificationTemplateStore, ISingletonDependency -{ - public readonly static INotificationTemplateStore Instance = new NullNotificationTemplateStore(); - - public Task GetContentOrNullAsync(string templateName, string culture = null, CancellationToken cancellationToken = default) - { - return Task.FromResult(null); - } -} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationTemplateGetInput.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationTemplateGetInput.cs deleted file mode 100644 index eb7bf5d6f..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationTemplateGetInput.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace LINGYUN.Abp.MessageService.Notifications; - -public class NotificationTemplateGetInput -{ - [Required] - public string Name { get; set; } - - public string Culture { get; set; } -} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationTemplateSetInput.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationTemplateSetInput.cs deleted file mode 100644 index adafc3dd6..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationTemplateSetInput.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using Volo.Abp.Validation; - -namespace LINGYUN.Abp.MessageService.Notifications; - -public class NotificationTemplateSetInput -{ - [Required] - [DynamicStringLength(typeof(NotificationTemplateConsts), nameof(NotificationTemplateConsts.MaxNameLength))] - public string Name { get; set; } - - [Required] - [DynamicStringLength(typeof(NotificationTemplateConsts), nameof(NotificationTemplateConsts.MaxCultureLength))] - public string Culture { get; set; } - - [Required] - [DynamicStringLength(typeof(NotificationTemplateConsts), nameof(NotificationTemplateConsts.MaxContentLength))] - public string Content { get; set; } -} 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 index 0eb03a414..0782b12e3 100644 --- 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 @@ -5,10 +5,6 @@ namespace LINGYUN.Abp.MessageService.Notifications { public interface INotificationAppService { - Task SetTemplateAsync(NotificationTemplateSetInput input); - - Task GetTemplateAsync(NotificationTemplateGetInput input); - Task> GetAssignableTemplatesAsync(); Task SendAsync(NotificationSendDto input); diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/AbpMessageServiceApplicationAutoMapperProfile.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/AbpMessageServiceApplicationAutoMapperProfile.cs index ef4e5b505..363e6aa80 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/AbpMessageServiceApplicationAutoMapperProfile.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/AbpMessageServiceApplicationAutoMapperProfile.cs @@ -23,8 +23,6 @@ namespace LINGYUN.Abp.MessageService } return new NotificationData(); })); - - CreateMap(); } } } 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 index 512a76928..9ca440640 100644 --- 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 @@ -17,64 +17,15 @@ namespace LINGYUN.Abp.MessageService.Notifications protected ITemplateContentProvider TemplateContentProvider { get; } protected INotificationSender NotificationSender { get; } protected INotificationDefinitionManager NotificationDefinitionManager { get; } - protected INotificationTemplateRepository NotificationTemplateRepository { get; } public NotificationAppService( INotificationSender notificationSender, ITemplateContentProvider templateContentProvider, - INotificationDefinitionManager notificationDefinitionManager, - INotificationTemplateRepository notificationTemplateRepository) + INotificationDefinitionManager notificationDefinitionManager) { NotificationSender = notificationSender; TemplateContentProvider = templateContentProvider; NotificationDefinitionManager = notificationDefinitionManager; - NotificationTemplateRepository = notificationTemplateRepository; - } - - public async virtual Task SetTemplateAsync(NotificationTemplateSetInput input) - { - var notification = GetNotificationDefinition(input.Name); - - var template = await NotificationTemplateRepository.GetByNameAsync(input.Name, input.Culture); - if (template == null) - { - template = new NotificationTemplate( - GuidGenerator.Create(), - notification.Name, - notification.DisplayName.Localize(StringLocalizerFactory), - input.Content, - input.Culture, - notification.Description?.Localize(StringLocalizerFactory)); - - template = await NotificationTemplateRepository.InsertAsync(template); - } - else - { - template.SetContent(input.Content); - - await NotificationTemplateRepository.UpdateAsync(template); - } - - await CurrentUnitOfWork.SaveChangesAsync(); - - return ObjectMapper.Map(template); - } - - public async virtual Task GetTemplateAsync(NotificationTemplateGetInput input) - { - var notification = GetNotificationDefinition(input.Name); - - var culture = input.Culture ?? CultureInfo.CurrentCulture.Name; - var content = await TemplateContentProvider.GetContentOrNullAsync(notification.Name, culture); - - return new NotificationTemplateDto - { - Culture = culture, - Content = content, - Name = notification.Name, - Title = notification.DisplayName.Localize(StringLocalizerFactory), - Description = notification.Description?.Localize(StringLocalizerFactory), - }; } public virtual Task> GetAssignableTemplatesAsync() @@ -110,7 +61,7 @@ namespace LINGYUN.Abp.MessageService.Notifications await NotificationSender .SendNofiterAsync( name: input.Name, - template: new Abp.Notifications.NotificationTemplate( + template: new NotificationTemplate( notification.Name, culture: input.Culture ?? CultureInfo.CurrentCulture.Name, formUser: CurrentUser.Name ?? CurrentUser.UserName, diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/en.json b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/en.json index d6210d8bc..bd71bebcb 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/en.json +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/en.json @@ -19,22 +19,6 @@ "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!", "LINGYUN.Abp.Message:05404": "The notification template does not exist!", - "MarkSelectedAsRead": "Mark selected as read", - "MarkAs": "Mark as", - "Read": "Read", - "UnRead": "Un Read", - "Notifications": "Notifications", - "Notifications:Title": "Title", - "Notifications:Content": "Content", - "Notifications:Type": "Type", - "Notifications:SendTime": "SendTime", - "Notifications:System": "System", - "Notifications:Application": "Platform", - "Notifications:User": "User", - "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", diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json index f716290e2..069f1bc65 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json @@ -19,22 +19,6 @@ "LINGYUN.Abp.Message:03410": "用户拒绝添加好友", "LINGYUN.Abp.Message:03411": "对方已是您的好友或已发送验证请求,不能重复操作!", "LINGYUN.Abp.Message:05404": "通知模板不存在!", - "MarkSelectedAsRead": "标记选中已读", - "MarkAs": "标记为", - "Read": "已读", - "UnRead": "未读", - "Notifications": "通知列表", - "Notifications:Title": "标题", - "Notifications:Content": "内容", - "Notifications:Type": "类型", - "Notifications:SendTime": "发送时间", - "Notifications:System": "系统", - "Notifications:Application": "平台", - "Notifications:User": "用户", - "Notifications:MultiTenancy": "租户通知", - "Notifications:Users": "用户通知", - "Notifications:NewTenantRegisterd": "租户创建通知", - "Notifications:WelcomeToApplication": "用户欢迎通知", "Notifications:IM": "即时通讯", "Notifications:FriendValidation": "好友验证通知", "Notifications:NewFriend": "新好友通知", @@ -46,6 +30,5 @@ "AddNewFriendBySearchId": "通过账号搜索添加", "WelcomeToApplicationFormUser": "用户:{User} 欢迎您的加入!", "Messages:NewFriend": "我已经添加您为好友,让我们一起聊天吧!" - } } \ No newline at end of file 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 f1ab03432..04a92ea9b 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 @@ -1,8 +1,6 @@ using LINGYUN.Abp.MessageService.Localization; using LINGYUN.Abp.Notifications; using Volo.Abp.Localization; -using Volo.Abp.MultiTenancy; -using Volo.Abp.Users; namespace LINGYUN.Abp.MessageService.Notifications { @@ -10,40 +8,6 @@ namespace LINGYUN.Abp.MessageService.Notifications { public override void Define(INotificationDefinitionContext context) { - 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: false - ) - .WithProviders( - NotificationProviderNames.SignalR, - NotificationProviderNames.Emailing) - .WithTemplate(typeof(MessageServiceResource)); - - 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) - .WithProviders( - NotificationProviderNames.SignalR, - NotificationProviderNames.Emailing) - .WithTemplate(typeof(MessageServiceResource)); - var imGroup = context.AddGroup( MessageServiceNotificationNames.IM.GroupName, L("Notifications:IM")); diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/INotificationTemplateRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/INotificationTemplateRepository.cs deleted file mode 100644 index a5915dd08..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/INotificationTemplateRepository.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp.Domain.Repositories; - -namespace LINGYUN.Abp.MessageService.Notifications; - -public interface INotificationTemplateRepository : IBasicRepository -{ - Task GetByNameAsync(string name, string culture = null, CancellationToken cancellationToken = default); -} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationTemplate.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationTemplate.cs deleted file mode 100644 index 3fd0f56ce..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationTemplate.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using Volo.Abp; -using Volo.Abp.Domain.Entities.Auditing; -using Volo.Abp.MultiTenancy; - -namespace LINGYUN.Abp.MessageService.Notifications; - -public class NotificationTemplate : AuditedEntity, IMultiTenant -{ - public virtual Guid? TenantId { get; protected set; } - public virtual string Name { get; private set; } - public virtual string Description { get; private set; } - public virtual string Title { get; private set; } - public virtual string Content { get; private set; } - public virtual string Culture { get; private set; } - protected NotificationTemplate() { } - public NotificationTemplate( - Guid id, - string name, - string title, - string content, - string culture, - string description = null) - : base(id) - { - Name = Check.NotNullOrWhiteSpace(name, nameof(name), NotificationTemplateConsts.MaxNameLength); - Title = Check.NotNullOrWhiteSpace(title, nameof(title), NotificationTemplateConsts.MaxTitleLength); - Content = Check.NotNullOrWhiteSpace(content, nameof(content), NotificationTemplateConsts.MaxContentLength); - Culture = Check.NotNullOrWhiteSpace(culture, nameof(culture), NotificationTemplateConsts.MaxCultureLength); - Description = Check.Length(description, nameof(description), NotificationTemplateConsts.MaxDescriptionLength); - } - - public void SetContent(string content) - { - Content = Check.NotNullOrWhiteSpace(content, nameof(content), NotificationTemplateConsts.MaxContentLength); - } -} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationTemplateStore.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationTemplateStore.cs deleted file mode 100644 index ae96c5cb0..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationTemplateStore.cs +++ /dev/null @@ -1,31 +0,0 @@ -using LINGYUN.Abp.Notifications; -using Microsoft.Extensions.DependencyInjection; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; - -namespace LINGYUN.Abp.MessageService.Notifications; - -[Dependency(ServiceLifetime.Transient, ReplaceServices = true)] -[ExposeServices(typeof(INotificationTemplateStore))] -public class NotificationTemplateStore : INotificationTemplateStore -{ - protected INotificationTemplateRepository NotificationTemplateRepository { get; } - - public NotificationTemplateStore( - INotificationTemplateRepository notificationTemplateRepository) - { - NotificationTemplateRepository = notificationTemplateRepository; - } - - public async virtual Task GetContentOrNullAsync(string templateName, string culture = null, CancellationToken cancellationToken = default) - { - var template = await NotificationTemplateRepository.GetByNameAsync( - templateName, - culture ?? CultureInfo.CurrentCulture.Name, - cancellationToken); - - return template?.Content; - } -} 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 8a7e6a218..544802d7b 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 @@ -18,7 +18,6 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore context.Services.AddAbpDbContext(options => { options.AddRepository(); - options.AddRepository(); options.AddRepository(); options.AddRepository(); 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 37bb47258..26e6945b6 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 @@ -34,23 +34,6 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore b.HasIndex(p => new { p.TenantId, p.NotificationName }); }); - builder.Entity(b => - { - b.ToTable(options.TablePrefix + "NotificationTemplates", options.Schema); - - b.Property(p => p.Name).HasMaxLength(NotificationTemplateConsts.MaxNameLength).IsRequired(); - b.Property(p => p.Title).HasMaxLength(NotificationTemplateConsts.MaxTitleLength).IsRequired(); - b.Property(p => p.Content).HasMaxLength(NotificationTemplateConsts.MaxContentLength).IsRequired(); - b.Property(p => p.Culture).HasMaxLength(NotificationTemplateConsts.MaxCultureLength).IsRequired(); - - b.Property(p => p.Description).HasMaxLength(NotificationTemplateConsts.MaxDescriptionLength); - - b.ConfigureByConvention(); - - b.HasIndex(p => new { p.TenantId, p.Name }) - .HasDatabaseName("IX_Tenant_Notification_Template_Name"); - }); - builder.Entity(b => { b.ToTable(options.TablePrefix + "UserNotifications", options.Schema); diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreNotificationTemplateRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreNotificationTemplateRepository.cs deleted file mode 100644 index 249722274..000000000 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreNotificationTemplateRepository.cs +++ /dev/null @@ -1,32 +0,0 @@ -using LINGYUN.Abp.MessageService.EntityFrameworkCore; -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; -using Volo.Abp.EntityFrameworkCore; - -namespace LINGYUN.Abp.MessageService.Notifications; - -public class EfCoreNotificationTemplateRepository : - EfCoreRepository, - INotificationTemplateRepository, - ITransientDependency -{ - public EfCoreNotificationTemplateRepository( - IDbContextProvider dbContextProvider) - : base(dbContextProvider) - { - } - - public async virtual Task GetByNameAsync(string name, string culture = null, CancellationToken cancellationToken = default) - { - return await (await GetDbSetAsync()) - .Where(x => x.Name.Equals(name)) - .WhereIf(!culture.IsNullOrWhiteSpace(), x => x.Culture.Equals(culture)) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); - } -} 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 index 192bd309c..3e9b5250d 100644 --- 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 @@ -26,23 +26,8 @@ namespace LINGYUN.Abp.MessageService.Notifications await NotificationAppService.SendAsync(input); } - [HttpPost] - [Route("templates")] - public async virtual Task SetTemplateAsync(NotificationTemplateSetInput input) - { - return await NotificationAppService.SetTemplateAsync(input); - } - - [HttpGet] - [Route("templates/{Name}")] - [Route("templates/{Culture}/{Name}")] - public async virtual Task GetTemplateAsync(NotificationTemplateGetInput input) - { - return await NotificationAppService.GetTemplateAsync(input); - } - [HttpGet] - [Route("templates")] + [Route("assignable-templates")] public async virtual Task> GetAssignableTemplatesAsync() { return await NotificationAppService.GetAssignableTemplatesAsync(); diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/FodyWeavers.xml b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/FodyWeavers.xml new file mode 100644 index 000000000..17d32672d --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/FodyWeavers.xsd b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/FodyWeavers.xsd new file mode 100644 index 000000000..11da52550 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN.Abp.TextTemplating.Application.Contracts.csproj b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN.Abp.TextTemplating.Application.Contracts.csproj new file mode 100644 index 000000000..45b2cf3c7 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN.Abp.TextTemplating.Application.Contracts.csproj @@ -0,0 +1,24 @@ + + + + netstandard2.0 + + + + + + + netstandard2.0 + + + + + + + + + + + + + diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationContractsModule.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationContractsModule.cs new file mode 100644 index 000000000..7d831e1f3 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationContractsModule.cs @@ -0,0 +1,14 @@ +using Volo.Abp.Application; +using Volo.Abp.Authorization; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.TextTemplating; + +[DependsOn( + typeof(AbpTextTemplatingDomainSharedModule), + typeof(AbpAuthorizationAbstractionsModule), + typeof(AbpDddApplicationContractsModule))] +public class AbpTextTemplatingApplicationContractsModule : AbpModule +{ + +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/AbpTextTemplatingRemoteServiceConsts.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/AbpTextTemplatingRemoteServiceConsts.cs new file mode 100644 index 000000000..af80a87d5 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/AbpTextTemplatingRemoteServiceConsts.cs @@ -0,0 +1,8 @@ +namespace LINGYUN.Abp.TextTemplating; + +public class AbpTextTemplatingRemoteServiceConsts +{ + public const string RemoteServiceName = "AbpTextTemplating"; + + public const string ModuleName = "text-templating"; +} \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/ITextTemplateAppService.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/ITextTemplateAppService.cs new file mode 100644 index 000000000..287111b29 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/ITextTemplateAppService.cs @@ -0,0 +1,16 @@ +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Abp.TextTemplating; + +public interface ITextTemplateAppService : IApplicationService +{ + Task GetAsync(TextTemplateGetInput input); + + Task ResetDefaultAsync(TextTemplateGetInput input); + + Task UpdateAsync(TextTemplateUpdateInput input); + + Task> GetListAsync(); +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/Permissions/AbpTextTemplatingPermissionDefinitionProvider.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/Permissions/AbpTextTemplatingPermissionDefinitionProvider.cs new file mode 100644 index 000000000..8e1f568ae --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/Permissions/AbpTextTemplatingPermissionDefinitionProvider.cs @@ -0,0 +1,23 @@ +using LINGYUN.Abp.TextTemplating.Localization; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Localization; + +namespace LINGYUN.Abp.TextTemplating; + +public class AbpTextTemplatingPermissionDefinitionProvider : PermissionDefinitionProvider +{ + public override void Define(IPermissionDefinitionContext context) + { + var saasGroup = context.AddGroup(AbpTextTemplatingPermissions.GroupName, L("Permission:Saas")); + + var textTemplatePermission = saasGroup.AddPermission(AbpTextTemplatingPermissions.TextTemplate.Default, L("Permission:TextTemplates")); + textTemplatePermission.AddChild(AbpTextTemplatingPermissions.TextTemplate.Create, L("Permission:Create")); + textTemplatePermission.AddChild(AbpTextTemplatingPermissions.TextTemplate.Update, L("Permission:Edit")); + textTemplatePermission.AddChild(AbpTextTemplatingPermissions.TextTemplate.Delete, L("Permission:Delete")); + } + + private static LocalizableString L(string name) + { + return LocalizableString.Create(name); + } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/Permissions/AbpTextTemplatingPermissions.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/Permissions/AbpTextTemplatingPermissions.cs new file mode 100644 index 000000000..db9dbfdbd --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/Permissions/AbpTextTemplatingPermissions.cs @@ -0,0 +1,21 @@ +using Volo.Abp.Reflection; + +namespace LINGYUN.Abp.TextTemplating; + +public static class AbpTextTemplatingPermissions +{ + public const string GroupName = "AbpTextTemplating"; + + public static class TextTemplate + { + public const string Default = GroupName + ".TextTemplates"; + public const string Create = Default + ".Create"; + public const string Update = Default + ".Update"; + public const string Delete = Default + ".Delete"; + } + + public static string[] GetAll() + { + return ReflectionHelper.GetPublicConstantsRecursively(typeof(AbpTextTemplatingPermissions)); + } +} \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateDto.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateDto.cs new file mode 100644 index 000000000..664dde8f4 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateDto.cs @@ -0,0 +1,9 @@ +namespace LINGYUN.Abp.TextTemplating; + +public class TextTemplateDto +{ + public string Name { get; set; } + public string DisplayName { get; set; } + public string Content { get; set; } + public string Culture { get; set; } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateGetInput.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateGetInput.cs new file mode 100644 index 000000000..a863d62c6 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateGetInput.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; + +namespace LINGYUN.Abp.TextTemplating; + +public class TextTemplateGetInput +{ + [Required] + [DynamicStringLength(typeof(TextTemplateConsts), nameof(TextTemplateConsts.MaxNameLength))] + public string Name { get; set; } + + [DynamicStringLength(typeof(TextTemplateConsts), nameof(TextTemplateConsts.MaxCultureLength))] + public string Culture { get; set; } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateUpdateInput.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateUpdateInput.cs new file mode 100644 index 000000000..a8804ec1c --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateUpdateInput.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; + +namespace LINGYUN.Abp.TextTemplating; + +public class TextTemplateUpdateInput +{ + [Required] + [DynamicStringLength(typeof(TextTemplateConsts), nameof(TextTemplateConsts.MaxNameLength))] + public string Name { get; set; } + + [Required] + [DynamicStringLength(typeof(TextTemplateConsts), nameof(TextTemplateConsts.MaxCultureLength))] + public string Culture { get; set; } + + [Required] + [DynamicStringLength(typeof(TextTemplateConsts), nameof(TextTemplateConsts.MaxContentLength))] + public string Content { get; set; } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/FodyWeavers.xml b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/FodyWeavers.xml new file mode 100644 index 000000000..17d32672d --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/FodyWeavers.xsd b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/FodyWeavers.xsd new file mode 100644 index 000000000..11da52550 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN.Abp.TextTemplating.Application.csproj b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN.Abp.TextTemplating.Application.csproj new file mode 100644 index 000000000..7a8d8a78f --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN.Abp.TextTemplating.Application.csproj @@ -0,0 +1,21 @@ + + + + + + + netstandard2.1 + + + + + + + + + + + + + + diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingAppServiceBase.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingAppServiceBase.cs new file mode 100644 index 000000000..ae5f66ecf --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingAppServiceBase.cs @@ -0,0 +1,13 @@ +using LINGYUN.Abp.TextTemplating.Localization; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Abp.TextTemplating; + +public abstract class AbpTextTemplatingAppServiceBase : ApplicationService +{ + protected AbpTextTemplatingAppServiceBase() + { + ObjectMapperContext = typeof(AbpTextTemplatingApplicationModule); + LocalizationResource = typeof(AbpTextTemplatingResource); + } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationAutoMapperProfile.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationAutoMapperProfile.cs new file mode 100644 index 000000000..5360f8525 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationAutoMapperProfile.cs @@ -0,0 +1,11 @@ +using AutoMapper; + +namespace LINGYUN.Abp.TextTemplating; + +public class AbpTextTemplatingApplicationAutoMapperProfile : Profile +{ + public AbpTextTemplatingApplicationAutoMapperProfile() + { + CreateMap(); + } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationModule.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationModule.cs new file mode 100644 index 000000000..5ab7ee8a0 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationModule.cs @@ -0,0 +1,23 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Application; +using Volo.Abp.AutoMapper; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.TextTemplating; + +[DependsOn( + typeof(AbpTextTemplatingDomainModule), + typeof(AbpTextTemplatingApplicationContractsModule), + typeof(AbpAutoMapperModule), + typeof(AbpDddApplicationModule))] +public class AbpTextTemplatingApplicationModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAutoMapperObjectMapper(); + Configure(options => + { + options.AddProfile(validate: true); + }); + } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/TextTemplateAppService.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/TextTemplateAppService.cs new file mode 100644 index 000000000..0eccb770a --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/TextTemplateAppService.cs @@ -0,0 +1,135 @@ +using Microsoft.AspNetCore.Authorization; +using System.Collections.Generic; +using System.Globalization; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Localization; +using Volo.Abp.TextTemplating; + +namespace LINGYUN.Abp.TextTemplating; + +[Authorize(AbpTextTemplatingPermissions.TextTemplate.Default)] +public class TextTemplateAppService : AbpTextTemplatingAppServiceBase, ITextTemplateAppService +{ + protected ITextTemplateRepository TextTemplateRepository { get; } + protected ITemplateContentProvider TemplateContentProvider { get; } + protected ITemplateDefinitionManager TemplateDefinitionManager { get; } + + public TextTemplateAppService( + ITextTemplateRepository textTemplateRepository, + ITemplateContentProvider templateContentProvider, + ITemplateDefinitionManager templateDefinitionManager) + { + TextTemplateRepository = textTemplateRepository; + TemplateContentProvider = templateContentProvider; + TemplateDefinitionManager = templateDefinitionManager; + } + + public async virtual Task GetAsync(TextTemplateGetInput input) + { + + var templateDefinition = GetTemplateDefinition(input.Name); + + var culture = input.Culture ?? CultureInfo.CurrentCulture.Name ?? templateDefinition.DefaultCultureName; + + using (CultureHelper.Use(culture, culture)) + { + var content = await TemplateContentProvider.GetContentOrNullAsync(templateDefinition.Name, culture); + + return new TextTemplateDto + { + Culture = culture, + Content = content, + Name = templateDefinition.Name, + DisplayName = templateDefinition.DisplayName.Localize(StringLocalizerFactory), + }; + } + } + + public Task> GetListAsync() + { + var templates = new List(); + var templateDefinitions = TemplateDefinitionManager.GetAll(); + + foreach (var templateDefinition in templateDefinitions) + { + templates.Add( + new TextTemplateDto + { + Name = templateDefinition.Name, + Culture = CultureInfo.CurrentCulture.Name ?? templateDefinition.DefaultCultureName, + DisplayName = templateDefinition.DisplayName.Localize(StringLocalizerFactory), + }); + } + + return Task.FromResult(new ListResultDto(templates)); + } + + [Authorize(AbpTextTemplatingPermissions.TextTemplate.Delete)] + public async virtual Task ResetDefaultAsync(TextTemplateGetInput input) + { + var templateDefinition = GetTemplateDefinition(input.Name); + + var culture = input.Culture ?? CultureInfo.CurrentCulture.Name ?? templateDefinition.DefaultCultureName; + + using (CultureHelper.Use(culture, culture)) + { + var template = await TextTemplateRepository.FindByNameAsync( + templateDefinition.Name, + culture); + if (template != null) + { + await TextTemplateRepository.DeleteAsync(template); + } + } + } + + [Authorize(AbpTextTemplatingPermissions.TextTemplate.Update)] + public async virtual Task UpdateAsync(TextTemplateUpdateInput input) + { + var templateDefinition = GetTemplateDefinition(input.Name); + + var culture = input.Culture ?? CultureInfo.CurrentCulture.Name ?? templateDefinition.DefaultCultureName; + + using (CultureHelper.Use(culture, culture)) + { + var template = await TextTemplateRepository.FindByNameAsync(input.Name, culture); + if (template == null) + { + template = new TextTemplate( + GuidGenerator.Create(), + templateDefinition.Name, + templateDefinition.DisplayName.Localize(StringLocalizerFactory), + input.Content, + culture); + + template = await TextTemplateRepository.InsertAsync(template); + } + else + { + template.SetContent(input.Content); + + await TextTemplateRepository.UpdateAsync(template); + } + + await CurrentUnitOfWork.SaveChangesAsync(); + + return ObjectMapper.Map(template); + } + } + + protected virtual TemplateDefinition GetTemplateDefinition(string name) + { + var template = TemplateDefinitionManager.GetOrNull(name); + if (template == null) + { + throw new BusinessException( + AbpTextTemplatingErrorCodes.TemplateNotFound, + $"The text template {name} does not exist!") + .WithData("Name", name); + } + + return template; + } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/FodyWeavers.xml b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/FodyWeavers.xml new file mode 100644 index 000000000..c485a4548 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/FodyWeavers.xsd b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/FodyWeavers.xsd new file mode 100644 index 000000000..11da52550 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN.Abp.TextTemplating.Domain.Shared.csproj b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN.Abp.TextTemplating.Domain.Shared.csproj new file mode 100644 index 000000000..9c44b07af --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN.Abp.TextTemplating.Domain.Shared.csproj @@ -0,0 +1,20 @@ + + + + + + + netstandard2.0 + + + + + + + + + + + + + diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDomainSharedModule.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDomainSharedModule.cs new file mode 100644 index 000000000..64cd26226 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDomainSharedModule.cs @@ -0,0 +1,33 @@ +using LINGYUN.Abp.TextTemplating.Localization; +using Volo.Abp.Localization; +using Volo.Abp.Localization.ExceptionHandling; +using Volo.Abp.Modularity; +using Volo.Abp.Validation; +using Volo.Abp.VirtualFileSystem; + +namespace LINGYUN.Abp.TextTemplating; + +[DependsOn( + typeof(AbpValidationModule))] +public class AbpTextTemplatingDomainSharedModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Add("en") + .AddVirtualJson("/LINGYUN/Abp/TextTemplating/Localization/Resources"); + }); + + Configure(options => + { + options.MapCodeNamespace(AbpTextTemplatingErrorCodes.Namespace, typeof(AbpTextTemplatingResource)); + }); + } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/AbpTextTemplatingErrorCodes.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/AbpTextTemplatingErrorCodes.cs new file mode 100644 index 000000000..d3dc1e466 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/AbpTextTemplatingErrorCodes.cs @@ -0,0 +1,11 @@ +namespace LINGYUN.Abp.TextTemplating; + +public static class AbpTextTemplatingErrorCodes +{ + public const string Namespace = "TextTemplating"; + + /// + /// 模板不存在! + /// + public const string TemplateNotFound = Namespace + ":01404"; +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/AbpTextTemplatingResource.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/AbpTextTemplatingResource.cs new file mode 100644 index 000000000..eb4b6610c --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/AbpTextTemplatingResource.cs @@ -0,0 +1,8 @@ +using Volo.Abp.Localization; + +namespace LINGYUN.Abp.TextTemplating.Localization; + +[LocalizationResourceName("AbpTextTemplating")] +public class AbpTextTemplatingResource +{ +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/Resources/en.json b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/Resources/en.json new file mode 100644 index 000000000..a9c8dcc3f --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/Resources/en.json @@ -0,0 +1,5 @@ +{ + "culture": "en", + "texts": { + } +} \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/Resources/zh-Hans.json b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/Resources/zh-Hans.json new file mode 100644 index 000000000..c5ad81326 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/Resources/zh-Hans.json @@ -0,0 +1,5 @@ +{ + "culture": "zh-Hans", + "texts": { + } +} \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/TextTemplateConsts.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/TextTemplateConsts.cs new file mode 100644 index 000000000..903e0f7fa --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/TextTemplateConsts.cs @@ -0,0 +1,12 @@ +namespace LINGYUN.Abp.TextTemplating; + +public static class TextTemplateConsts +{ + public static int MaxNameLength { get; set; } = 100; + + public static int MaxDisplayNameLength { get; set; } = 100; + + public static int MaxContentLength { get; set; } = 1024 * 1024; + + public static int MaxCultureLength { get; set; } = 30; +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/FodyWeavers.xml b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/FodyWeavers.xml new file mode 100644 index 000000000..c485a4548 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/FodyWeavers.xsd b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/FodyWeavers.xsd new file mode 100644 index 000000000..11da52550 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/LINGYUN.Abp.Notifications.TextTemplating.csproj b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN.Abp.TextTemplating.Domain.csproj similarity index 63% rename from aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/LINGYUN.Abp.Notifications.TextTemplating.csproj rename to aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN.Abp.TextTemplating.Domain.csproj index 3f15a30e1..fc31bc931 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/LINGYUN.Abp.Notifications.TextTemplating.csproj +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN.Abp.TextTemplating.Domain.csproj @@ -9,11 +9,11 @@ + - + - diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDbProperties.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDbProperties.cs new file mode 100644 index 000000000..c4ecb380c --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDbProperties.cs @@ -0,0 +1,12 @@ +using Volo.Abp.Data; + +namespace LINGYUN.Abp.TextTemplating; + +public class AbpTextTemplatingDbProperties +{ + public static string DbTablePrefix { get; set; } = AbpCommonDbProperties.DbTablePrefix; + + public static string DbSchema { get; set; } = AbpCommonDbProperties.DbSchema; + + public const string ConnectionStringName = "AbpTextTemplating"; +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDomainModule.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDomainModule.cs new file mode 100644 index 000000000..0bba602d8 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDomainModule.cs @@ -0,0 +1,12 @@ +using Volo.Abp.Modularity; +using Volo.Abp.TextTemplating; + +namespace LINGYUN.Abp.TextTemplating; + +[DependsOn( + typeof(AbpTextTemplatingDomainSharedModule), + typeof(AbpTextTemplatingCoreModule))] +public class AbpTextTemplatingDomainModule : AbpModule +{ + +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/ITextTemplateRepository.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/ITextTemplateRepository.cs new file mode 100644 index 000000000..a9abd556a --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/ITextTemplateRepository.cs @@ -0,0 +1,11 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace LINGYUN.Abp.TextTemplating; + +public interface ITextTemplateRepository : IBasicRepository +{ + Task FindByNameAsync(string name, string culture = null, CancellationToken cancellationToken = default); +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplate.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplate.cs new file mode 100644 index 000000000..a0b49d0b7 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplate.cs @@ -0,0 +1,34 @@ +using System; +using Volo.Abp; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Abp.TextTemplating; + +public class TextTemplate : AuditedEntity, IMultiTenant +{ + public virtual Guid? TenantId { get; protected set; } + public virtual string Name { get; private set; } + public virtual string DisplayName { get; private set; } + public virtual string Content { get; private set; } + public virtual string Culture { get; private set; } + protected TextTemplate() { } + public TextTemplate( + Guid id, + string name, + string displayName, + string content, + string culture) + : base(id) + { + Name = Check.NotNullOrWhiteSpace(name, nameof(name), TextTemplateConsts.MaxNameLength); + DisplayName = Check.NotNullOrWhiteSpace(displayName, nameof(displayName), TextTemplateConsts.MaxDisplayNameLength); + Content = Check.NotNullOrWhiteSpace(content, nameof(content), TextTemplateConsts.MaxContentLength); + Culture = Check.NotNullOrWhiteSpace(culture, nameof(culture), TextTemplateConsts.MaxCultureLength); + } + + public void SetContent(string content) + { + Content = Check.NotNullOrWhiteSpace(content, nameof(content), TextTemplateConsts.MaxContentLength); + } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateContentContributor.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateContentContributor.cs new file mode 100644 index 000000000..0fd44ce09 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateContentContributor.cs @@ -0,0 +1,17 @@ +using Microsoft.Extensions.DependencyInjection; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.TextTemplating; + +namespace LINGYUN.Abp.TextTemplating; + +public class TextTemplateContentContributor : ITemplateContentContributor, ITransientDependency +{ + public async virtual Task GetOrNullAsync(TemplateContentContributorContext context) + { + var repository = context.ServiceProvider.GetRequiredService(); + var template = await repository.FindByNameAsync(context.TemplateDefinition.Name, context.Culture); + + return template?.Content; + } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/FodyWeavers.xml b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 000000000..c485a4548 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/FodyWeavers.xsd b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 000000000..11da52550 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN.Abp.TextTemplating.EntityFrameworkCore.csproj b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN.Abp.TextTemplating.EntityFrameworkCore.csproj new file mode 100644 index 000000000..c4657dd38 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN.Abp.TextTemplating.EntityFrameworkCore.csproj @@ -0,0 +1,19 @@ + + + + + + + net6.0 + + + + + + + + + + + + diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDbContextModelCreatingExtensions.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDbContextModelCreatingExtensions.cs new file mode 100644 index 000000000..15ef452dc --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDbContextModelCreatingExtensions.cs @@ -0,0 +1,45 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp; +using Volo.Abp.EntityFrameworkCore.Modeling; + +namespace LINGYUN.Abp.TextTemplating.EntityFrameworkCore; + +public static class AbpTextTemplatingDbContextModelCreatingExtensions +{ + public static void ConfigureTextTemplating( + this ModelBuilder builder) + { + Check.NotNull(builder, nameof(builder)); + + builder.Entity(b => + { + b.ToTable(AbpTextTemplatingDbProperties.DbTablePrefix + "TextTemplates", AbpTextTemplatingDbProperties.DbSchema); + + b.ConfigureByConvention(); + + b.Property(t => t.Name) + .HasColumnName(nameof(TextTemplate.Name)) + .HasMaxLength(TextTemplateConsts.MaxNameLength) + .IsRequired(); + b.Property(t => t.DisplayName) + .HasColumnName(nameof(TextTemplate.DisplayName)) + .HasMaxLength(TextTemplateConsts.MaxDisplayNameLength) + .IsRequired(); + b.Property(t => t.Culture) + .HasColumnName(nameof(TextTemplate.Culture)) + .HasMaxLength(TextTemplateConsts.MaxCultureLength) + .IsRequired(); + + b.Property(t => t.Content) + .HasColumnName(nameof(TextTemplate.Content)) + .HasMaxLength(TextTemplateConsts.MaxContentLength); + + b.HasIndex(p => new { p.TenantId, p.Name }) + .HasDatabaseName("IX_Tenant_Text_Template_Name"); + + b.ApplyObjectExtensionMappings(); + }); + + builder.TryConfigureObjectExtensions(); + } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/AbpTextTemplatingEntityFrameworkCoreModule.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/AbpTextTemplatingEntityFrameworkCoreModule.cs new file mode 100644 index 000000000..f6f308316 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/AbpTextTemplatingEntityFrameworkCoreModule.cs @@ -0,0 +1,21 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.TextTemplating.EntityFrameworkCore; + +[DependsOn( + typeof(AbpTextTemplatingDomainModule), + typeof(AbpEntityFrameworkCoreModule))] +public class AbpTextTemplatingEntityFrameworkCoreModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAbpDbContext(options => + { + options.AddRepository(); + + options.AddDefaultRepositories(); + }); + } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/EfCoreTextTemplateRepository.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/EfCoreTextTemplateRepository.cs new file mode 100644 index 000000000..bf4dd4992 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/EfCoreTextTemplateRepository.cs @@ -0,0 +1,31 @@ +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; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Abp.TextTemplating.EntityFrameworkCore; + +public class EfCoreTextTemplateRepository : + EfCoreRepository, + ITextTemplateRepository, + ITransientDependency +{ + public EfCoreTextTemplateRepository( + IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } + + public async virtual Task FindByNameAsync(string name, string culture = null, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .Where(x => x.Name.Equals(name)) + .WhereIf(!culture.IsNullOrWhiteSpace(), x => x.Culture.Equals(culture)) + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/ITextTemplatingDbContext.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/ITextTemplatingDbContext.cs new file mode 100644 index 000000000..dab92e53e --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/ITextTemplatingDbContext.cs @@ -0,0 +1,13 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Data; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Abp.TextTemplating.EntityFrameworkCore; + +[IgnoreMultiTenancy] +[ConnectionStringName(AbpTextTemplatingDbProperties.ConnectionStringName)] +public interface ITextTemplatingDbContext : IEfCoreDbContext +{ + DbSet TextTemplates { get; } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/TextTemplatingDbContext.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/TextTemplatingDbContext.cs new file mode 100644 index 000000000..120b0527f --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/TextTemplatingDbContext.cs @@ -0,0 +1,25 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Data; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Abp.TextTemplating.EntityFrameworkCore; + +[IgnoreMultiTenancy] +[ConnectionStringName(AbpTextTemplatingDbProperties.ConnectionStringName)] +public class TextTemplatingDbContext : AbpDbContext, ITextTemplatingDbContext +{ + public DbSet TextTemplates { get; set; } + + public TextTemplatingDbContext(DbContextOptions options) + : base(options) + { + } + + protected override void OnModelCreating(ModelBuilder builder) + { + base.OnModelCreating(builder); + + builder.ConfigureTextTemplating(); + } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/TextTemplatingEfCoreQueryableExtensions.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/TextTemplatingEfCoreQueryableExtensions.cs new file mode 100644 index 000000000..f439a71fc --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/TextTemplatingEfCoreQueryableExtensions.cs @@ -0,0 +1,5 @@ +namespace LINGYUN.Abp.TextTemplating.EntityFrameworkCore; + +public static class TextTemplatingEfCoreQueryableExtensions +{ +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/FodyWeavers.xml b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/FodyWeavers.xml new file mode 100644 index 000000000..c485a4548 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/FodyWeavers.xsd b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/FodyWeavers.xsd new file mode 100644 index 000000000..11da52550 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/LINGYUN.Abp.TextTemplating.HttpApi.Client.csproj b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/LINGYUN.Abp.TextTemplating.HttpApi.Client.csproj new file mode 100644 index 000000000..985b97d4c --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/LINGYUN.Abp.TextTemplating.HttpApi.Client.csproj @@ -0,0 +1,19 @@ + + + + + + + netstandard2.0 + + + + + + + + + + + + diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/LINGYUN/Abp/TextTemplating/AbpTextTemplatingHttpApiClientModule.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/LINGYUN/Abp/TextTemplating/AbpTextTemplatingHttpApiClientModule.cs new file mode 100644 index 000000000..96a398c6e --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/LINGYUN/Abp/TextTemplating/AbpTextTemplatingHttpApiClientModule.cs @@ -0,0 +1,19 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Http.Client; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.TextTemplating; + +[DependsOn( + typeof(AbpTextTemplatingApplicationContractsModule), + typeof(AbpHttpClientModule))] +public class AbpTextTemplatingHttpApiClientModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddHttpClientProxies( + typeof(AbpTextTemplatingApplicationContractsModule).Assembly, + AbpTextTemplatingRemoteServiceConsts.RemoteServiceName + ); + } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/FodyWeavers.xml b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/FodyWeavers.xml new file mode 100644 index 000000000..c485a4548 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/FodyWeavers.xsd b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/FodyWeavers.xsd new file mode 100644 index 000000000..11da52550 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN.Abp.TextTemplating.HttpApi.csproj b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN.Abp.TextTemplating.HttpApi.csproj new file mode 100644 index 000000000..8e0fea148 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN.Abp.TextTemplating.HttpApi.csproj @@ -0,0 +1,19 @@ + + + + + + + net6.0 + + + + + + + + + + + + diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN/Abp/TextTemplating/AbpTextTemplatingControllerBase.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN/Abp/TextTemplating/AbpTextTemplatingControllerBase.cs new file mode 100644 index 000000000..ba0ea8413 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN/Abp/TextTemplating/AbpTextTemplatingControllerBase.cs @@ -0,0 +1,12 @@ +using LINGYUN.Abp.TextTemplating.Localization; +using Volo.Abp.AspNetCore.Mvc; + +namespace LINGYUN.Abp.TextTemplating; + +public abstract class AbpTextTemplatingControllerBase : AbpControllerBase +{ + protected AbpTextTemplatingControllerBase() + { + LocalizationResource = typeof(AbpTextTemplatingResource); + } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN/Abp/TextTemplating/AbpTextTemplatingHttpApiModule.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN/Abp/TextTemplating/AbpTextTemplatingHttpApiModule.cs new file mode 100644 index 000000000..74424eaa9 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN/Abp/TextTemplating/AbpTextTemplatingHttpApiModule.cs @@ -0,0 +1,40 @@ +using LINGYUN.Abp.TextTemplating.Localization; +using Localization.Resources.AbpUi; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.Localization; +using Volo.Abp.Localization; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.TextTemplating; + +[DependsOn( + typeof(AbpTextTemplatingApplicationContractsModule), + typeof(AbpAspNetCoreMvcModule))] +public class AbpTextTemplatingHttpApiModule : AbpModule +{ + public override void PreConfigureServices(ServiceConfigurationContext context) + { + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpTextTemplatingHttpApiModule).Assembly); + }); + + PreConfigure(options => + { + options.AddAssemblyResource( + typeof(AbpTextTemplatingResource), + typeof(AbpTextTemplatingApplicationContractsModule).Assembly); + }); + } + + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.Resources + .Get() + .AddBaseTypes(typeof(AbpUiResource)); + }); + } +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN/Abp/TextTemplating/TextTemplateController.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN/Abp/TextTemplating/TextTemplateController.cs new file mode 100644 index 000000000..9c7f71641 --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN/Abp/TextTemplating/TextTemplateController.cs @@ -0,0 +1,53 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Abp.TextTemplating; + +[Controller] +[Authorize(AbpTextTemplatingPermissions.TextTemplate.Default)] +[RemoteService(Name = AbpTextTemplatingRemoteServiceConsts.RemoteServiceName)] +[Area(AbpTextTemplatingRemoteServiceConsts.ModuleName)] +[Route("api/text-templating/templates")] +public class TextTemplateController : AbpTextTemplatingControllerBase, ITextTemplateAppService +{ + protected ITextTemplateAppService TextTemplateAppService { get; } + + public TextTemplateController( + ITextTemplateAppService textTemplateAppService) + { + TextTemplateAppService = textTemplateAppService; + } + + [HttpGet] + [Route("{Name}")] + [Route("{Culture}/{Name}")] + public Task GetAsync(TextTemplateGetInput input) + { + return TextTemplateAppService.GetAsync(input); + } + + [HttpGet] + public Task> GetListAsync() + { + return TextTemplateAppService.GetListAsync(); + } + + [HttpDelete] + [Route("{Name}")] + [Route("{Culture}/{Name}")] + [Authorize(AbpTextTemplatingPermissions.TextTemplate.Delete)] + public Task ResetDefaultAsync(TextTemplateGetInput input) + { + return TextTemplateAppService.ResetDefaultAsync(input); + } + + [HttpPost] + [Authorize(AbpTextTemplatingPermissions.TextTemplate.Update)] + public Task UpdateAsync(TextTemplateUpdateInput input) + { + return TextTemplateAppService.UpdateAsync(input); + } +} diff --git a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.Configure.cs b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.Configure.cs index ac8d92932..53b5adbf7 100644 --- a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.Configure.cs +++ b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.Configure.cs @@ -326,6 +326,11 @@ public partial class BackendAdminHttpApiHostModule options.Audience = configuration["AuthServer:ApiName"]; }); + if (isDevelopment) + { + // services.AddAlwaysAllowAuthorization(); + } + if (!isDevelopment) { var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); diff --git a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.cs b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.cs index 927d353ce..b77eccd57 100644 --- a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.cs +++ b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.cs @@ -17,6 +17,8 @@ using LINGYUN.Abp.Serilog.Enrichers.Application; using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using LINGYUN.Abp.SettingManagement; using LINGYUN.Abp.Sms.Aliyun; +using LINGYUN.Abp.TextTemplating; +using LINGYUN.Abp.TextTemplating.EntityFrameworkCore; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; @@ -59,6 +61,8 @@ namespace LY.MicroService.BackendAdmin; typeof(AbpAuditingHttpApiModule), typeof(AbpSaasApplicationModule), typeof(AbpSaasHttpApiModule), + typeof(AbpTextTemplatingApplicationModule), + typeof(AbpTextTemplatingHttpApiModule), typeof(AbpEntityFrameworkCoreMySQLModule), typeof(AbpIdentityEntityFrameworkCoreModule),// 用户角色权限需要引用包 typeof(AbpIdentityServerEntityFrameworkCoreModule), // 客户端权限需要引用包 @@ -70,6 +74,7 @@ namespace LY.MicroService.BackendAdmin; typeof(AbpPermissionManagementEntityFrameworkCoreModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule), typeof(AbpLocalizationManagementEntityFrameworkCoreModule), + typeof(AbpTextTemplatingEntityFrameworkCoreModule), typeof(AbpDataDbMigratorModule), typeof(AbpAspNetCoreAuthenticationJwtBearerModule), typeof(AbpEmailingExceptionHandlingModule), diff --git a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/EntityFrameworkCore/BackendAdminMigrationsDbContext.cs b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/EntityFrameworkCore/BackendAdminMigrationsDbContext.cs index 04647134f..edec673ff 100644 --- a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/EntityFrameworkCore/BackendAdminMigrationsDbContext.cs +++ b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/EntityFrameworkCore/BackendAdminMigrationsDbContext.cs @@ -4,6 +4,7 @@ using Volo.Abp.FeatureManagement.EntityFrameworkCore; using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore; using LINGYUN.Abp.Saas.EntityFrameworkCore; +using LINGYUN.Abp.TextTemplating.EntityFrameworkCore; namespace LY.MicroService.BackendAdmin.EntityFrameworkCore; @@ -23,5 +24,6 @@ public class BackendAdminMigrationsDbContext : AbpDbContext + + + diff --git a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Migrations/20220625063937_Add-Module-Text-Templating.Designer.cs b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Migrations/20220625063937_Add-Module-Text-Templating.Designer.cs new file mode 100644 index 000000000..e745525b3 --- /dev/null +++ b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Migrations/20220625063937_Add-Module-Text-Templating.Designer.cs @@ -0,0 +1,354 @@ +// +using System; +using LY.MicroService.BackendAdmin.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +#nullable disable + +namespace LY.MicroService.BackendAdmin.Migrations +{ + [DbContext(typeof(BackendAdminMigrationsDbContext))] + [Migration("20220625063937_Add-Module-Text-Templating")] + partial class AddModuleTextTemplating + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "6.0.6") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Abp.Saas.Editions.Edition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.HasKey("Id"); + + b.HasIndex("DisplayName"); + + b.ToTable("AbpEditions", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("DisableTime") + .HasColumnType("datetime(6)"); + + b.Property("EditionId") + .HasColumnType("char(36)"); + + b.Property("EnableTime") + .HasColumnType("datetime(6)"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("EditionId"); + + b.HasIndex("Name"); + + b.ToTable("AbpTenants", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.TextTemplating.TextTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Content") + .HasMaxLength(1048576) + .HasColumnType("longtext") + .HasColumnName("Content"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("Culture") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("Culture"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnName("DisplayName"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnName("Name"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name") + .HasDatabaseName("IX_Tenant_Text_Template_Name"); + + b.ToTable("AbpTextTemplates", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique(); + + b.ToTable("AbpFeatureValues", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey") + .IsUnique(); + + b.ToTable("AbpPermissionGrants", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique(); + + b.ToTable("AbpSettings", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.Tenant", b => + { + b.HasOne("LINGYUN.Abp.Saas.Editions.Edition", "Edition") + .WithMany() + .HasForeignKey("EditionId"); + + b.Navigation("Edition"); + }); + + modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.TenantConnectionString", b => + { + b.HasOne("LINGYUN.Abp.Saas.Tenants.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.Tenant", b => + { + b.Navigation("ConnectionStrings"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Migrations/20220624035652_Add-Entity-Notification-Template.cs b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Migrations/20220625063937_Add-Module-Text-Templating.cs similarity index 70% rename from aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Migrations/20220624035652_Add-Entity-Notification-Template.cs rename to aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Migrations/20220625063937_Add-Module-Text-Templating.cs index 4ac406c58..0a9d4efc9 100644 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Migrations/20220624035652_Add-Entity-Notification-Template.cs +++ b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Migrations/20220625063937_Add-Module-Text-Templating.cs @@ -3,25 +3,23 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace LY.MicroService.RealtimeMessage.Migrations +namespace LY.MicroService.BackendAdmin.Migrations { - public partial class AddEntityNotificationTemplate : Migration + public partial class AddModuleTextTemplating : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( - name: "AppNotificationTemplates", + name: "AbpTextTemplates", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), TenantId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), Name = table.Column(type: "varchar(100)", maxLength: 100, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), - Description = table.Column(type: "varchar(255)", maxLength: 255, nullable: true) + DisplayName = table.Column(type: "varchar(100)", maxLength: 100, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), - Title = table.Column(type: "varchar(100)", maxLength: 100, nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Content = table.Column(type: "longtext", maxLength: 1048576, nullable: false) + Content = table.Column(type: "longtext", maxLength: 1048576, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Culture = table.Column(type: "varchar(30)", maxLength: 30, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), @@ -32,20 +30,20 @@ namespace LY.MicroService.RealtimeMessage.Migrations }, constraints: table => { - table.PrimaryKey("PK_AppNotificationTemplates", x => x.Id); + table.PrimaryKey("PK_AbpTextTemplates", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( - name: "IX_Tenant_Notification_Template_Name", - table: "AppNotificationTemplates", + name: "IX_Tenant_Text_Template_Name", + table: "AbpTextTemplates", columns: new[] { "TenantId", "Name" }); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( - name: "AppNotificationTemplates"); + name: "AbpTextTemplates"); } } } diff --git a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Migrations/BackendAdminHostMigrationsDbContextModelSnapshot.cs b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Migrations/BackendAdminHostMigrationsDbContextModelSnapshot.cs index 86146a8dc..e56760307 100644 --- a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Migrations/BackendAdminHostMigrationsDbContextModelSnapshot.cs +++ b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Migrations/BackendAdminHostMigrationsDbContextModelSnapshot.cs @@ -18,7 +18,7 @@ namespace LY.MicroService.BackendAdmin.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) - .HasAnnotation("ProductVersion", "6.0.3") + .HasAnnotation("ProductVersion", "6.0.6") .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("LINGYUN.Abp.Saas.Editions.Edition", b => @@ -170,6 +170,63 @@ namespace LY.MicroService.BackendAdmin.Migrations b.ToTable("AbpTenantConnectionStrings", (string)null); }); + modelBuilder.Entity("LINGYUN.Abp.TextTemplating.TextTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Content") + .HasMaxLength(1048576) + .HasColumnType("longtext") + .HasColumnName("Content"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("Culture") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("Culture"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnName("DisplayName"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnName("Name"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name") + .HasDatabaseName("IX_Tenant_Text_Template_Name"); + + b.ToTable("AbpTextTemplates", (string)null); + }); + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => { b.Property("Id") diff --git a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/appsettings.Development.json b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/appsettings.Development.json index efd24f264..5c95c86dd 100644 --- a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/appsettings.Development.json +++ b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/appsettings.Development.json @@ -25,7 +25,8 @@ "AbpSettingManagement": "Server=127.0.0.1;Database=Platform;User Id=root;Password=123456", "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform;User Id=root;Password=123456", "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform;User Id=root;Password=123456", - "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform;User Id=root;Password=123456" + "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform;User Id=root;Password=123456", + "AbpTextTemplating": "Server=127.0.0.1;Database=Platform;User Id=root;Password=123456" }, "CAP": { "EventBus": { diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/RealtimeMessageTemplateProvider.cs b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/RealtimeMessageTemplateProvider.cs deleted file mode 100644 index e6b143b00..000000000 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/RealtimeMessageTemplateProvider.cs +++ /dev/null @@ -1,60 +0,0 @@ -using LINGYUN.Abp.ExceptionHandling.Notifications; -using Volo.Abp.MultiTenancy; -using Volo.Abp.TextTemplating; -using Volo.Abp.TextTemplating.Scriban; -using Volo.Abp.Users; - -namespace LY.MicroService.RealtimeMessage.Emailing; - -public class RealtimeMessageTemplateProvider : TemplateDefinitionProvider -{ - public override void Define(ITemplateDefinitionContext context) - { - context.Add(CreateEmailTemplate()); - - ReplaceDefaultTemplatePath(context); - } - - protected virtual void ReplaceDefaultTemplatePath(ITemplateDefinitionContext context) - { - var exceptionTemplate = context.GetOrNull(AbpExceptionHandlingNotificationNames.NotificationName); - if (exceptionTemplate != null) - { - exceptionTemplate - .WithScribanEngine() - .WithVirtualFilePath("/Emailing/Templates/ExceptionNotifier", isInlineLocalized: false) - .Layout = "EmailNotifierLayout"; - } - - var tenantRegisterdTemplate = context.GetOrNull(TenantNotificationNames.NewTenantRegistered); - if (tenantRegisterdTemplate != null) - { - tenantRegisterdTemplate - .WithScribanEngine() - .WithVirtualFilePath("/Emailing/Templates/NewTenantRegisterd", isInlineLocalized: false) - .Layout = "EmailNotifierLayout"; - } - - var welcomeToApplicationTemplate = context.GetOrNull(UserNotificationNames.WelcomeToApplication); - if (welcomeToApplicationTemplate != null) - { - welcomeToApplicationTemplate - .WithScribanEngine() - .WithVirtualFilePath("/Emailing/Templates/WelcomeToApplication", isInlineLocalized: false) - .Layout = "EmailNotifierLayout"; - } - } - - protected virtual TemplateDefinition[] CreateEmailTemplate() - { - return new TemplateDefinition[] - { - new TemplateDefinition( - name: "EmailNotifierLayout", - defaultCultureName: "en", - isLayout: true) - .WithScribanEngine() - .WithVirtualFilePath( "/Emailing/Templates/layout.tpl", isInlineLocalized: true), - }; - } -} diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/ExceptionNotifier/en.tpl b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/ExceptionNotifier/en.tpl deleted file mode 100644 index 96adba531..000000000 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/ExceptionNotifier/en.tpl +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - -
-
{{ model.header }} -
-
-
    -
  • Type  : {{ model.type }}
  • -
  • Message  : {{ model.message }}
  • -
  • Alarm level : {{ model.loglevel }}
  • -
  • TriggerTime : {{ creationTime }}
  • -
-
- Stack trace -
-
-
{{ model.stackTrace }}
-
-
-
- {{ model.footer }} -
-
\ No newline at end of file diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/ExceptionNotifier/zh-Hans.tpl b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/ExceptionNotifier/zh-Hans.tpl deleted file mode 100644 index d722e6e6f..000000000 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/ExceptionNotifier/zh-Hans.tpl +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - -
-
{{ model.header }} -
-
-
    -
  • 异常类型 : {{ model.title }}
  • -
  • 异常信息 : {{ model.message }}
  • -
  • 告警级别 : {{ model.loglevel }}
  • - -
  • 触发时间 : {{ creationTime }}
  • -
-
- 异常堆栈 -
-
-
{{ model.stackTrace }}
-
-
-
- {{ model.footer }} -
-
\ No newline at end of file diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/NewTenantRegisterd/en.tpl b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/NewTenantRegisterd/en.tpl deleted file mode 100644 index 7dc4cf5a8..000000000 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/NewTenantRegisterd/en.tpl +++ /dev/null @@ -1 +0,0 @@ -

A new tenant {{model.name}} has been created.

\ No newline at end of file diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/NewTenantRegisterd/zh-Hans.tpl b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/NewTenantRegisterd/zh-Hans.tpl deleted file mode 100644 index b00146366..000000000 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/NewTenantRegisterd/zh-Hans.tpl +++ /dev/null @@ -1 +0,0 @@ -

一个新的租户 {{model.name}} 已建立,切换租户开始!

\ No newline at end of file diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/WelcomeToApplication/en.tpl b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/WelcomeToApplication/en.tpl deleted file mode 100644 index 5ef5dc0e7..000000000 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/WelcomeToApplication/en.tpl +++ /dev/null @@ -1 +0,0 @@ -

{{model.name}}, Welcome to my application!

\ No newline at end of file diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/WelcomeToApplication/zh-Hans.tpl b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/WelcomeToApplication/zh-Hans.tpl deleted file mode 100644 index 78c40dc93..000000000 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/WelcomeToApplication/zh-Hans.tpl +++ /dev/null @@ -1 +0,0 @@ -

{{model.name}}, 欢迎您的加入!

\ No newline at end of file diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/layout.tpl b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/layout.tpl deleted file mode 100644 index bdd5d22d8..000000000 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Emailing/Templates/layout.tpl +++ /dev/null @@ -1,10 +0,0 @@ - - - - - {{title}} - - - {{content}} - - \ No newline at end of file diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/LY.MicroService.RealtimeMessage.HttpApi.Host.csproj b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/LY.MicroService.RealtimeMessage.HttpApi.Host.csproj index 8ffbad998..dffadccd6 100644 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/LY.MicroService.RealtimeMessage.HttpApi.Host.csproj +++ b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/LY.MicroService.RealtimeMessage.HttpApi.Host.csproj @@ -7,10 +7,6 @@ - - - - @@ -52,10 +48,10 @@ + - @@ -69,6 +65,7 @@ + diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Migrations/20220624035652_Add-Entity-Notification-Template.Designer.cs b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Migrations/20220624035652_Add-Entity-Notification-Template.Designer.cs deleted file mode 100644 index 8e8b83479..000000000 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Migrations/20220624035652_Add-Entity-Notification-Template.Designer.cs +++ /dev/null @@ -1,690 +0,0 @@ -// -using System; -using LY.MicroService.RealtimeMessage.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Volo.Abp.EntityFrameworkCore; - -#nullable disable - -namespace LY.MicroService.RealtimeMessage.Migrations -{ - [DbContext(typeof(RealtimeMessageMigrationsDbContext))] - [Migration("20220624035652_Add-Entity-Notification-Template")] - partial class AddEntityNotificationTemplate - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) - .HasAnnotation("ProductVersion", "6.0.6") - .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") - .HasMaxLength(512) - .HasColumnType("varchar(512)"); - - b.Property("Birthday") - .HasColumnType("datetime(6)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("Description") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("LastOnlineTime") - .HasColumnType("datetime(6)"); - - b.Property("NickName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("Sex") - .HasColumnType("int"); - - b.Property("Sign") - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("State") - .HasColumnType("int"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "UserId"); - - b.ToTable("AppUserChatCards", (string)null); - }); - - modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatFriend", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("Black") - .HasColumnType("tinyint(1)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("Description") - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("DontDisturb") - .HasColumnType("tinyint(1)"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("FrientId") - .HasColumnType("char(36)"); - - b.Property("IsStatic") - .HasColumnType("tinyint(1)"); - - b.Property("RemarkName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("SpecialFocus") - .HasColumnType("tinyint(1)"); - - b.Property("Status") - .HasColumnType("tinyint unsigned"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "UserId", "FrientId"); - - b.ToTable("AppUserChatFriends", (string)null); - }); - - 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") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "UserId"); - - b.ToTable("AppUserChatSettings", (string)null); - }); - - modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserMessage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1048576) - .HasColumnType("longtext"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("MessageId") - .HasColumnType("bigint"); - - b.Property("ReceiveUserId") - .HasColumnType("char(36)"); - - b.Property("SendUserName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("Source") - .HasColumnType("int"); - - b.Property("State") - .HasColumnType("tinyint"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "ReceiveUserId"); - - b.ToTable("AppUserMessages", (string)null); - }); - - modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.ChatGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("Address") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("AdminUserId") - .HasColumnType("char(36)"); - - b.Property("AllowAnonymous") - .HasColumnType("tinyint(1)"); - - b.Property("AllowSendMessage") - .HasColumnType("tinyint(1)"); - - b.Property("AvatarUrl") - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("Description") - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("GroupId") - .HasColumnType("bigint"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("MaxUserCount") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("varchar(20)"); - - b.Property("Notice") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("Tag") - .HasMaxLength(512) - .HasColumnType("varchar(512)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "Name"); - - b.ToTable("AppChatGroups", (string)null); - }); - - modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.GroupChatBlack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("GroupId") - .HasColumnType("bigint"); - - b.Property("ShieldUserId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "GroupId"); - - b.ToTable("AppGroupChatBlacks", (string)null); - }); - - modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.GroupMessage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1048576) - .HasColumnType("longtext"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("GroupId") - .HasColumnType("bigint"); - - b.Property("MessageId") - .HasColumnType("bigint"); - - b.Property("SendUserName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("Source") - .HasColumnType("int"); - - b.Property("State") - .HasColumnType("tinyint"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "GroupId"); - - b.ToTable("AppGroupMessages", (string)null); - }); - - modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.UserChatGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("GroupId") - .HasColumnType("bigint"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "GroupId", "UserId"); - - b.ToTable("AppUserChatGroups", (string)null); - }); - - modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.UserGroupCard", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsAdmin") - .HasColumnType("tinyint(1)"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("NickName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("SilenceEnd") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "UserId"); - - b.ToTable("AppUserGroupCards", (string)null); - }); - - modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("ExpirationTime") - .HasColumnType("datetime(6)"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("NotificationId") - .HasColumnType("bigint"); - - b.Property("NotificationName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("NotificationTypeName") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("varchar(512)"); - - b.Property("Severity") - .HasColumnType("tinyint"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "NotificationName"); - - b.ToTable("AppNotifications", (string)null); - }); - - modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.NotificationTemplate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1048576) - .HasColumnType("longtext"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("Culture") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("varchar(255)"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "Name") - .HasDatabaseName("IX_Tenant_Notification_Template_Name"); - - b.ToTable("AppNotificationTemplates", (string)null); - }); - - 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") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "UserId", "NotificationId") - .HasDatabaseName("IX_Tenant_User_Notification_Id"); - - b.ToTable("AppUserNotifications", (string)null); - }); - - modelBuilder.Entity("LINGYUN.Abp.MessageService.Subscriptions.UserSubscribe", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("NotificationName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.Property("UserName") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasDefaultValue("/"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "UserId", "NotificationName") - .IsUnique() - .HasDatabaseName("IX_Tenant_User_Notification_Name"); - - b.ToTable("AppUserSubscribes", (string)null); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Migrations/RealtimeMessageMigrationsDbContextModelSnapshot.cs b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Migrations/RealtimeMessageMigrationsDbContextModelSnapshot.cs index 612d4bf5e..b11ea6638 100644 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Migrations/RealtimeMessageMigrationsDbContextModelSnapshot.cs +++ b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Migrations/RealtimeMessageMigrationsDbContextModelSnapshot.cs @@ -18,7 +18,7 @@ namespace LY.MicroService.RealtimeMessage.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) - .HasAnnotation("ProductVersion", "6.0.6") + .HasAnnotation("ProductVersion", "5.0.12") .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatCard", b => @@ -560,64 +560,6 @@ namespace LY.MicroService.RealtimeMessage.Migrations b.ToTable("AppNotifications", (string)null); }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.NotificationTemplate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1048576) - .HasColumnType("longtext"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("Culture") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("varchar(30)"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("varchar(255)"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("varchar(100)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "Name") - .HasDatabaseName("IX_Tenant_Notification_Template_Name"); - - b.ToTable("AppNotificationTemplates", (string)null); - }); - modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.UserNotification", b => { b.Property("Id") diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.Configure.cs b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.Configure.cs index 07acc3bec..f76d5a0a4 100644 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.Configure.cs +++ b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.Configure.cs @@ -333,6 +333,11 @@ public partial class RealtimeMessageHttpApiHostModule }; }); + if (isDevelopment) + { + // services.AddAlwaysAllowAuthorization(); + } + if (!isDevelopment) { var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs index ecf044a5b..14272dbe2 100644 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs +++ b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs @@ -14,15 +14,16 @@ using LINGYUN.Abp.Localization.CultureMap; using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; using LINGYUN.Abp.MessageService; using LINGYUN.Abp.MessageService.EntityFrameworkCore; +using LINGYUN.Abp.Notifications.Common; using LINGYUN.Abp.Notifications.Emailing; using LINGYUN.Abp.Notifications.SignalR; using LINGYUN.Abp.Notifications.Sms; -using LINGYUN.Abp.Notifications.TextTemplating; using LINGYUN.Abp.Notifications.WeChat.MiniProgram; using LINGYUN.Abp.Saas.EntityFrameworkCore; using LINGYUN.Abp.Serilog.Enrichers.Application; using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using LINGYUN.Abp.TaskManagement.EntityFrameworkCore; +using LINGYUN.Abp.TextTemplating.EntityFrameworkCore; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; @@ -59,17 +60,18 @@ namespace LY.MicroService.RealtimeMessage; typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpPermissionManagementEntityFrameworkCoreModule), typeof(AbpLocalizationManagementEntityFrameworkCoreModule), + typeof(AbpTextTemplatingEntityFrameworkCoreModule), typeof(AbpDataDbMigratorModule), typeof(AbpAspNetCoreAuthenticationJwtBearerModule), typeof(AbpAuthorizationOrganizationUnitsModule), typeof(AbpBackgroundWorkersModule), typeof(AbpIMSignalRModule), + typeof(AbpNotificationsCommonModule), typeof(AbpNotificationsSmsModule), typeof(AbpNotificationsEmailingModule), typeof(AbpNotificationsSignalRModule), typeof(AbpNotificationsWeChatMiniProgramModule), typeof(AbpNotificationsExceptionHandlingModule), - typeof(AbpNotificationsTextTemplatingModule), typeof(AbpTextTemplatingScribanModule), typeof(AbpCAPEventBusModule), typeof(AbpCachingStackExchangeRedisModule), @@ -109,8 +111,6 @@ public partial class RealtimeMessageHttpApiHostModule : AbpModule ConfigureCors(context.Services, configuration); ConfigureSeedWorker(context.Services, hostingEnvironment.IsDevelopment()); ConfigureSecurity(context.Services, configuration, hostingEnvironment.IsDevelopment()); - - context.Services.AddAlwaysAllowAuthorization(); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/appsettings.Development.json b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/appsettings.Development.json index 2b3bb333c..5786da2c9 100644 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/appsettings.Development.json +++ b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/appsettings.Development.json @@ -30,7 +30,8 @@ "AbpSaas": "Server=127.0.0.1;Database=Platform;User Id=root;Password=123456", "AbpSettingManagement": "Server=127.0.0.1;Database=Platform;User Id=root;Password=123456", "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform;User Id=root;Password=123456", - "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform;User Id=root;Password=123456" + "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform;User Id=root;Password=123456", + "AbpTextTemplating": "Server=127.0.0.1;Database=Platform;User Id=root;Password=123456" }, "Redis": { "Configuration": "127.0.0.1,defaultDatabase=8", diff --git a/build/modules.dependencies.json b/build/modules.dependencies.json index e550bd2fa..70bfd6eb9 100644 --- a/build/modules.dependencies.json +++ b/build/modules.dependencies.json @@ -22,7 +22,6 @@ "LINGYUN.Abp.IM.dll", "LINGYUN.Abp.MessageService.Domain.Shared.dll", "LINGYUN.Abp.RealTime.dll", - "LINGYUN.Abp.Notifications.dll", "LINGYUN.Platform.Application.Contracts.dll", "LINGYUN.Platform.Domain.Shared.dll", "LINGYUN.Abp.Tencent.dll", @@ -63,7 +62,9 @@ "LINGYUN.Abp.WorkflowManagement.Domain.Shared.dll", "LINGYUN.Abp.BackgroundTasks.Abstractions.dll", "LINGYUN.Abp.TaskManagement.Application.Contracts.dll", - "LINGYUN.Abp.TaskManagement.Domain.Shared.dll" + "LINGYUN.Abp.TaskManagement.Domain.Shared.dll", + "LINGYUN.Abp.Notifications.Common.dll", + "LINGYUN.Abp.Notifications.dll" ] } ]