diff --git a/aspnet-core/LINGYUN.MicroService.All.sln b/aspnet-core/LINGYUN.MicroService.All.sln
index a1119eb5a..3f9dde932 100644
--- a/aspnet-core/LINGYUN.MicroService.All.sln
+++ b/aspnet-core/LINGYUN.MicroService.All.sln
@@ -707,7 +707,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtection.
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "security", "security", "{9D1302BE-3886-49F8-B0CD-35D2AC1E5A37}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Security", "framework\security\LINGYUN.Abp.Security\LINGYUN.Abp.Security.csproj", "{4C71CA88-0D04-4DDB-8906-B953908B8B8B}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Security", "framework\security\LINGYUN.Abp.Security\LINGYUN.Abp.Security.csproj", "{4C71CA88-0D04-4DDB-8906-B953908B8B8B}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.BackgroundTasks.Jobs", "modules\task-management\LINGYUN.Abp.BackgroundTasks.Jobs\LINGYUN.Abp.BackgroundTasks.Jobs.csproj", "{50FF92EA-8BA4-445D-AB04-E7568EE5D3FE}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.BackgroundTasks.TaskManagement", "modules\task-management\LINGYUN.Abp.BackgroundTasks.TaskManagement\LINGYUN.Abp.BackgroundTasks.TaskManagement.csproj", "{1E00BE51-A1AE-447D-B6E0-F28EC12B259A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.TaskManagement.Application.Contracts", "modules\task-management\LINGYUN.Abp.TaskManagement.Application.Contracts\LINGYUN.Abp.TaskManagement.Application.Contracts.csproj", "{61F0EEB2-5ED0-4809-8EF9-0676C7A680CE}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.TaskManagement.HttpApi.Client", "modules\task-management\LINGYUN.Abp.TaskManagement.HttpApi.Client\LINGYUN.Abp.TaskManagement.HttpApi.Client.csproj", "{72D54834-7ADF-4B18-A745-FCBBC255073B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -1799,6 +1807,22 @@ Global
{4C71CA88-0D04-4DDB-8906-B953908B8B8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C71CA88-0D04-4DDB-8906-B953908B8B8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C71CA88-0D04-4DDB-8906-B953908B8B8B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {50FF92EA-8BA4-445D-AB04-E7568EE5D3FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {50FF92EA-8BA4-445D-AB04-E7568EE5D3FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {50FF92EA-8BA4-445D-AB04-E7568EE5D3FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {50FF92EA-8BA4-445D-AB04-E7568EE5D3FE}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1E00BE51-A1AE-447D-B6E0-F28EC12B259A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1E00BE51-A1AE-447D-B6E0-F28EC12B259A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1E00BE51-A1AE-447D-B6E0-F28EC12B259A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1E00BE51-A1AE-447D-B6E0-F28EC12B259A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {61F0EEB2-5ED0-4809-8EF9-0676C7A680CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {61F0EEB2-5ED0-4809-8EF9-0676C7A680CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {61F0EEB2-5ED0-4809-8EF9-0676C7A680CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {61F0EEB2-5ED0-4809-8EF9-0676C7A680CE}.Release|Any CPU.Build.0 = Release|Any CPU
+ {72D54834-7ADF-4B18-A745-FCBBC255073B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {72D54834-7ADF-4B18-A745-FCBBC255073B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {72D54834-7ADF-4B18-A745-FCBBC255073B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {72D54834-7ADF-4B18-A745-FCBBC255073B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -2141,6 +2165,10 @@ Global
{AAC0C407-B4B9-4E90-99FC-2D793AC229D9} = {370D7CD5-1E17-4F3D-BBFA-03429F6D4F2F}
{9D1302BE-3886-49F8-B0CD-35D2AC1E5A37} = {C5CAD011-DF84-4914-939C-0C029DCEF26F}
{4C71CA88-0D04-4DDB-8906-B953908B8B8B} = {9D1302BE-3886-49F8-B0CD-35D2AC1E5A37}
+ {50FF92EA-8BA4-445D-AB04-E7568EE5D3FE} = {77ED7922-BF30-4436-8A85-78F812583913}
+ {1E00BE51-A1AE-447D-B6E0-F28EC12B259A} = {77ED7922-BF30-4436-8A85-78F812583913}
+ {61F0EEB2-5ED0-4809-8EF9-0676C7A680CE} = {77ED7922-BF30-4436-8A85-78F812583913}
+ {72D54834-7ADF-4B18-A745-FCBBC255073B} = {77ED7922-BF30-4436-8A85-78F812583913}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718}
diff --git a/aspnet-core/LINGYUN.MicroService.SingleProject.sln b/aspnet-core/LINGYUN.MicroService.SingleProject.sln
index 995423062..a6a89f171 100644
--- a/aspnet-core/LINGYUN.MicroService.SingleProject.sln
+++ b/aspnet-core/LINGYUN.MicroService.SingleProject.sln
@@ -508,6 +508,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.WeChat.Work.Com
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.AuditLogging.Elasticsearch", "framework\auditing\LINGYUN.Abp.AuditLogging.Elasticsearch\LINGYUN.Abp.AuditLogging.Elasticsearch.csproj", "{66A6E78D-E547-4DD7-9844-087FAB3D03C2}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.BackgroundTasks.TaskManagement", "modules\task-management\LINGYUN.Abp.BackgroundTasks.TaskManagement\LINGYUN.Abp.BackgroundTasks.TaskManagement.csproj", "{A99F5406-37DC-4677-9166-9BDE90C26CA6}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Saas.Jobs", "modules\saas\LINGYUN.Abp.Saas.Jobs\LINGYUN.Abp.Saas.Jobs.csproj", "{8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -1334,6 +1338,14 @@ Global
{66A6E78D-E547-4DD7-9844-087FAB3D03C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66A6E78D-E547-4DD7-9844-087FAB3D03C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66A6E78D-E547-4DD7-9844-087FAB3D03C2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A99F5406-37DC-4677-9166-9BDE90C26CA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A99F5406-37DC-4677-9166-9BDE90C26CA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A99F5406-37DC-4677-9166-9BDE90C26CA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A99F5406-37DC-4677-9166-9BDE90C26CA6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1583,6 +1595,8 @@ Global
{C4690A20-8628-4A39-8E71-2D09800D0E72} = {91867618-0D86-4410-91C6-B1166A9ACDF9}
{8233A44F-4DFC-4701-9C04-834FD3C97060} = {91867618-0D86-4410-91C6-B1166A9ACDF9}
{66A6E78D-E547-4DD7-9844-087FAB3D03C2} = {C22741F9-FC56-4AE3-B543-9F15C779D345}
+ {A99F5406-37DC-4677-9166-9BDE90C26CA6} = {D9C65C9D-8591-46DA-A3EE-419393E607AB}
+ {8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3} = {0DF5AD76-AEEA-4052-A6CA-A44C24879F11}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {711A43C0-A2F8-4E5C-9B9F-F2551E4B3FF1}
diff --git a/aspnet-core/create-database.bat b/aspnet-core/create-database.bat
new file mode 100644
index 000000000..47d19504b
--- /dev/null
+++ b/aspnet-core/create-database.bat
@@ -0,0 +1,15 @@
+@echo off
+cls
+
+call .\migrate-db-cmd.bat LY.MicroService.Platform.EntityFrameworkCore platform --ef-u
+call .\migrate-db-cmd.bat LY.MicroService.BackendAdmin.EntityFrameworkCore admin --ef-u
+call .\migrate-db-cmd.bat LY.MicroService.AuthServer.EntityFrameworkCore auth-server --ef-u
+call .\migrate-db-cmd.bat LY.MicroService.IdentityServer.EntityFrameworkCore identityserver4-admin --ef-u
+call .\migrate-db-cmd.bat LY.MicroService.LocalizationManagement.EntityFrameworkCore localization --ef-u
+call .\migrate-db-cmd.bat LY.MicroService.RealtimeMessage.EntityFrameworkCore messages --ef-u
+call .\migrate-db-cmd.bat LY.MicroService.TaskManagement.EntityFrameworkCore task-management --ef-u
+call .\migrate-db-cmd.bat LY.MicroService.WebhooksManagement.EntityFrameworkCore webhooks-management --ef-u
+
+taskkill /IM dotnet.exe /F
+
+pause
\ No newline at end of file
diff --git a/aspnet-core/framework/security/LINGYUN.Abp.Security/FodyWeavers.xml b/aspnet-core/framework/security/LINGYUN.Abp.Security/FodyWeavers.xml
new file mode 100644
index 000000000..00e1d9a1c
--- /dev/null
+++ b/aspnet-core/framework/security/LINGYUN.Abp.Security/FodyWeavers.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/aspnet-core/framework/security/LINGYUN.Abp.Security/FodyWeavers.xsd b/aspnet-core/framework/security/LINGYUN.Abp.Security/FodyWeavers.xsd
new file mode 100644
index 000000000..3f3946e28
--- /dev/null
+++ b/aspnet-core/framework/security/LINGYUN.Abp.Security/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/migrate-database.bat b/aspnet-core/migrate-database.bat
index 03645f8e9..d9594e692 100644
--- a/aspnet-core/migrate-database.bat
+++ b/aspnet-core/migrate-database.bat
@@ -1,12 +1,14 @@
@echo off
cls
-call .\migrate-db-cmd.bat LY.MicroService.BackendAdmin.DbMigrator admin --run
+call .\migrate-db-cmd.bat LY.MicroService.Platform.DbMigrator platform --run
call .\migrate-db-cmd.bat LY.MicroService.AuthServer.DbMigrator auth-server --run
call .\migrate-db-cmd.bat LY.MicroService.IdentityServer.DbMigrator identityserver4-admin --run
call .\migrate-db-cmd.bat LY.MicroService.LocalizationManagement.DbMigrator localization --run
-call .\migrate-db-cmd.bat LY.MicroService.Platform.DbMigrator platform --run
call .\migrate-db-cmd.bat LY.MicroService.RealtimeMessage.DbMigrator messages --run
call .\migrate-db-cmd.bat LY.MicroService.TaskManagement.DbMigrator task-management --run
call .\migrate-db-cmd.bat LY.MicroService.WebhooksManagement.DbMigrator webhooks-management --run
+call .\migrate-db-cmd.bat LY.MicroService.BackendAdmin.DbMigrator admin --run
+
+
pause
\ No newline at end of file
diff --git a/aspnet-core/migrate-db-cmd.bat b/aspnet-core/migrate-db-cmd.bat
index c0200d390..5a4907119 100644
--- a/aspnet-core/migrate-db-cmd.bat
+++ b/aspnet-core/migrate-db-cmd.bat
@@ -22,7 +22,7 @@ dotnet restore
goto end
:efu
-dotnet ef databse update
+dotnet ef database update
goto end
:end
diff --git a/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorHostedService.cs b/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorHostedService.cs
index 9ba5e8ddb..e16591612 100644
--- a/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorHostedService.cs
+++ b/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorHostedService.cs
@@ -29,7 +29,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
options.Services.ReplaceConfiguration(_configuration);
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
- options.AddDataMigrationEnvironment();
+ //options.AddDataMigrationEnvironment();
});
await application.InitializeAsync();
diff --git a/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/appsettings.json b/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/appsettings.json
index c3cba7638..55141e6dc 100644
--- a/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/appsettings.json
+++ b/aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/appsettings.json
@@ -4,7 +4,10 @@
"AbpIdentity": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
"OpenIddict": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
- "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
+ "AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"StringEncryption": {
"DefaultPassPhrase": "s46c5q55nxpeS8Ra",
diff --git a/aspnet-core/migrations/LY.MicroService.BackendAdmin.DbMigrator/BackendAdminDbMigratorHostedService.cs b/aspnet-core/migrations/LY.MicroService.BackendAdmin.DbMigrator/BackendAdminDbMigratorHostedService.cs
index 1a0c7a712..3f0898a83 100644
--- a/aspnet-core/migrations/LY.MicroService.BackendAdmin.DbMigrator/BackendAdminDbMigratorHostedService.cs
+++ b/aspnet-core/migrations/LY.MicroService.BackendAdmin.DbMigrator/BackendAdminDbMigratorHostedService.cs
@@ -29,7 +29,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
options.Services.ReplaceConfiguration(_configuration);
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
- options.AddDataMigrationEnvironment();
+ // options.AddDataMigrationEnvironment();
});
await application.InitializeAsync();
diff --git a/aspnet-core/migrations/LY.MicroService.BackendAdmin.DbMigrator/BackendAdminDbMigratorModule.cs b/aspnet-core/migrations/LY.MicroService.BackendAdmin.DbMigrator/BackendAdminDbMigratorModule.cs
index 023015c96..fe9292cfa 100644
--- a/aspnet-core/migrations/LY.MicroService.BackendAdmin.DbMigrator/BackendAdminDbMigratorModule.cs
+++ b/aspnet-core/migrations/LY.MicroService.BackendAdmin.DbMigrator/BackendAdminDbMigratorModule.cs
@@ -1,6 +1,12 @@
-using LY.MicroService.BackendAdmin.EntityFrameworkCore;
+using LINGYUN.Abp.TextTemplating;
+using LY.MicroService.BackendAdmin.EntityFrameworkCore;
+using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Autofac;
+using Volo.Abp.FeatureManagement;
+using Volo.Abp.Features;
using Volo.Abp.Modularity;
+using Volo.Abp.PermissionManagement;
+using Volo.Abp.SettingManagement;
namespace LY.MicroService.BackendAdmin.DbMigrator;
@@ -10,4 +16,27 @@ namespace LY.MicroService.BackendAdmin.DbMigrator;
)]
public partial class BackendAdminDbMigratorModule : AbpModule
{
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ Configure(options =>
+ {
+ options.IsDynamicSettingStoreEnabled = true;
+ options.SaveStaticSettingsToDatabase = true;
+ });
+ Configure(options =>
+ {
+ options.IsDynamicFeatureStoreEnabled = true;
+ options.SaveStaticFeaturesToDatabase = true;
+ });
+ Configure(options =>
+ {
+ options.IsDynamicPermissionStoreEnabled = true;
+ options.SaveStaticPermissionsToDatabase = true;
+ });
+ Configure(options =>
+ {
+ options.IsDynamicTemplateDefinitionStoreEnabled = true;
+ options.SaveStaticTemplateDefinitionToDatabase = true;
+ });
+ }
}
diff --git a/aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/BackendAdminDbMigrationEventHandler.cs b/aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/BackendAdminDbMigrationEventHandler.cs
index 9d4657e70..60437990c 100644
--- a/aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/BackendAdminDbMigrationEventHandler.cs
+++ b/aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/BackendAdminDbMigrationEventHandler.cs
@@ -1,27 +1,17 @@
-using Microsoft.EntityFrameworkCore;
-using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging;
using System;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
-using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Data;
-using Volo.Abp.Domain.Repositories;
-using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Migrations;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.MultiTenancy;
-using Volo.Abp.PermissionManagement;
using Volo.Abp.Uow;
namespace LY.MicroService.BackendAdmin.EntityFrameworkCore;
public class BackendAdminDbMigrationEventHandler : EfCoreDatabaseMigrationEventHandlerBase
{
- private const string ModelDatabaseProviderAnnotationKey = "_Abp_DatabaseProvider";
-
- protected IPermissionGrantRepository PermissionGrantRepository { get; }
- protected IPermissionDefinitionManager PermissionDefinitionManager { get; }
+ protected IDataSeeder DataSeeder { get; }
public BackendAdminDbMigrationEventHandler(
ICurrentTenant currentTenant,
@@ -29,129 +19,16 @@ public BackendAdminDbMigrationEventHandler(
ITenantStore tenantStore,
IDistributedEventBus distributedEventBus,
ILoggerFactory loggerFactory,
- IPermissionGrantRepository permissionGrantRepository,
- IPermissionDefinitionManager permissionDefinitionManager)
+ IDataSeeder dataSeeder)
: base(
ConnectionStringNameAttribute.GetConnStringName(),
currentTenant, unitOfWorkManager, tenantStore, distributedEventBus, loggerFactory)
{
- PermissionGrantRepository = permissionGrantRepository;
- PermissionDefinitionManager = permissionDefinitionManager;
- }
-
- protected async override Task AfterTenantConnectionStringUpdated(TenantConnectionStringUpdatedEto eventData, bool schemaMigrated)
- {
- if (!schemaMigrated ||
- string.Equals(eventData.ConnectionStringName, AbpPermissionManagementDbProperties.ConnectionStringName, StringComparison.InvariantCultureIgnoreCase))
- {
- return;
- }
-
- await SeedAdminRolePermissionsAsync(eventData.Id);
- }
-
- protected async override Task AfterTenantCreated(TenantCreatedEto eventData, bool schemaMigrated)
- {
- if (!schemaMigrated)
- {
- return;
- }
-
- await SeedAdminRolePermissionsAsync(eventData.Id);
- }
-
- protected async virtual Task SeedAdminRolePermissionsAsync(Guid tenantId)
- {
- using (CurrentTenant.Change(tenantId))
- {
-
-
- Logger.LogInformation("Seeding the new tenant admin role permissions...");
- var definitionPermissions = await PermissionDefinitionManager.GetPermissionsAsync();
- var grantPermissions = definitionPermissions
- .Where(p => p.MultiTenancySide.HasFlag(MultiTenancySides.Tenant))
- .Select(p => p.Name).ToArray();
- //var grantPermissions = new List();
- //foreach (var permission in definitionPermissions)
- //{
- // var permissionGrant = new PermissionGrant(GuidGenerator.Create(),
- // permission.Name, "R", "admin", eventData.Id);
- // grantPermissions.Add(permissionGrant);
- //}
- // TODO: MySql 批量新增还是一条一条的语句?
- // await PermissionGrantRepository.GetDbSet().AddRangeAsync(grantPermissions);
-
- var dbContext = await PermissionGrantRepository.GetDbContextAsync();
- var dbProvider = (EfCoreDatabaseProvider?)dbContext.Model[ModelDatabaseProviderAnnotationKey];
- if (dbProvider != null)
- {
- var permissionEntityType = dbContext.Model.FindEntityType(typeof(PermissionGrant));
- var permissionTableName = permissionEntityType.GetTableName();
- var batchInsertPermissionSql = string.Empty;
- switch (dbProvider)
- {
- case EfCoreDatabaseProvider.MySql:
- batchInsertPermissionSql = BuildMySqlBatchInsertScript(permissionTableName, tenantId, grantPermissions);
- break;
- case EfCoreDatabaseProvider.SqlServer:
- batchInsertPermissionSql = BuildSqlServerBatchInsertScript(permissionTableName, tenantId, grantPermissions);
- break;
- default:
- Logger.LogWarning($"Tenant permissions data has not initialized, Because database provider: {dbProvider} batch statements are not defined!");
- return;
- }
- await dbContext.Database.ExecuteSqlRawAsync(batchInsertPermissionSql);
-
- Logger.LogInformation("The new tenant permissions data initialized!");
- }
- }
- }
-
- protected virtual string BuildMySqlBatchInsertScript(string tableName, Guid tenantId, string[] permissions)
- {
- var batchInsertPermissionSql = new StringBuilder(128);
- batchInsertPermissionSql.AppendLine($"INSERT INTO `{tableName}`(`Id`, `TenantId`, `Name`, `ProviderName`, `ProviderKey`)");
- batchInsertPermissionSql.AppendLine("VALUES");
- for (int i = 0; i < permissions.Length; i++)
- {
- batchInsertPermissionSql.AppendLine($"(UUID(), '{tenantId}','{permissions[i]}','R','admin')");
- if (i < permissions.Length - 1)
- {
- batchInsertPermissionSql.AppendLine(",");
- }
- }
- return batchInsertPermissionSql.ToString();
- }
-
- protected virtual string BuildSqlServerBatchInsertScript(string tableName, Guid tenantId, string[] permissions)
- {
- var batchInsertPermissionSql = new StringBuilder(128);
- batchInsertPermissionSql.AppendLine($"INSERT INTO {tableName}(Id, TenantId, Name, ProviderName, ProviderKey)");
- batchInsertPermissionSql.Append("VALUES");
- for (int i = 0; i < permissions.Length; i++)
- {
- batchInsertPermissionSql.AppendLine($"(NEWID(), '{tenantId}','{permissions[i]}','R','admin')");
- if (i < permissions.Length - 1)
- {
- batchInsertPermissionSql.AppendLine(",");
- }
- }
- return batchInsertPermissionSql.ToString();
- }
-
- protected virtual string BuildMySqlBatchDeleteScript(string tableName, Guid tenantId)
- {
- var batchRemovePermissionSql = new StringBuilder(128);
- batchRemovePermissionSql.AppendLine($"DELETE FROM `{tableName}` WHERE `TenantId` = '{tenantId}'");
- batchRemovePermissionSql.AppendLine("AND `ProviderName`='R' AND `ProviderKey`='admin'");
- return batchRemovePermissionSql.ToString();
+ DataSeeder = dataSeeder;
}
- protected virtual string BuildSqlServerBatchDeleteScript(string tableName, Guid tenantId)
+ protected async override Task SeedAsync(Guid? tenantId)
{
- var batchRemovePermissionSql = new StringBuilder(128);
- batchRemovePermissionSql.AppendLine($"DELETE {tableName} WHERE TenantId = '{tenantId}'");
- batchRemovePermissionSql.AppendLine("AND ProviderName='R' AND ProviderKey='admin'");
- return batchRemovePermissionSql.ToString();
+ await DataSeeder.SeedAsync(tenantId);
}
}
diff --git a/aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/RolePermissionDataSeedContributor.cs b/aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/RolePermissionDataSeedContributor.cs
new file mode 100644
index 000000000..eeee0f0db
--- /dev/null
+++ b/aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/RolePermissionDataSeedContributor.cs
@@ -0,0 +1,46 @@
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging.Abstractions;
+using System.Linq;
+using System.Threading.Tasks;
+using Volo.Abp.Authorization.Permissions;
+using Volo.Abp.Data;
+using Volo.Abp.MultiTenancy;
+using Volo.Abp.PermissionManagement;
+
+namespace LY.MicroService.BackendAdmin.EntityFrameworkCore;
+
+public class RolePermissionDataSeedContributor : IDataSeedContributor
+{
+ public ILogger Logger { protected get; set; }
+
+ protected ICurrentTenant CurrentTenant { get; }
+ protected IPermissionDataSeeder PermissionDataSeeder { get; }
+ protected IPermissionDefinitionManager PermissionDefinitionManager { get; }
+
+ public RolePermissionDataSeedContributor(
+ ICurrentTenant currentTenant,
+ IPermissionDataSeeder permissionDataSeeder,
+ IPermissionDefinitionManager permissionDefinitionManager)
+ {
+ CurrentTenant = currentTenant;
+ PermissionDataSeeder = permissionDataSeeder;
+ PermissionDefinitionManager = permissionDefinitionManager;
+
+ Logger = NullLogger.Instance;
+ }
+
+ public async virtual Task SeedAsync(DataSeedContext context)
+ {
+ using (CurrentTenant.Change(context.TenantId))
+ {
+ Logger.LogInformation("Seeding the new tenant admin role permissions...");
+
+ var definitionPermissions = await PermissionDefinitionManager.GetPermissionsAsync();
+ await PermissionDataSeeder.SeedAsync(
+ RolePermissionValueProvider.ProviderName,
+ "admin",
+ definitionPermissions.Select(x => x.Name),
+ context.TenantId);
+ }
+ }
+}
diff --git a/aspnet-core/migrations/LY.MicroService.IdentityServer.DbMigrator/IdentityServerDbMigratorHostedService.cs b/aspnet-core/migrations/LY.MicroService.IdentityServer.DbMigrator/IdentityServerDbMigratorHostedService.cs
index 4d74269ca..1965c410a 100644
--- a/aspnet-core/migrations/LY.MicroService.IdentityServer.DbMigrator/IdentityServerDbMigratorHostedService.cs
+++ b/aspnet-core/migrations/LY.MicroService.IdentityServer.DbMigrator/IdentityServerDbMigratorHostedService.cs
@@ -29,7 +29,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
options.Services.ReplaceConfiguration(_configuration);
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
- options.AddDataMigrationEnvironment();
+ // options.AddDataMigrationEnvironment();
});
await application.InitializeAsync();
diff --git a/aspnet-core/migrations/LY.MicroService.IdentityServer.DbMigrator/appsettings.json b/aspnet-core/migrations/LY.MicroService.IdentityServer.DbMigrator/appsettings.json
index 830463ed7..687321e98 100644
--- a/aspnet-core/migrations/LY.MicroService.IdentityServer.DbMigrator/appsettings.json
+++ b/aspnet-core/migrations/LY.MicroService.IdentityServer.DbMigrator/appsettings.json
@@ -7,7 +7,10 @@
"AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpIdentityServer": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
- "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
+ "AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"IdentityServer": {
"Clients": {
diff --git a/aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/LocalizationManagementDbMigratorHostedService.cs b/aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/LocalizationManagementDbMigratorHostedService.cs
index 3cb986a1f..65633bbc3 100644
--- a/aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/LocalizationManagementDbMigratorHostedService.cs
+++ b/aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/LocalizationManagementDbMigratorHostedService.cs
@@ -29,7 +29,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
options.Services.ReplaceConfiguration(_configuration);
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
- options.AddDataMigrationEnvironment();
+ // options.AddDataMigrationEnvironment();
});
await application.InitializeAsync();
diff --git a/aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/LocalizationManagementDbMigratorModule.cs b/aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/LocalizationManagementDbMigratorModule.cs
index c99ed3745..31faed115 100644
--- a/aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/LocalizationManagementDbMigratorModule.cs
+++ b/aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/LocalizationManagementDbMigratorModule.cs
@@ -1,6 +1,9 @@
using LY.MicroService.LocalizationManagement.EntityFrameworkCore;
using Volo.Abp.Autofac;
+using Volo.Abp.FeatureManagement;
using Volo.Abp.Modularity;
+using Volo.Abp.PermissionManagement;
+using Volo.Abp.SettingManagement;
namespace LY.MicroService.LocalizationManagement.DbMigrator;
@@ -10,4 +13,22 @@ namespace LY.MicroService.LocalizationManagement.DbMigrator;
)]
public partial class LocalizationManagementDbMigratorModule : AbpModule
{
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ Configure(options =>
+ {
+ options.IsDynamicSettingStoreEnabled = true;
+ options.SaveStaticSettingsToDatabase = true;
+ });
+ Configure(options =>
+ {
+ options.IsDynamicFeatureStoreEnabled = true;
+ options.SaveStaticFeaturesToDatabase = true;
+ });
+ Configure(options =>
+ {
+ options.IsDynamicPermissionStoreEnabled = true;
+ options.SaveStaticPermissionsToDatabase = true;
+ });
+ }
}
diff --git a/aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/appsettings.json b/aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/appsettings.json
index 56a0ed64c..df7bc3e3e 100644
--- a/aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/appsettings.json
+++ b/aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/appsettings.json
@@ -4,7 +4,8 @@
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
- "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
+ "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"StringEncryption": {
"DefaultPassPhrase": "s46c5q55nxpeS8Ra",
diff --git a/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/LY.MicroService.Platform.DbMigrator.csproj b/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/LY.MicroService.Platform.DbMigrator.csproj
index e01d4f398..392177d94 100644
--- a/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/LY.MicroService.Platform.DbMigrator.csproj
+++ b/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/LY.MicroService.Platform.DbMigrator.csproj
@@ -11,6 +11,7 @@
+
all
diff --git a/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/PlatformDbMigratorHostedService.cs b/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/PlatformDbMigratorHostedService.cs
index 539dbdbbb..9cc97f097 100644
--- a/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/PlatformDbMigratorHostedService.cs
+++ b/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/PlatformDbMigratorHostedService.cs
@@ -29,7 +29,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
options.Services.ReplaceConfiguration(_configuration);
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
- options.AddDataMigrationEnvironment();
+ // options.AddDataMigrationEnvironment();
});
await application.InitializeAsync();
diff --git a/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/PlatformDbMigratorModule.cs b/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/PlatformDbMigratorModule.cs
index b39b17225..37479dcc2 100644
--- a/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/PlatformDbMigratorModule.cs
+++ b/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/PlatformDbMigratorModule.cs
@@ -1,7 +1,10 @@
using LINGYUN.Abp.UI.Navigation.VueVbenAdmin;
using LY.MicroService.Platform.EntityFrameworkCore;
using Volo.Abp.Autofac;
+using Volo.Abp.FeatureManagement;
using Volo.Abp.Modularity;
+using Volo.Abp.PermissionManagement;
+using Volo.Abp.SettingManagement;
namespace LY.MicroService.Platform.DbMigrator;
@@ -12,4 +15,22 @@ namespace LY.MicroService.Platform.DbMigrator;
)]
public partial class PlatformDbMigratorModule : AbpModule
{
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ Configure(options =>
+ {
+ options.IsDynamicSettingStoreEnabled = true;
+ options.SaveStaticSettingsToDatabase = true;
+ });
+ Configure(options =>
+ {
+ options.IsDynamicFeatureStoreEnabled = true;
+ options.SaveStaticFeaturesToDatabase = true;
+ });
+ Configure(options =>
+ {
+ options.IsDynamicPermissionStoreEnabled = true;
+ options.SaveStaticPermissionsToDatabase = true;
+ });
+ }
}
diff --git a/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/Program.cs b/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/Program.cs
index 55503bdb2..d86e016cb 100644
--- a/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/Program.cs
+++ b/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/Program.cs
@@ -13,14 +13,14 @@ public async static Task Main(string[] args)
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
- .MinimumLevel.Override("Volo.Abp", LogEventLevel.Warning)
+ .MinimumLevel.Override("Volo.Abp", LogEventLevel.Debug)
#if DEBUG
- .MinimumLevel.Override("LY.MicroService.Platform.DbMigrator", LogEventLevel.Debug)
+ .MinimumLevel.Override("LY.MicroService.Platform", LogEventLevel.Debug)
#else
- .MinimumLevel.Override("LY.MicroService.Platform.DbMigrator", LogEventLevel.Information)
+ .MinimumLevel.Override("LY.MicroService.Platform", LogEventLevel.Information)
#endif
.Enrich.FromLogContext()
- .WriteTo.Console()
+ .WriteTo.Console(outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}")
.WriteTo.File("Logs/migrations.txt")
.CreateLogger();
@@ -31,7 +31,6 @@ public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
.AddAppSettingsSecretsJson()
- .ConfigureLogging((context, logging) => logging.ClearProviders())
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService();
diff --git a/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/appsettings.json b/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/appsettings.json
index 1ff6fdcab..2a97776f1 100644
--- a/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/appsettings.json
+++ b/aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/appsettings.json
@@ -5,7 +5,8 @@
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
- "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
+ "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"StringEncryption": {
"DefaultPassPhrase": "s46c5q55nxpeS8Ra",
@@ -14,11 +15,11 @@
},
"Serilog": {
"MinimumLevel": {
- "Default": "Information",
+ "Default": "Debug",
"Override": {
- "System": "Warning",
- "Microsoft": "Warning",
- "DotNetCore": "Information"
+ "System": "Debug",
+ "Microsoft": "Debug",
+ "DotNetCore": "Debug"
}
},
"Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ],
diff --git a/aspnet-core/migrations/LY.MicroService.Platform.EntityFrameworkCore/PlatformDbMigrationEventHandler.cs b/aspnet-core/migrations/LY.MicroService.Platform.EntityFrameworkCore/PlatformDbMigrationEventHandler.cs
index 00a7cadaf..165b966dd 100644
--- a/aspnet-core/migrations/LY.MicroService.Platform.EntityFrameworkCore/PlatformDbMigrationEventHandler.cs
+++ b/aspnet-core/migrations/LY.MicroService.Platform.EntityFrameworkCore/PlatformDbMigrationEventHandler.cs
@@ -1,40 +1,89 @@
-using Microsoft.Extensions.Logging;
+using LINGYUN.Abp.Saas.Features;
+using LINGYUN.Abp.Saas.Tenants;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Data.Common;
+using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore.Migrations;
using Volo.Abp.EventBus.Distributed;
+using Volo.Abp.Features;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Uow;
namespace LY.MicroService.Platform.EntityFrameworkCore;
-public class PlatformDbMigrationEventHandler : EfCoreDatabaseMigrationEventHandlerBase
+public class PlatformDbMigrationEventHandler :
+ EfCoreDatabaseMigrationEventHandlerBase,
+ IDistributedEventHandler
{
protected IDataSeeder DataSeeder { get; }
-
+ protected IFeatureChecker FeatureChecker { get; }
+ protected IConfiguration Configuration { get; }
public PlatformDbMigrationEventHandler(
ICurrentTenant currentTenant,
IUnitOfWorkManager unitOfWorkManager,
ITenantStore tenantStore,
IDistributedEventBus distributedEventBus,
ILoggerFactory loggerFactory,
- IDataSeeder dataSeeder)
+ IDataSeeder dataSeeder,
+ IFeatureChecker featureChecker,
+ IConfiguration configuration)
: base(
ConnectionStringNameAttribute.GetConnStringName(),
currentTenant, unitOfWorkManager, tenantStore, distributedEventBus, loggerFactory)
{
DataSeeder = dataSeeder;
+ FeatureChecker = featureChecker;
+ Configuration = configuration;
}
- protected async override Task AfterTenantCreated(TenantCreatedEto eventData, bool schemaMigrated)
+ protected async override Task SeedAsync(Guid? tenantId)
{
- if (!schemaMigrated)
+ using (CurrentTenant.Change(tenantId))
{
- return;
+ await DataSeeder.SeedAsync(tenantId);
}
+ }
+ public async virtual Task HandleEventAsync(TenantDeletedEto eventData)
+ {
+ var hostDefaultConnectionString = Configuration.GetConnectionString(ConnectionStrings.DefaultConnectionStringName);
using (CurrentTenant.Change(eventData.Id))
{
- await DataSeeder.SeedAsync(eventData.Id);
+ // 租户删除时的资源回收策略
+ var strategyFeature = await FeatureChecker.GetOrNullAsync(SaasFeatureNames.Tenant.RecycleStrategy);
+ if (!strategyFeature.IsNullOrWhiteSpace() && Enum.TryParse(strategyFeature, out var strategy))
+ {
+ // 需要回收策略为回收且存在默认连接字符串且默认连接字符串与宿主不同
+ if (strategy == RecycleStrategy.Recycle && !eventData.DefaultConnectionString.IsNullOrWhiteSpace())
+ {
+ var hostConnection = new DbConnectionStringBuilder()
+ {
+ ConnectionString = hostDefaultConnectionString,
+ };
+ var tenantConnection = new DbConnectionStringBuilder()
+ {
+ ConnectionString = eventData.DefaultConnectionString,
+ };
+ if (hostConnection.EquivalentTo(tenantConnection))
+ {
+ return;
+ }
+
+ using var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true);
+ var buildr = new DbContextOptionsBuilder();
+ buildr.UseMySql(eventData.DefaultConnectionString, ServerVersion.AutoDetect(eventData.DefaultConnectionString));
+ await using var dbConnection = new DbContext(buildr.Options);
+ if ((await dbConnection.Database.GetAppliedMigrationsAsync()).Any())
+ {
+ await dbConnection.Database.EnsureDeletedAsync();
+ }
+ }
+ }
}
+
}
}
diff --git a/aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/RealtimeMessageDbMigratorHostedService.cs b/aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/RealtimeMessageDbMigratorHostedService.cs
index 06329b42e..b771c083a 100644
--- a/aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/RealtimeMessageDbMigratorHostedService.cs
+++ b/aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/RealtimeMessageDbMigratorHostedService.cs
@@ -29,7 +29,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
options.Services.ReplaceConfiguration(_configuration);
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
- options.AddDataMigrationEnvironment();
+ // options.AddDataMigrationEnvironment();
});
await application.InitializeAsync();
diff --git a/aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/RealtimeMessageDbMigratorModule.cs b/aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/RealtimeMessageDbMigratorModule.cs
index 02816d783..bef0d8971 100644
--- a/aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/RealtimeMessageDbMigratorModule.cs
+++ b/aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/RealtimeMessageDbMigratorModule.cs
@@ -1,7 +1,11 @@
using LINGYUN.Abp.Data.DbMigrator;
+using LINGYUN.Abp.Notifications;
using LY.MicroService.RealtimeMessage.EntityFrameworkCore;
using Volo.Abp.Autofac;
+using Volo.Abp.FeatureManagement;
using Volo.Abp.Modularity;
+using Volo.Abp.PermissionManagement;
+using Volo.Abp.SettingManagement;
namespace LY.MicroService.RealtimeMessage.DbMigrator;
@@ -12,4 +16,27 @@ namespace LY.MicroService.RealtimeMessage.DbMigrator;
)]
public partial class RealtimeMessageDbMigratorModule : AbpModule
{
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ Configure(options =>
+ {
+ options.IsDynamicSettingStoreEnabled = true;
+ options.SaveStaticSettingsToDatabase = true;
+ });
+ Configure(options =>
+ {
+ options.IsDynamicFeatureStoreEnabled = true;
+ options.SaveStaticFeaturesToDatabase = true;
+ });
+ Configure(options =>
+ {
+ options.IsDynamicPermissionStoreEnabled = true;
+ options.SaveStaticPermissionsToDatabase = true;
+ });
+ Configure(options =>
+ {
+ options.IsDynamicNotificationsStoreEnabled = true;
+ options.SaveStaticNotificationsToDatabase = true;
+ });
+ }
}
diff --git a/aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/appsettings.json b/aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/appsettings.json
index 288b4bbf4..7ac997d95 100644
--- a/aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/appsettings.json
+++ b/aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/appsettings.json
@@ -6,7 +6,8 @@
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
- "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
+ "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"StringEncryption": {
"DefaultPassPhrase": "s46c5q55nxpeS8Ra",
diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/AbpNotificationsEntityFrameworkCoreModule.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/AbpNotificationsEntityFrameworkCoreModule.cs
index 24ec28ced..715d855a2 100644
--- a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/AbpNotificationsEntityFrameworkCoreModule.cs
+++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/AbpNotificationsEntityFrameworkCoreModule.cs
@@ -8,8 +8,7 @@ namespace LINGYUN.Abp.Notifications.EntityFrameworkCore;
[DependsOn(
typeof(AbpCachingModule),
typeof(AbpAutoMapperModule),
- typeof(AbpNotificationsModule),
- typeof(AbpNotificationsDomainSharedModule))]
+ typeof(AbpNotificationsDomainModule))]
public class AbpNotificationsEntityFrameworkCoreModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/Tenants/TenantAppService.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/Tenants/TenantAppService.cs
index 1d316498b..03b652c3f 100644
--- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/Tenants/TenantAppService.cs
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/Tenants/TenantAppService.cs
@@ -153,6 +153,18 @@ public async virtual Task DeleteAsync(Guid id)
{
return;
}
+ var eto = new TenantDeletedEto
+ {
+ Id = tenant.Id,
+ Name = tenant.Name,
+ EntityVersion = tenant.EntityVersion,
+ DefaultConnectionString = tenant.FindDefaultConnectionString(),
+ };
+ CurrentUnitOfWork.OnCompleted(async () =>
+ {
+ await EventBus.PublishAsync(eto);
+ });
+
await TenantRepository.DeleteAsync(tenant);
await CurrentUnitOfWork.SaveChangesAsync();
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Editions/EditionEto.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Editions/EditionEto.cs
index 95f4dd647..d1db721ec 100644
--- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Editions/EditionEto.cs
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Editions/EditionEto.cs
@@ -1,9 +1,11 @@
using System;
using Volo.Abp.Auditing;
+using Volo.Abp.EventBus;
namespace LINGYUN.Abp.Saas.Editions;
[Serializable]
+[EventName("abp.saas.edition")]
public class EditionEto : IHasEntityVersion
{
public Guid Id { get; set; }
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Localization/Resources/en.json b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Localization/Resources/en.json
index 68f9989c1..325bd5831 100644
--- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Localization/Resources/en.json
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Localization/Resources/en.json
@@ -28,6 +28,7 @@
"DisplayName:EnableTime": "Enable Time",
"DisplayName:DisableTime": "Disable Time",
"ManageHostFeatures": "Manage Host features",
+ "Features:Saas": "Saas",
"Permission:Saas": "Saas",
"Permission:EditionManagement": "Edition management",
"Permission:TenantManagement": "Tenant management",
@@ -38,6 +39,12 @@
"Permission:ManageFeatures": "Manage features",
"DisplayName:AdminEmailAddress": "Admin Email Address",
"DisplayName:AdminPassword": "Admin Password",
+ "Features:RecycleStrategy": "Recycle Strategy",
+ "Features:RecycleStrategyDesc": "This section describes how to set the resource reclamation policy for tenants after the grace period expires",
+ "Features:ExpirationReminderDays": "Expired warning days",
+ "Features:ExpirationReminderDaysDesc": "Send a reminder to the administrator when the resource has how many days left to expire",
+ "Features:ExpiredRecoveryTime": "Expired Recovery Time",
+ "Features:ExpiredRecoveryTimeDesc": "If the resource expiration is not handled for a long time, tenant resources will be reclaimed",
"TenantNotFoundById": "Tenant: {0} not found!",
"TenantNotFoundByName": "Tenant: {0} not found!",
"UnActived": "UnActived"
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Localization/Resources/zh-Hans.json b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Localization/Resources/zh-Hans.json
index 1ffbecb35..0e0ee4f7d 100644
--- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Localization/Resources/zh-Hans.json
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Localization/Resources/zh-Hans.json
@@ -28,6 +28,7 @@
"DisplayName:EnableTime": "启用时间",
"DisplayName:DisableTime": "禁用时间",
"ManageHostFeatures": "管理Host特性",
+ "Features:Saas": "Saas",
"Permission:Saas": "Saas",
"Permission:EditionManagement": "版本管理",
"Permission:TenantManagement": "租户管理",
@@ -38,6 +39,12 @@
"Permission:ManageFeatures": "管理功能",
"DisplayName:AdminEmailAddress": "管理员电子邮件地址",
"DisplayName:AdminPassword": "管理员密码",
+ "Features:RecycleStrategy": "资源回收策略",
+ "Features:RecycleStrategyDesc": "设定租户超过宽限过期时间后的资源回收策略",
+ "Features:ExpirationReminderDays": "过期预警天数",
+ "Features:ExpirationReminderDaysDesc": "当资源还有多少天过期时, 给管理员发送提醒",
+ "Features:ExpiredRecoveryTime": "过期回收时长",
+ "Features:ExpiredRecoveryTimeDesc": "当资源超期多久没有处理, 将回收租户资源",
"TenantNotFoundById": "租户: {0} 不存在!",
"TenantNotFoundByName": "租户: {0} 不存在!",
"UnActived": "未启用"
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/RecycleStrategy.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/RecycleStrategy.cs
new file mode 100644
index 000000000..c5a11a108
--- /dev/null
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/RecycleStrategy.cs
@@ -0,0 +1,15 @@
+namespace LINGYUN.Abp.Saas.Tenants;
+///
+/// 资源回收策略
+///
+public enum RecycleStrategy
+{
+ ///
+ /// 保留
+ ///
+ Reserve,
+ ///
+ /// 回收
+ ///
+ Recycle,
+}
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantDeletedEto.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantDeletedEto.cs
new file mode 100644
index 000000000..34dc7c772
--- /dev/null
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantDeletedEto.cs
@@ -0,0 +1,11 @@
+using System;
+using Volo.Abp.EventBus;
+
+namespace LINGYUN.Abp.Saas.Tenants;
+
+[Serializable]
+[EventName("abp.saas.tenant.deleted")]
+public class TenantDeletedEto : TenantEto
+{
+ public string DefaultConnectionString { get; set; }
+}
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantEto.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantEto.cs
index 0cce5ef0f..819a7ef0a 100644
--- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantEto.cs
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantEto.cs
@@ -1,9 +1,11 @@
using System;
using Volo.Abp.Auditing;
+using Volo.Abp.EventBus;
namespace LINGYUN.Abp.Saas.Tenants;
[Serializable]
+[EventName("abp.saas.tenant")]
public class TenantEto : IHasEntityVersion
{
public Guid Id { get; set; }
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN.Abp.Saas.Domain.csproj b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN.Abp.Saas.Domain.csproj
index 5d2fa4e94..199fa1f4c 100644
--- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN.Abp.Saas.Domain.csproj
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN.Abp.Saas.Domain.csproj
@@ -12,6 +12,7 @@
+
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Features/SaasFeatureDefinitionProvider.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Features/SaasFeatureDefinitionProvider.cs
new file mode 100644
index 000000000..b1b503389
--- /dev/null
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Features/SaasFeatureDefinitionProvider.cs
@@ -0,0 +1,61 @@
+using LINGYUN.Abp.Saas.Localization;
+using LINGYUN.Abp.Saas.Tenants;
+using Volo.Abp.Features;
+using Volo.Abp.Localization;
+using Volo.Abp.Validation.StringValues;
+
+namespace LINGYUN.Abp.Saas.Features;
+public class SaasFeatureDefinitionProvider : FeatureDefinitionProvider
+{
+ public override void Define(IFeatureDefinitionContext context)
+ {
+ var saas = context.AddGroup(
+ name: SaasFeatureNames.GroupName,
+ displayName: L("Features:Saas"));
+
+ var selectionValueType = new SelectionStringValueType
+ {
+ ItemSource = new StaticSelectionStringValueItemSource(
+ new LocalizableSelectionStringValueItem
+ {
+ Value = RecycleStrategy.Reserve.ToString(),
+ DisplayText = new LocalizableStringInfo(
+ LocalizationResourceNameAttribute.GetName(typeof(AbpSaasResource)),
+ "RecycleStrategy:Reserve")
+ },
+ new LocalizableSelectionStringValueItem
+ {
+ Value = RecycleStrategy.Recycle.ToString(),
+ DisplayText = new LocalizableStringInfo(
+ LocalizationResourceNameAttribute.GetName(typeof(AbpSaasResource)),
+ "RecycleStrategy:Recycle")
+ })
+ };
+ saas.AddFeature(
+ name: SaasFeatureNames.Tenant.RecycleStrategy,
+ defaultValue: RecycleStrategy.Recycle.ToString(),
+ displayName: L("Features:RecycleStrategy"),
+ description: L("Features:RecycleStrategyDesc"),
+ valueType: selectionValueType,
+ isAvailableToHost: false);
+ saas.AddFeature(
+ name: SaasFeatureNames.Tenant.ExpirationReminderDays,
+ defaultValue: 15.ToString(),
+ displayName: L("Features:ExpirationReminderDays"),
+ description: L("Features:ExpirationReminderDaysDesc"),
+ valueType: new ToggleStringValueType(new NumericValueValidator(1, 30)),
+ isAvailableToHost: false);
+ saas.AddFeature(
+ name: SaasFeatureNames.Tenant.ExpiredRecoveryTime,
+ defaultValue: 15.ToString(),
+ displayName: L("Features:ExpiredRecoveryTime"),
+ description: L("Features:ExpiredRecoveryTimeDesc"),
+ valueType: new ToggleStringValueType(new NumericValueValidator(1, 30)),
+ isAvailableToHost: false);
+ }
+
+ protected ILocalizableString L(string name)
+ {
+ return LocalizableString.Create(name);
+ }
+}
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Features/SaasFeatureNames.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Features/SaasFeatureNames.cs
new file mode 100644
index 000000000..75bf2dc1d
--- /dev/null
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Features/SaasFeatureNames.cs
@@ -0,0 +1,28 @@
+namespace LINGYUN.Abp.Saas.Features;
+public static class SaasFeatureNames
+{
+ public const string GroupName = "AbpSaas";
+
+ public static class Tenant
+ {
+ public const string Default = GroupName + ".Tenants";
+ ///
+ /// 资源回收策略
+ ///
+ public const string RecycleStrategy = Default + ".RecycleStrategy";
+ ///
+ /// 过期回收时长
+ ///
+ ///
+ /// 当资源快过期时, 需要邮件通知对应租户管理员, 超期多久没有处理, 将回收租户资源
+ ///
+ public const string ExpiredRecoveryTime = Default + ".ExpiredRecoveryTime";
+ ///
+ /// 过期预警天数
+ ///
+ ///
+ /// 当资源还有多少天过期时, 给管理员发送提醒
+ ///
+ public const string ExpirationReminderDays = Default + ".ExpirationReminderDays";
+ }
+}
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Tenants/TenantCacheItemInvalidator.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Tenants/TenantCacheItemInvalidator.cs
index 579611455..e18b7e4ae 100644
--- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Tenants/TenantCacheItemInvalidator.cs
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Tenants/TenantCacheItemInvalidator.cs
@@ -1,49 +1,49 @@
using LINGYUN.Abp.Saas.Editions;
using System;
-using System.Threading.Tasks;
-using Volo.Abp.Caching;
-using Volo.Abp.DependencyInjection;
-using Volo.Abp.Domain.Entities.Events;
+using System.Threading.Tasks;
+using Volo.Abp.Caching;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Domain.Entities.Events;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus;
using Volo.Abp.EventBus.Distributed;
-namespace LINGYUN.Abp.Saas.Tenants;
-
+namespace LINGYUN.Abp.Saas.Tenants;
+
public class TenantCacheItemInvalidator :
- IDistributedEventHandler>,
- IDistributedEventHandler>,
- IDistributedEventHandler>,
- ILocalEventHandler>,
- ITransientDependency
-{
- protected IDistributedCache Cache { get; }
-
- public TenantCacheItemInvalidator(IDistributedCache cache)
- {
- Cache = cache;
- }
-
- public async virtual Task HandleEventAsync(EntityCreatedEto eto)
+ IDistributedEventHandler>,
+ IDistributedEventHandler>,
+ IDistributedEventHandler>,
+ ILocalEventHandler>,
+ ITransientDependency
+{
+ protected IDistributedCache Cache { get; }
+
+ public TenantCacheItemInvalidator(IDistributedCache cache)
{
- await RemoveTenantCache(eto.Entity.Id, eto.Entity.Name);
- }
-
- public async virtual Task HandleEventAsync(EntityUpdatedEto eto)
+ Cache = cache;
+ }
+
+ public async virtual Task HandleEventAsync(EntityCreatedEto eto)
{
- await RemoveTenantCache(eto.Entity.Id, eto.Entity.Name);
- }
-
- public async virtual Task HandleEventAsync(EntityDeletedEto eto)
+ await RemoveTenantCache(eto.Entity.Id, eto.Entity.Name);
+ }
+
+ public async virtual Task HandleEventAsync(EntityUpdatedEto eto)
{
- await RemoveTenantCache(eto.Entity.Id, eto.Entity.Name);
- }
-
- public async virtual Task HandleEventAsync(EntityChangedEventData eventData)
- {
- await RemoveTenantCache(eventData.Entity.Id, eventData.Entity.Name);
- }
-
+ await RemoveTenantCache(eto.Entity.Id, eto.Entity.Name);
+ }
+
+ public async virtual Task HandleEventAsync(EntityDeletedEto eto)
+ {
+ await RemoveTenantCache(eto.Entity.Id, eto.Entity.Name);
+ }
+
+ public async virtual Task HandleEventAsync(EntityChangedEventData eventData)
+ {
+ await RemoveTenantCache(eventData.Entity.Id, eventData.Entity.Name);
+ }
+
protected async virtual Task RemoveTenantCache(Guid tenantId, string tenantName = null)
{
var keys = new string[]
@@ -54,7 +54,7 @@ protected async virtual Task RemoveTenantCache(Guid tenantId, string tenantName
// 同时移除租户版本缓存
EditionCacheItem.CalculateCacheKey(tenantId)
- };
+ };
await Cache.RemoveManyAsync(keys, considerUow: true);
- }
-}
+ }
+}
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/FodyWeavers.xml b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/FodyWeavers.xml
new file mode 100644
index 000000000..1715698cc
--- /dev/null
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/FodyWeavers.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN.Abp.Saas.Jobs.csproj b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN.Abp.Saas.Jobs.csproj
new file mode 100644
index 000000000..85089bfaf
--- /dev/null
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN.Abp.Saas.Jobs.csproj
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+ netstandard2.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/AbpSaasJobsModule.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/AbpSaasJobsModule.cs
new file mode 100644
index 000000000..3d6f31dbc
--- /dev/null
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/AbpSaasJobsModule.cs
@@ -0,0 +1,29 @@
+using LINGYUN.Abp.BackgroundTasks;
+using LINGYUN.Abp.Saas.Localization;
+using Volo.Abp.Emailing;
+using Volo.Abp.Localization;
+using Volo.Abp.Modularity;
+using Volo.Abp.VirtualFileSystem;
+
+namespace LINGYUN.Abp.Saas.Jobs;
+
+[DependsOn(typeof(AbpEmailingModule))]
+[DependsOn(typeof(AbpSaasDomainModule))]
+[DependsOn(typeof(AbpBackgroundTasksAbstractionsModule))]
+public class AbpSaasJobsModule : AbpModule
+{
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ Configure(options =>
+ {
+ options.FileSets.AddEmbedded();
+ });
+
+ Configure(options =>
+ {
+ options.Resources
+ .Get()
+ .AddVirtualJson("/LINGYUN/Abp/Saas/Jobs/Localization/Resources");
+ });
+ }
+}
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/LocalizableStatic.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/LocalizableStatic.cs
new file mode 100644
index 000000000..8b4068bdb
--- /dev/null
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/LocalizableStatic.cs
@@ -0,0 +1,12 @@
+using LINGYUN.Abp.Saas.Localization;
+using Volo.Abp.Localization;
+
+namespace LINGYUN.Abp.Saas.Jobs;
+
+internal static class LocalizableStatic
+{
+ public static ILocalizableString Create(string name)
+ {
+ return LocalizableString.Create(name);
+ }
+}
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/Localization/Resources/en.json b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/Localization/Resources/en.json
new file mode 100644
index 000000000..675c26379
--- /dev/null
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/Localization/Resources/en.json
@@ -0,0 +1,8 @@
+{
+ "culture": "en",
+ "texts": {
+ "TenantUsageMonitoringJob": "Tenant Usage Monitoring Job",
+ "Saas:AdminEmail": "Admin Email",
+ "Saas:TenantId": "Tenant Id"
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/Localization/Resources/zh-Hans.json b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/Localization/Resources/zh-Hans.json
new file mode 100644
index 000000000..1cfd1f3a9
--- /dev/null
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/Localization/Resources/zh-Hans.json
@@ -0,0 +1,8 @@
+{
+ "culture": "zh-Hans",
+ "texts": {
+ "TenantUsageMonitoringJob": "租户使用情况监听作业",
+ "Saas:AdminEmail": "管理员邮件地址",
+ "Saas:TenantId": "租户标识"
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/SaasJobDefinitionProvider.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/SaasJobDefinitionProvider.cs
new file mode 100644
index 000000000..7e262ca7a
--- /dev/null
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/SaasJobDefinitionProvider.cs
@@ -0,0 +1,14 @@
+using LINGYUN.Abp.BackgroundTasks;
+
+namespace LINGYUN.Abp.Saas.Jobs;
+public class SaasJobDefinitionProvider : JobDefinitionProvider
+{
+ public override void Define(IJobDefinitionContext context)
+ {
+ context.Add(new JobDefinition(
+ "TenantUsageMonitoringJob",
+ typeof(TenantUsageMonitoringJob),
+ LocalizableStatic.Create("TenantUsageMonitoringJob"),
+ TenantUsageMonitoringJob.Paramters));
+ }
+}
diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/TenantUsageMonitoringJob.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/TenantUsageMonitoringJob.cs
new file mode 100644
index 000000000..d028244f3
--- /dev/null
+++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/TenantUsageMonitoringJob.cs
@@ -0,0 +1,65 @@
+using LINGYUN.Abp.BackgroundTasks;
+using LINGYUN.Abp.Saas.Features;
+using LINGYUN.Abp.Saas.Tenants;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Volo.Abp.Emailing;
+using Volo.Abp.Features;
+using Volo.Abp.MultiTenancy;
+using Volo.Abp.Timing;
+
+namespace LINGYUN.Abp.Saas.Jobs;
+public class TenantUsageMonitoringJob : IJobRunnable
+{
+ #region Definition Paramters
+
+ public readonly static IReadOnlyList Paramters =
+ new List
+ {
+ new JobDefinitionParamter(PropertyAdminEmail, LocalizableStatic.Create("Saas:AdminEmail"), required: true),
+ new JobDefinitionParamter(PropertyTenantId, LocalizableStatic.Create("Saas:TenantId"), required: true),
+ };
+
+ #endregion
+
+ public const string PropertyAdminEmail = "AdminEmail";
+ public const string PropertyTenantId = "TenantId";
+
+ public async virtual Task ExecuteAsync(JobRunnableContext context)
+ {
+ var clock = context.GetRequiredService();
+ var currentTenant = context.GetRequiredService();
+ var repository = context.GetRequiredService();
+ var featureChecker = context.GetRequiredService();
+ using (currentTenant.Change(null))
+ {
+ var tenantId = context.GetJobData(PropertyTenantId);
+ // TODO: 租户已删除需要取消作业运行
+ var tenant = await repository.GetAsync(tenantId);
+ if (!tenant.DisableTime.HasValue)
+ {
+ return;
+ }
+ using (currentTenant.Change(tenantId))
+ {
+ var allowExpirationDays = await featureChecker.GetAsync(SaasFeatureNames.Tenant.ExpirationReminderDays, 15);
+ if (tenant.DisableTime <= clock.Now.AddDays(allowExpirationDays))
+ {
+ var adminEmail = context.GetString(PropertyAdminEmail);
+ var emailSender = context.GetRequiredService();
+ // TODO: 需要使用模板发送
+ await emailSender.SendAsync(adminEmail, "资源超时预警", "您好, 您的平台资源已到超时预警时间, 过期资源将会被回收, 且无法恢复, 请注意及时延长使用时间或对资源备份!");
+ return;
+ }
+
+ var expiredRecoveryTime = await featureChecker.GetAsync(SaasFeatureNames.Tenant.ExpiredRecoveryTime, 15);
+ if (clock.Now > tenant.DisableTime && clock.Now.Subtract(TimeSpan.FromDays(expiredRecoveryTime)) <= tenant.DisableTime)
+ {
+ // 租户已过期且达到最大宽限时间, 删除租户
+ await repository.DeleteAsync(tenant);
+ }
+ }
+ }
+ }
+}
diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Abstractions/LINGYUN/Abp/BackgroundTasks/JobDefinition.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Abstractions/LINGYUN/Abp/BackgroundTasks/JobDefinition.cs
index 8605b2aaa..9ac62e7be 100644
--- a/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Abstractions/LINGYUN/Abp/BackgroundTasks/JobDefinition.cs
+++ b/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Abstractions/LINGYUN/Abp/BackgroundTasks/JobDefinition.cs
@@ -16,6 +16,11 @@ public class JobDefinition
///
public Type JobType { get; }
///
+ /// 是否对客户端可见
+ /// Default: true.
+ ///
+ public bool IsVisibleToClients { get; set; }
+ ///
/// 显示名称
///
public ILocalizableString DisplayName { get; }
@@ -32,12 +37,14 @@ public JobDefinition(
[NotNull] Type jobType,
[NotNull] ILocalizableString displayName,
[CanBeNull] IReadOnlyList paramters = null,
- [CanBeNull] ILocalizableString description = null)
+ [CanBeNull] ILocalizableString description = null,
+ bool isVisibleToClients = true)
{
Name = name;
JobType = jobType;
DisplayName = displayName;
Description = description;
Paramters = paramters ?? new JobDefinitionParamter[0];
+ IsVisibleToClients = isVisibleToClients;
}
}
diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/README.md b/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/README.md
index 561c86980..b11c05086 100644
--- a/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/README.md
+++ b/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/README.md
@@ -1,83 +1,83 @@
-# LINGYUN.Abp.BackgroundTasks
-
-后台任务(队列)模块,Abp提供的后台作业与后台工作者不支持Cron表达式, 提供可管理的后台任务(队列)功能.
-
-实现了**Volo.Abp.BackgroundJobs.IBackgroundJobManager**, 意味着您也能通过框架后台作业接口添加新作业.
-实现了**Volo.Abp.BackgroundWorkers.IBackgroundWorkerManager**, 意味着您也能通过框架后台工作者接口添加新作业.
-
-## 任务类别
-
-* JobType.Once: 一次性任务, 此类型只会被执行一次, 适用于邮件通知等场景
-* JobType.Period: 周期性任务, 此类型任务会根据Cron表达式来决定运行方式, 适用于报表分析等场景
-* JobType.Persistent: 持续性任务, 此类型任务按照给定重复次数、重复间隔运行, 适用于接口压测等场景
-
-## 接口说明
-
-* [IJobPublisher](/LINGYUN/Abp/BackgroundTasks/IJobPublisher.cs): 作业发布接口, 将指定作业发布到当前节点
-* [IJobDispatcher](/LINGYUN/Abp/BackgroundTasks/IJobDispatcher.cs): 作业调度接口, 将指定作业调度到指定节点
-* [IJobScheduler](/LINGYUN/Abp/BackgroundTasks/IJobScheduler.cs): 调度器接口, 管理当前运行节点作业调度器
-* [IJobLockProvider](/LINGYUN/Abp/BackgroundTasks/IJobLockProvider.cs): 作业锁定接口, 指定作业加锁, 防止重复运行, 锁定时长参见作业 **LockTimeOut**
-* [IJobEventTrigger](/LINGYUN/Abp/BackgroundTasks/IJobEventTrigger.cs): 作业事件触发器接口, 作业运行前与运行后监听接口
-* [IJobStore](/LINGYUN/Abp/BackgroundTasks/IJobStore.cs): 作业持久化接口
-
-## 配置使用
-
-模块按需引用
-
-```csharp
-[DependsOn(typeof(AbpBackgroundTasksModule))]
-public class YouProjectModule : AbpModule
-{
- // other
-}
-```
-
-```csharp
-public class DemoClass
-{
- protected IServiceProvider ServiceProvider { get; }
-
- public DemoClass(IServiceProvider serviceProvider)
- {
+# LINGYUN.Abp.BackgroundTasks
+
+后台任务(队列)模块,Abp提供的后台作业与后台工作者不支持Cron表达式, 提供可管理的后台任务(队列)功能.
+
+实现了**Volo.Abp.BackgroundJobs.IBackgroundJobManager**, 意味着您也能通过框架后台作业接口添加新作业.
+实现了**Volo.Abp.BackgroundWorkers.IBackgroundWorkerManager**, 意味着您也能通过框架后台工作者接口添加新作业.
+
+## 任务类别
+
+* JobType.Once: 一次性任务, 此类型只会被执行一次, 适用于邮件通知等场景
+* JobType.Period: 周期性任务, 此类型任务会根据Cron表达式来决定运行方式, 适用于报表分析等场景
+* JobType.Persistent: 持续性任务, 此类型任务按照给定重复次数、重复间隔运行, 适用于接口压测等场景
+
+## 接口说明
+
+* [IJobPublisher](/LINGYUN/Abp/BackgroundTasks/IJobPublisher.cs): 作业发布接口, 将指定作业发布到当前节点
+* [IJobDispatcher](/LINGYUN/Abp/BackgroundTasks/IJobDispatcher.cs): 作业调度接口, 将指定作业调度到指定节点
+* [IJobScheduler](/LINGYUN/Abp/BackgroundTasks/IJobScheduler.cs): 调度器接口, 管理当前运行节点作业调度器
+* [IJobLockProvider](/LINGYUN/Abp/BackgroundTasks/IJobLockProvider.cs): 作业锁定接口, 指定作业加锁, 防止重复运行, 锁定时长参见作业 **LockTimeOut**
+* [IJobEventTrigger](/LINGYUN/Abp/BackgroundTasks/IJobEventTrigger.cs): 作业事件触发器接口, 作业运行前与运行后监听接口
+* [IJobStore](/LINGYUN/Abp/BackgroundTasks/IJobStore.cs): 作业持久化接口
+
+## 配置使用
+
+模块按需引用
+
+```csharp
+[DependsOn(typeof(AbpBackgroundTasksModule))]
+public class YouProjectModule : AbpModule
+{
+ // other
+}
+```
+
+```csharp
+public class DemoClass
+{
+ protected IServiceProvider ServiceProvider { get; }
+
+ public DemoClass(IServiceProvider serviceProvider)
+ {
ServiceProvider = serviceProvider;
- }
-
+ }
+
public async Task Some()
{
var scheduler = ServiceProvider.GetRequiredService();
// 将周期性(5秒一次)任务添加到队列
- await scheduler.QueueAsync(new JobInfo
- {
- Type = typeof(ConsoleJob).AssemblyQualifiedName,
- Args = new Dictionary(),
- Name = "Test-Console-Period",
- Group = "Test",
- Description = "Test-Console",
- Id = Guid.NewGuid(),
- JobType = JobType.Period,
- Priority = Volo.Abp.BackgroundJobs.BackgroundJobPriority.Low,
- Cron = "0/5 * * * * ? ",
- TryCount = 10,
- Status = JobStatus.Running,
- // 定义此字段处理并发
- LockTimeOut = 120,
+ await scheduler.QueueAsync(new JobInfo
+ {
+ Type = typeof(ConsoleJob).AssemblyQualifiedName,
+ Args = new Dictionary(),
+ Name = "Test-Console-Period",
+ Group = "Test",
+ Description = "Test-Console",
+ Id = Guid.NewGuid(),
+ JobType = JobType.Period,
+ Priority = Volo.Abp.BackgroundJobs.BackgroundJobPriority.Low,
+ Cron = "0/5 * * * * ? ",
+ TryCount = 10,
+ Status = JobStatus.Running,
+ // 定义此字段处理并发
+ LockTimeOut = 120,
});
// 将一次性任务添加到队列, 将在10(Interval)秒后被执行
- await scheduler.QueueAsync(new JobInfo
- {
- Type = typeof(ConsoleJob).AssemblyQualifiedName,
- Args = new Dictionary(),
- Name = "Test-Console-Once",
- Group = "Test",
- Description = "Test-Console",
- Id = Guid.NewGuid(),
- JobType = JobType.Once,
- Priority = Volo.Abp.BackgroundJobs.BackgroundJobPriority.Low,
- Interval = 10,
- TryCount = 10,
- Status = JobStatus.Running,
+ await scheduler.QueueAsync(new JobInfo
+ {
+ Type = typeof(ConsoleJob).AssemblyQualifiedName,
+ Args = new Dictionary(),
+ Name = "Test-Console-Once",
+ Group = "Test",
+ Description = "Test-Console",
+ Id = Guid.NewGuid(),
+ JobType = JobType.Once,
+ Priority = Volo.Abp.BackgroundJobs.BackgroundJobPriority.Low,
+ Interval = 10,
+ TryCount = 10,
+ Status = JobStatus.Running,
});
// 将持续性任务添加到队列, 将在10(Interval)秒后被执行, 最大执行5(MaxCount)次
@@ -113,14 +113,14 @@ public class DemoClass
// 每20秒控制台输出
await backgroundWorkManager.AddAsync(ServiceProvider.GetRequiredService());
}
-}
-
-public class SmsJobArgs
-{
+}
+
+public class SmsJobArgs
+{
public string PhoneNumber { get; set; }
public string Message { get; set; }
-}
-
+}
+
public class SmsJob : AsyncBackgroundJob, ITransientDependency
{
public override Task ExecuteAsync(SmsJobArgs args)
@@ -129,8 +129,8 @@ public class SmsJob : AsyncBackgroundJob, ITransientDependency
return Task.CompletedTask;
}
-}
-
+}
+
public class ConsoleWorker : AsyncPeriodicBackgroundWorkerBase, ISingletonDependency
{
public ConsoleWorker(AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFactory)
@@ -144,5 +144,5 @@ public class ConsoleWorker : AsyncPeriodicBackgroundWorkerBase, ISingletonDepend
Console.WriteLine($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] - ConsoleWorker Do Wrok.");
return Task.CompletedTask;
}
-}
-```
+}
+```
diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/BackgroundJobInfoAppService.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/BackgroundJobInfoAppService.cs
index 1682fb77f..db24a5430 100644
--- a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/BackgroundJobInfoAppService.cs
+++ b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/BackgroundJobInfoAppService.cs
@@ -45,6 +45,10 @@ public virtual Task> GetDefinitionsAsy
foreach (var jobDefinition in JobDefinitionManager.GetAll())
{
+ if (!jobDefinition.IsVisibleToClients)
+ {
+ continue;
+ }
var job = new BackgroundJobDefinitionDto
{
Name = jobDefinition.Name,
diff --git a/aspnet-core/services/LY.MicroService.AuthServer.HttpApi.Host/appsettings.Development.json b/aspnet-core/services/LY.MicroService.AuthServer.HttpApi.Host/appsettings.Development.json
index 230776c26..d0c0d0b65 100644
--- a/aspnet-core/services/LY.MicroService.AuthServer.HttpApi.Host/appsettings.Development.json
+++ b/aspnet-core/services/LY.MicroService.AuthServer.HttpApi.Host/appsettings.Development.json
@@ -44,14 +44,14 @@
}
},
"ConnectionStrings": {
- "Default": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456",
- "AbpIdentity": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456",
- "OpenIddict": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456",
- "AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456"
+ "Default": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpIdentity": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
+ "OpenIddict": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"CAP": {
"EventBus": {
@@ -63,13 +63,13 @@
},
"MySql": {
"TableNamePrefix": "ida",
- "ConnectionString": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456"
+ "ConnectionString": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None"
},
"RabbitMQ": {
"HostName": "127.0.0.1",
"Port": 5672,
"UserName": "admin",
- "Password": "admin",
+ "Password": "123456",
"ExchangeName": "LINGYUN.Abp.Application",
"VirtualHost": "/"
}
diff --git a/aspnet-core/services/LY.MicroService.AuthServer/appsettings.Development.json b/aspnet-core/services/LY.MicroService.AuthServer/appsettings.Development.json
index fd1ab3c06..5d6ff742a 100644
--- a/aspnet-core/services/LY.MicroService.AuthServer/appsettings.Development.json
+++ b/aspnet-core/services/LY.MicroService.AuthServer/appsettings.Development.json
@@ -44,15 +44,15 @@
}
},
"ConnectionStrings": {
- "Default": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;",
- "AbpIdentity": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456",
- "OpenIddict": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456",
- "AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AppPlatform": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456"
+ "Default": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpIdentity": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
+ "OpenIddict": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AppPlatform": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"CAP": {
"EventBus": {
@@ -64,7 +64,7 @@
},
"MySql": {
"TableNamePrefix": "auth",
- "ConnectionString": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456"
+ "ConnectionString": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None"
},
"RabbitMQ": {
"HostName": "127.0.0.1",
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 d48fc65ca..3d69f3904 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
@@ -57,7 +57,7 @@
"HostName": "127.0.0.1",
"Port": 5672,
"UserName": "admin",
- "Password": "admin",
+ "Password": "123456",
"ExchangeName": "LINGYUN.Abp.Application",
"VirtualHost": "/"
}
diff --git a/aspnet-core/services/LY.MicroService.IdentityServer.HttpApi.Host/appsettings.Development.json b/aspnet-core/services/LY.MicroService.IdentityServer.HttpApi.Host/appsettings.Development.json
index ff1ff1191..e2ee7c33e 100644
--- a/aspnet-core/services/LY.MicroService.IdentityServer.HttpApi.Host/appsettings.Development.json
+++ b/aspnet-core/services/LY.MicroService.IdentityServer.HttpApi.Host/appsettings.Development.json
@@ -45,14 +45,14 @@
}
},
"ConnectionStrings": {
- "Default": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456",
- "AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456",
- "AbpIdentityServer": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456",
- "AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456"
+ "Default": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpIdentityServer": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"CAP": {
"EventBus": {
@@ -64,7 +64,7 @@
},
"MySql": {
"TableNamePrefix": "ida",
- "ConnectionString": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456"
+ "ConnectionString": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None"
},
"RabbitMQ": {
"HostName": "127.0.0.1",
diff --git a/aspnet-core/services/LY.MicroService.IdentityServer/appsettings.Development.json b/aspnet-core/services/LY.MicroService.IdentityServer/appsettings.Development.json
index d0fa2dd46..e69d68222 100644
--- a/aspnet-core/services/LY.MicroService.IdentityServer/appsettings.Development.json
+++ b/aspnet-core/services/LY.MicroService.IdentityServer/appsettings.Development.json
@@ -44,15 +44,15 @@
}
},
"ConnectionStrings": {
- "Default": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456",
- "AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456",
- "AbpIdentityServer": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456",
- "AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AppPlatform": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456"
+ "Default": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpIdentityServer": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AppPlatform": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"CAP": {
"EventBus": {
@@ -64,7 +64,7 @@
},
"MySql": {
"TableNamePrefix": "auth",
- "ConnectionString": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456"
+ "ConnectionString": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None"
},
"RabbitMQ": {
"HostName": "127.0.0.1",
diff --git a/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/appsettings.Development.json b/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/appsettings.Development.json
index 024c7c99f..445b02446 100644
--- a/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/appsettings.Development.json
+++ b/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/appsettings.Development.json
@@ -25,11 +25,12 @@
}
},
"ConnectionStrings": {
- "Default": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456"
+ "Default": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"CAP": {
"EventBus": {
@@ -41,13 +42,13 @@
},
"MySql": {
"TableNamePrefix": "lta",
- "ConnectionString": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456"
+ "ConnectionString": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"RabbitMQ": {
"HostName": "127.0.0.1",
"Port": 5672,
"UserName": "admin",
- "Password": "admin",
+ "Password": "123456",
"ExchangeName": "LINGYUN.Abp.Application",
"VirtualHost": "/"
}
diff --git a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.Development.json b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.Development.json
index c963b9da1..41c948b67 100644
--- a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.Development.json
+++ b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.Development.json
@@ -80,7 +80,7 @@
"HostName": "127.0.0.1",
"Port": 5672,
"UserName": "admin",
- "Password": "admin",
+ "Password": "123456",
"ExchangeName": "LINGYUN.Abp.Application",
"VirtualHost": "/"
}
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 f6d5771f5..bd5d66226 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
@@ -37,17 +37,17 @@
}
},
"ConnectionStrings": {
- "Default": "Server=127.0.0.1;Database=Messages-v70;User Id=root;Password=123456",
- "MessageService": "Server=127.0.0.1;Database=Messages-v70;User Id=root;Password=123456",
- "Notifications": "Server=127.0.0.1;Database=Messages-v70;User Id=root;Password=123456",
- "TaskManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456",
- "AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
- "AbpTextTemplating": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456"
+ "Default": "Server=127.0.0.1;Database=Messages-v70;User Id=root;Password=123456;SslMode=None",
+ "MessageService": "Server=127.0.0.1;Database=Messages-v70;User Id=root;Password=123456;SslMode=None",
+ "Notifications": "Server=127.0.0.1;Database=Messages-v70;User Id=root;Password=123456;SslMode=None",
+ "TaskManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
+ "AbpTextTemplating": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"DistributedLock": {
"IsEnabled": true,
@@ -110,13 +110,13 @@
},
"MySql": {
"TableNamePrefix": "msg",
- "ConnectionString": "Server=127.0.0.1;Database=Messages-v70;User Id=root;Password=123456"
+ "ConnectionString": "Server=127.0.0.1;Database=Messages-v70;User Id=root;Password=123456;SslMode=None"
},
"RabbitMQ": {
"HostName": "127.0.0.1",
"Port": 5672,
"UserName": "admin",
- "Password": "admin",
+ "Password": "123456",
"ExchangeName": "LINGYUN.Abp.Application",
"VirtualHost": "/"
}
diff --git a/starter/01.create database.cmd b/starter/01.create database.cmd
new file mode 100644
index 000000000..3bd5272d7
--- /dev/null
+++ b/starter/01.create database.cmd
@@ -0,0 +1,4 @@
+@echo off
+cd ..\aspnet-core
+create-database.bat
+
diff --git a/starter/01.migrate-db.cmd b/starter/02.migrate-db.cmd
similarity index 100%
rename from starter/01.migrate-db.cmd
rename to starter/02.migrate-db.cmd