From 456e6c621da62b30ab1f366e157b11f2f2749fdb Mon Sep 17 00:00:00 2001 From: "zzzwangjun@gmail.com" <510423039@qq.com> Date: Sun, 10 Aug 2025 10:45:10 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96share=20host?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aspnet-core/Lion.AbpPro.sln | 7 + .../Lion.AbpPro.AspNetCore.csproj | 2 +- .../AspNetCore/AbpProAspNetCoreConsts.cs | 5 + .../AspNetCore/AbpProAspNetCoreModule.cs | 7 +- .../ServiceCollectionExtensions.cs | 17 +- .../Serilog/SerilogToEsExtensions.cs | 14 +- .../src/Lion.AbpPro.Hangfire/GlobalUsings.cs | 10 + .../Lion.AbpPro.Hangfire.csproj | 12 ++ .../AutoDeleteAfterSuccessAttribute.cs | 2 +- .../Lion/AbpPro/Hangfire/CronType.cs | 77 +++++++ .../Hangfire/CustomHangfireAuthorizeFilter.cs | 10 + .../Lion/AbpPro/Hangfire/IRecurringJob.cs | 9 + .../AbpPro}/Hangfire/JobRetryLastFilter.cs | 4 +- .../AbpProHttpApiHostConst.cs | 57 +++-- .../AbpProHttpApiHostModule.cs | 198 ++++++------------ .../Extensions/Hangfire/CronType.cs | 78 ------- .../Hangfire/CustomHangfireAuthorizeFilter.cs | 11 - .../Hangfire/RecurringJobsExtensions.cs | 15 -- .../Lion.AbpPro.HttpApi.Host/GlobalUsings.cs | 3 +- .../Lion.AbpPro.HttpApi.Host.csproj | 74 +++---- .../ServiceCollectionExtensions.cs | 9 +- .../appsettings.Production.json | 61 ++++-- .../Lion.AbpPro.HttpApi.Host/appsettings.json | 27 ++- .../Jobs/IRecurringJob.cs | 11 - .../Lion.AbpPro.Application.Contracts.csproj | 1 + .../Lion.AbpPro.Application/Jobs/TestJob.cs | 11 - .../Lion.AbpPro.DbMigrator/appsettings.json | 2 +- 27 files changed, 344 insertions(+), 390 deletions(-) create mode 100644 aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/GlobalUsings.cs create mode 100644 aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion.AbpPro.Hangfire.csproj rename aspnet-core/{services/host/Lion.AbpPro.HttpApi.Host/Extensions => frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro}/Hangfire/AutoDeleteAfterSuccessAttribute.cs (91%) create mode 100644 aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/CronType.cs create mode 100644 aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/CustomHangfireAuthorizeFilter.cs create mode 100644 aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/IRecurringJob.cs rename aspnet-core/{services/host/Lion.AbpPro.HttpApi.Host/Extensions => frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro}/Hangfire/JobRetryLastFilter.cs (83%) delete mode 100644 aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CronType.cs delete mode 100644 aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CustomHangfireAuthorizeFilter.cs delete mode 100644 aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/RecurringJobsExtensions.cs delete mode 100644 aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Jobs/IRecurringJob.cs delete mode 100644 aspnet-core/services/src/Lion.AbpPro.Application/Jobs/TestJob.cs diff --git a/aspnet-core/Lion.AbpPro.sln b/aspnet-core/Lion.AbpPro.sln index 5e27339e..2919025b 100644 --- a/aspnet-core/Lion.AbpPro.sln +++ b/aspnet-core/Lion.AbpPro.sln @@ -251,6 +251,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.HttpClient", "f EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.AspNetCore", "frameworks\src\Lion.AbpPro.AspNetCore\Lion.AbpPro.AspNetCore.csproj", "{89CCAEA6-8176-4E4B-8D84-A2ACE2715F88}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.Hangfire", "frameworks\src\Lion.AbpPro.Hangfire\Lion.AbpPro.Hangfire.csproj", "{6C2FDD3D-F711-46B0-A2F2-B94BC33F136B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -617,6 +619,10 @@ Global {89CCAEA6-8176-4E4B-8D84-A2ACE2715F88}.Debug|Any CPU.Build.0 = Debug|Any CPU {89CCAEA6-8176-4E4B-8D84-A2ACE2715F88}.Release|Any CPU.ActiveCfg = Release|Any CPU {89CCAEA6-8176-4E4B-8D84-A2ACE2715F88}.Release|Any CPU.Build.0 = Release|Any CPU + {6C2FDD3D-F711-46B0-A2F2-B94BC33F136B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6C2FDD3D-F711-46B0-A2F2-B94BC33F136B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6C2FDD3D-F711-46B0-A2F2-B94BC33F136B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6C2FDD3D-F711-46B0-A2F2-B94BC33F136B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -737,6 +743,7 @@ Global {A70659A2-91F4-4FE7-80D0-DA12430543FD} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3} {9C88C5AE-21A1-4A62-9FA3-173806CD9EE3} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3} {89CCAEA6-8176-4E4B-8D84-A2ACE2715F88} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3} + {6C2FDD3D-F711-46B0-A2F2-B94BC33F136B} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F} diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion.AbpPro.AspNetCore.csproj b/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion.AbpPro.AspNetCore.csproj index 5c4c3896..6dc5bfea 100644 --- a/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion.AbpPro.AspNetCore.csproj +++ b/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion.AbpPro.AspNetCore.csproj @@ -33,7 +33,7 @@ - + diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreConsts.cs b/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreConsts.cs index b2cb4344..afaa93ab 100644 --- a/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreConsts.cs +++ b/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreConsts.cs @@ -41,4 +41,9 @@ public class AbpProAspNetCoreConsts /// 审计配置节名称 /// public const string Audit = "Audit"; + + /// + /// token + /// + public const string Jwt = "Jwt"; } \ No newline at end of file diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreModule.cs b/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreModule.cs index 9cb3b7d0..03603a2f 100644 --- a/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreModule.cs +++ b/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreModule.cs @@ -6,17 +6,12 @@ public class AbpProAspNetCoreModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { - var s = context.Configuration.GetSection(AbpProAspNetCoreConsts.Cors); context.Services.Configure(context.Configuration.GetSection(AbpProAspNetCoreConsts.Gateway)); context.Services.Configure(context.Configuration.GetSection(AbpProAspNetCoreConsts.Cors)); context.Services.Configure(context.Configuration.GetSection(AbpProAspNetCoreConsts.MiniProfiler)); context.Services.Configure(context.Configuration.GetSection(AbpProAspNetCoreConsts.MultiTenancy)); context.Services.Configure(context.Configuration.GetSection(AbpProAspNetCoreConsts.Swagger)); context.Services.Configure(context.Configuration.GetSection(AbpProAspNetCoreConsts.Audit)); - } - - public override void ConfigureServices(ServiceConfigurationContext context) - { - + context.Services.Configure(context.Configuration.GetSection(AbpProAspNetCoreConsts.Jwt)); } } \ No newline at end of file diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs b/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs index 043a0bca..36d3103e 100644 --- a/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs +++ b/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs @@ -30,7 +30,7 @@ public static class ServiceCollectionExtensions public static IServiceCollection AddAbpProConsul(this IServiceCollection service) { - var consulOptions = service.GetRequiredService>().Value; + var consulOptions = service.BuildServiceProvider().GetRequiredService>().Value; if (!consulOptions.Enabled) return service; @@ -46,6 +46,7 @@ public static class ServiceCollectionExtensions { // TODO 检查数据库和redis是否正常 AspNetCore.HealthChecks.Redis AspNetCore.HealthChecks.MySql // context.Services.AddHealthChecks().AddRedis(redisConnectionString).AddMySql(connectString); + service.AddHealthChecks(); return service; } @@ -94,7 +95,7 @@ public static class ServiceCollectionExtensions /// public static IServiceCollection AddAbpProCors(this IServiceCollection service) { - var corsOptions = service.GetRequiredService>().Value; + var corsOptions = service.BuildServiceProvider().GetRequiredService>().Value; if (!corsOptions.Enabled) return service; service.AddCors(options => @@ -150,7 +151,7 @@ public static class ServiceCollectionExtensions /// public static IServiceCollection AddAbpProSwagger(this IServiceCollection service, string name, string version = "v1") { - var swaggerOptions = service.GetRequiredService>().Value; + var swaggerOptions = service.BuildServiceProvider().GetRequiredService>().Value; if (!swaggerOptions.Enabled) return service; service.AddSwaggerGen(options => @@ -221,9 +222,9 @@ public static class ServiceCollectionExtensions /// public static IServiceCollection AddAbpProMiniProfiler(this IServiceCollection service) { - var options = service.GetRequiredService>().Value; + var options = service.BuildServiceProvider().GetRequiredService>().Value; if (!options.Enabled) return service; - service.AddMiniProfiler(opt => opt.RouteBasePath = "/profiler").AddEntityFramework(); + service.AddMiniProfiler(opt => opt.RouteBasePath = options.RouteBasePath).AddEntityFramework(); return service; } @@ -232,7 +233,7 @@ public static class ServiceCollectionExtensions /// public static IServiceCollection AddAbpProMultiTenancy(this IServiceCollection service) { - var multiTenancyOptions = service.GetRequiredService>().Value; + var multiTenancyOptions = service.BuildServiceProvider().GetRequiredService>().Value; service.Configure(options => { options.IsEnabled = multiTenancyOptions.Enabled; }); return service; } @@ -242,7 +243,7 @@ public static class ServiceCollectionExtensions /// public static IServiceCollection AddAbpProAuthentication(this IServiceCollection service) { - var jwtOptions = service.GetRequiredService>().Value; + var jwtOptions = service.BuildServiceProvider().GetRequiredService>().Value; service.AddAuthentication(options => { @@ -315,7 +316,7 @@ public static class ServiceCollectionExtensions /// public static IServiceCollection AddAbpProAuditLog(this IServiceCollection service) { - var auditOptions = service.GetRequiredService>().Value; + var auditOptions = service.BuildServiceProvider().GetRequiredService>().Value; service.Configure (options => { diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Serilog/SerilogToEsExtensions.cs b/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Serilog/SerilogToEsExtensions.cs index 57466e36..867cabc0 100644 --- a/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Serilog/SerilogToEsExtensions.cs +++ b/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Serilog/SerilogToEsExtensions.cs @@ -8,30 +8,32 @@ public static class SerilogToEsExtensions loggerConfiguration .ReadFrom.Configuration(configuration) .Enrich.FromLogContext(); + var writeToSections = configuration.GetSection("Serilog:WriteTo").GetChildren(); + var elasticSection = writeToSections.FirstOrDefault(s => s.GetValue("Name") == "Elastic"); - var writeToElasticSearch = configuration.GetValue("ElasticSearch:Enabled", false); + var writeToElasticSearch = elasticSection?.GetSection("Args").GetValue("Enabled") ?? false; // LogToElasticSearch:Enabled = true 才输出至ES if (!writeToElasticSearch) return; - var applicationName = "Lion.AbpPro.HttpApi.Host"; + var applicationName = elasticSection?.GetSection("Args").GetValue("ApplicationName") ?? string.Empty; - var esUrl = configuration["ElasticSearch:Url"]; + var esUrl = elasticSection?.GetSection("Args").GetValue("Url"); // 需要设置ES URL if (string.IsNullOrEmpty(esUrl)) return; - var indexFormat = configuration["ElasticSearch:IndexFormat"]; + var indexFormat = elasticSection?.GetSection("Args").GetValue("IndexFormat"); // 需要设置ES URL if (string.IsNullOrEmpty(indexFormat)) return; - var esUserName = configuration["ElasticSearch:UserName"]; - var esPassword = configuration["ElasticSearch:Password"]; + var esUserName = elasticSection?.GetSection("Args").GetValue("UserName"); + var esPassword = elasticSection?.GetSection("Args").GetValue("Password"); loggerConfiguration.Enrich.FromLogContext().Enrich.WithExceptionDetails().WriteTo .Elasticsearch(BuildElasticSearchSinkOptions(esUrl, indexFormat, esUserName, esPassword)); diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/GlobalUsings.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/GlobalUsings.cs new file mode 100644 index 00000000..b0d00da1 --- /dev/null +++ b/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/GlobalUsings.cs @@ -0,0 +1,10 @@ +// Global using directives + +global using Hangfire; +global using Hangfire.Common; +global using Hangfire.Dashboard; +global using Hangfire.States; +global using Hangfire.Storage; +global using Microsoft.Extensions.DependencyInjection; +global using Volo.Abp.DependencyInjection; +global using Volo.Abp.Users; \ No newline at end of file diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion.AbpPro.Hangfire.csproj b/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion.AbpPro.Hangfire.csproj new file mode 100644 index 00000000..4b177f7a --- /dev/null +++ b/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion.AbpPro.Hangfire.csproj @@ -0,0 +1,12 @@ + + + + net9.0 + enable + + + + + + + diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/AutoDeleteAfterSuccessAttribute.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/AutoDeleteAfterSuccessAttribute.cs similarity index 91% rename from aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/AutoDeleteAfterSuccessAttribute.cs rename to aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/AutoDeleteAfterSuccessAttribute.cs index 4e67436d..933d5989 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/AutoDeleteAfterSuccessAttribute.cs +++ b/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/AutoDeleteAfterSuccessAttribute.cs @@ -1,4 +1,4 @@ -namespace Lion.AbpPro.Extensions.Hangfire; +namespace Lion.AbpPro.Hangfire; public class AutoDeleteAfterSuccessAttribute : JobFilterAttribute, IApplyStateFilter { diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/CronType.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/CronType.cs new file mode 100644 index 00000000..76754770 --- /dev/null +++ b/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/CronType.cs @@ -0,0 +1,77 @@ +namespace Lion.AbpPro.Hangfire; + +/// +/// Cron类型 +/// +public static class CronType +{ + /// + /// 周期性为分钟的任务 + /// + /// 执行周期的间隔,默认为每分钟一次 + /// + public static string Minute(int interval = 1) + { + return "1 0/" + interval.ToString() + " * * * ? "; + } + + /// + /// 周期性为小时的任务 + /// + /// 第几分钟开始,默认为第一分钟 + /// 执行周期的间隔,默认为每小时一次 + /// + public static string Hour(int minute = 1, int interval = 1) + { + return "1 " + minute + " 0/" + interval.ToString() + " * * ? "; + } + + /// + /// 周期性为天的任务 + /// + /// 第几小时开始,默认从1点开始 + /// 第几分钟开始,默认从第1分钟开始 + /// 执行周期的间隔,默认为每天一次 + /// + public static string Day(int hour = 1, int minute = 1, int interval = 1) + { + return "1 " + minute.ToString() + " " + hour.ToString() + " 1/" + interval.ToString() + " * ? "; + } + + /// + /// 周期性为周的任务 + /// + /// 星期几开始,默认从星期一点开始 + /// 第几小时开始,默认从1点开始 + /// 第几分钟开始,默认从第1分钟开始 + /// + public static string Week(DayOfWeek dayOfWeek = DayOfWeek.Monday, int hour = 1, int minute = 1) + { + return Cron.Weekly(dayOfWeek, hour, minute); + } + + /// + /// 周期性为月的任务 + /// + /// 几号开始,默认从一号开始 + /// 第几小时开始,默认从1点开始 + /// 第几分钟开始,默认从第1分钟开始 + /// + public static string Month(int day = 1, int hour = 1, int minute = 1) + { + return Cron.Monthly(day, hour, minute); + } + + /// + /// 周期性为年的任务 + /// + /// 几月开始,默认从一月开始 + /// 几号开始,默认从一号开始 + /// 第几小时开始,默认从1点开始 + /// 第几分钟开始,默认从第1分钟开始 + /// + public static string Year(int month = 1, int day = 1, int hour = 1, int minute = 1) + { + return Cron.Yearly(month, day, hour, minute); + } +} \ No newline at end of file diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/CustomHangfireAuthorizeFilter.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/CustomHangfireAuthorizeFilter.cs new file mode 100644 index 00000000..81d3abf3 --- /dev/null +++ b/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/CustomHangfireAuthorizeFilter.cs @@ -0,0 +1,10 @@ +namespace Lion.AbpPro.Hangfire; + +public class CustomHangfireAuthorizeFilter : IDashboardAuthorizationFilter +{ + public bool Authorize(DashboardContext context) + { + var currentUser = context.GetHttpContext().RequestServices.GetRequiredService(); + return currentUser.IsAuthenticated; + } +} \ No newline at end of file diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/IRecurringJob.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/IRecurringJob.cs new file mode 100644 index 00000000..afb4cd67 --- /dev/null +++ b/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/IRecurringJob.cs @@ -0,0 +1,9 @@ +namespace Lion.AbpPro.Hangfire; + +public interface IRecurringJob : ITransientDependency +{ + /// + /// 执行任务 + /// + Task ExecuteAsync(); +} \ No newline at end of file diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/JobRetryLastFilter.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/JobRetryLastFilter.cs similarity index 83% rename from aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/JobRetryLastFilter.cs rename to aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/JobRetryLastFilter.cs index 02b88042..b7547b0a 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/JobRetryLastFilter.cs +++ b/aspnet-core/frameworks/src/Lion.AbpPro.Hangfire/Lion/AbpPro/Hangfire/JobRetryLastFilter.cs @@ -1,4 +1,4 @@ -namespace Lion.AbpPro.Extensions.Hangfire; +namespace Lion.AbpPro.Hangfire; /// /// 重试最后一次 @@ -18,7 +18,7 @@ public class JobRetryLastFilter : JobFilterAttribute, IElectStateFilter var retryAttempt = context.GetJobParameter("RetryCount"); if (RetryCount == retryAttempt) { - Log.Error("最后一次重试"); + // 最后一次重试 } } } \ No newline at end of file diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostConst.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostConst.cs index a5580a56..74733ad2 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostConst.cs +++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostConst.cs @@ -1,40 +1,39 @@ -namespace Lion.AbpPro +namespace Lion.AbpPro; + +public static class AbpProHttpApiHostConst { - public static class AbpProHttpApiHostConst - { - /// - /// 跨域策略名 - /// - public const string DefaultCorsPolicyName = "Default"; + /// + /// 跨域策略名 + /// + public const string DefaultCorsPolicyName = "Default"; - /// - /// Cookies名称 - /// - public const string DefaultCookieName = "Lion.AbpPro.Http.Api"; + /// + /// Cookies名称 + /// + public const string DefaultCookieName = "Lion.AbpPro.Http.Api"; - /// - /// SwaggerUi 端点 - /// - public const string SwaggerUiEndPoint = "/swagger"; + /// + /// SwaggerUi 端点 + /// + public const string SwaggerUiEndPoint = "/swagger"; - /// - /// Hangfire 端点 - /// - public const string HangfireDashboardEndPoint = "/hangfire"; + /// + /// Hangfire 端点 + /// + public const string HangfireDashboardEndPoint = "/hangfire"; - /// - /// CAP 端点 - /// - public const string CapDashboardEndPoint = "/cap"; + /// + /// CAP 端点 + /// + public const string CapDashboardEndPoint = "/cap"; - public const string MoreEndPoint = "https://doc.cncore.club/"; + public const string MoreEndPoint = "https://doc.cncore.club/"; - /// - /// HMiniprofiler端点 - /// - public const string MiniprofilerEndPoint = "/profiler/results-index"; + /// + /// HMiniprofiler端点 + /// + public const string MiniprofilerEndPoint = "/profiler/results-index"; - } } \ No newline at end of file diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs index c21925b3..e58e406d 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs +++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs @@ -1,143 +1,75 @@ -namespace Lion.AbpPro +namespace Lion.AbpPro; + +[DependsOn( + typeof(AbpProHttpApiModule), + typeof(AbpProAspNetCoreModule), + typeof(AbpAspNetCoreMvcUiMultiTenancyModule), + typeof(AbpProEntityFrameworkCoreModule), + typeof(AbpAspNetCoreAuthenticationJwtBearerModule), + typeof(AbpAspNetCoreSerilogModule), + typeof(AbpAccountWebModule), + typeof(AbpProApplicationModule), + // typeof(AbpProCapModule), + // typeof(AbpProCapEntityFrameworkCoreModule), + typeof(AbpAspNetCoreMvcUiBasicThemeModule), + typeof(AbpCachingStackExchangeRedisModule), + typeof(AbpDistributedLockingModule), + typeof(AbpBlobStoringFileSystemModule), + typeof(AbpProStarterModule), + typeof(AbpSwashbuckleModule) + //typeof(AbpBackgroundJobsHangfireModule) +)] +public partial class AbpProHttpApiHostModule : AbpModule { - [DependsOn( - typeof(AbpProHttpApiModule), - typeof(AbpProAspNetCoreModule), - typeof(AbpAspNetCoreMvcUiMultiTenancyModule), - typeof(AbpProEntityFrameworkCoreModule), - typeof(AbpAspNetCoreAuthenticationJwtBearerModule), - typeof(AbpAspNetCoreSerilogModule), - typeof(AbpAccountWebModule), - typeof(AbpProApplicationModule), - // typeof(AbpProCapModule), - // typeof(AbpProCapEntityFrameworkCoreModule), - typeof(AbpAspNetCoreMvcUiBasicThemeModule), - typeof(AbpCachingStackExchangeRedisModule), - typeof(AbpDistributedLockingModule), - typeof(AbpBlobStoringFileSystemModule), - typeof(AbpProStarterModule) - //typeof(AbpBackgroundJobsHangfireModule) - )] - public partial class AbpProHttpApiHostModule : AbpModule + public override void ConfigureServices(ServiceConfigurationContext context) { - public override void OnPostApplicationInitialization(ApplicationInitializationContext context) - { - // 应用程序初始化的时候注册hangfire - //context.CreateRecurringJob(); - base.OnPostApplicationInitialization(context); - } - - public override void ConfigureServices(ServiceConfigurationContext context) - { - context.Services + context.Services - .AddAbpProAuditLog() - .AddAbpProAuthentication() - .AddAbpProMultiTenancy() - .AddAbpProRedis() - .AddAbpProRedisDistributedLocking() - .AddAbpProMiniProfiler() - .AddAbpProCors() - .AddAbpProAntiForgery() - .AddAbpProIdentity() - .AddAbpProBlobStorage() - .AddAbpProSignalR() - .AddAbpProHealthChecks() - .AddAbpProTenantResolvers() - .AddAbpProLocalization() - .AddAbpProExceptions() - .AddAbpProSwagger("AbpPro"); - - - // //ConfigureCache(context); - // context.Services.AddAbpProRedis(); - // - // //ConfigurationDistributedLocking(context); - // context.Services.AddAbpProRedisDistributedLocking(); - // - // - // //ConfigureSwaggerServices(context); - // context.Services.AddAbpProSwagger("AbpPro"); - // - // //ConfigureJwtAuthentication(context, configuration); - // context.Services.AddAbpProAuthentication(); - // - // //ConfigureHangfire(context); - // - // //ConfigureMiniProfiler(context); - // context.Services.AddAbpProMiniProfiler(); - // - // //ConfigureIdentity(context); - // context.Services.AddAbpProIdentity(); - // - // //ConfigureCap(context); - // - // //ConfigureAuditLog(context); - // context.Services.AddAbpProAuditLog(); - // - // //ConfigurationSignalR(context); - // context.Services.AddAbpProSignalR(); - // - // //ConfigurationMultiTenancy(); - // context.Services.AddAbpProMultiTenancy(); - // - // //ConfigureBlobStorage(); - // context.Services.AddAbpProBlobStorage(); - } + .AddAbpProAuditLog() + .AddAbpProAuthentication() + .AddAbpProMultiTenancy() + .AddAbpProRedis() + .AddAbpProRedisDistributedLocking() + .AddAbpProMiniProfiler() + .AddAbpProCors() + .AddAbpProAntiForgery() + .AddAbpProIdentity() + .AddAbpProBlobStorage() + .AddAbpProSignalR() + .AddAbpProHealthChecks() + .AddAbpProTenantResolvers() + .AddAbpProLocalization() + .AddAbpProExceptions() + .AddAbpProSwagger("AbpPro"); + } - public override void OnApplicationInitialization(ApplicationInitializationContext context) + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + var app = context.GetApplicationBuilder(); + app.UseAbpProRequestLocalization(); + app.UseCorrelationId(); + app.MapAbpStaticAssets(); + app.UseAbpProMiniProfiler(); + app.UseRouting(); + app.UseAbpProCors(); + app.UseAuthentication(); + app.UseAbpProMultiTenancy(); + app.UseAuthorization(); + app.UseAbpProSwaggerUI("/swagger/AbpPro/swagger.json","AbpPro"); + app.UseAbpProAuditing(); + app.UseAbpSerilogEnrichers(); + app.UseUnitOfWork(); + app.UseConfiguredEndpoints(endpoints => { - var app = context.GetApplicationBuilder(); - //var configuration = context.GetConfiguration(); - app.UseAbpProRequestLocalization(); - app.UseCorrelationId(); - app.MapAbpStaticAssets(); - // if (configuration.GetValue("MiniProfiler:Enabled", false)) - // { - // app.UseMiniProfiler(); - // } - - app.UseAbpProMiniProfiler(); - app.UseRouting(); - //app.UseCors(AbpProHttpApiHostConst.DefaultCorsPolicyName); - app.UseAbpProCors(); - app.UseAuthentication(); - - // if (MultiTenancyConsts.IsEnabled) - // { - // app.UseMultiTenancy(); - // } - - app.UseAbpProMultiTenancy(); - - app.UseAuthorization(); - // app.UseSwagger(); - // app.UseAbpSwaggerUI(options => + endpoints.MapHealthChecks("/health"); + + // endpoints.MapHangfireDashboard("/hangfire", new DashboardOptions() // { - // options.SwaggerEndpoint("/swagger/AbpPro/swagger.json", "AbpPro API"); - // options.DocExpansion(DocExpansion.None); - // options.DefaultModelsExpandDepth(-1); + // Authorization = new[] { new CustomHangfireAuthorizeFilter() }, + // IgnoreAntiforgeryToken = true // }); - app.UseAbpProSwaggerUI("/swagger/AbpPro/swagger.json","AbpPro"); - //app.UseAuditing(); - app.UseAbpProAuditing(); - - app.UseAbpSerilogEnrichers(); - app.UseUnitOfWork(); - app.UseConfiguredEndpoints(endpoints => - { - endpoints.MapHealthChecks("/health"); - - // endpoints.MapHangfireDashboard("/hangfire", new DashboardOptions() - // { - // Authorization = new[] { new CustomHangfireAuthorizeFilter() }, - // IgnoreAntiforgeryToken = true - // }); - - }); - - app.UseAbpProConsul(); - } + }); + app.UseAbpProConsul(); } } \ No newline at end of file diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CronType.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CronType.cs deleted file mode 100644 index cf38091e..00000000 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CronType.cs +++ /dev/null @@ -1,78 +0,0 @@ -namespace Lion.AbpPro.Extensions.Hangfire -{ - /// - /// Cron类型 - /// - public static class CronType - { - /// - /// 周期性为分钟的任务 - /// - /// 执行周期的间隔,默认为每分钟一次 - /// - public static string Minute(int interval = 1) - { - return "1 0/" + interval.ToString() + " * * * ? "; - } - - /// - /// 周期性为小时的任务 - /// - /// 第几分钟开始,默认为第一分钟 - /// 执行周期的间隔,默认为每小时一次 - /// - public static string Hour(int minute = 1, int interval = 1) - { - return "1 " + minute + " 0/" + interval.ToString() + " * * ? "; - } - - /// - /// 周期性为天的任务 - /// - /// 第几小时开始,默认从1点开始 - /// 第几分钟开始,默认从第1分钟开始 - /// 执行周期的间隔,默认为每天一次 - /// - public static string Day(int hour = 1, int minute = 1, int interval = 1) - { - return "1 " + minute.ToString() + " " + hour.ToString() + " 1/" + interval.ToString() + " * ? "; - } - - /// - /// 周期性为周的任务 - /// - /// 星期几开始,默认从星期一点开始 - /// 第几小时开始,默认从1点开始 - /// 第几分钟开始,默认从第1分钟开始 - /// - public static string Week(DayOfWeek dayOfWeek = DayOfWeek.Monday, int hour = 1, int minute = 1) - { - return Cron.Weekly(dayOfWeek, hour, minute); - } - - /// - /// 周期性为月的任务 - /// - /// 几号开始,默认从一号开始 - /// 第几小时开始,默认从1点开始 - /// 第几分钟开始,默认从第1分钟开始 - /// - public static string Month(int day = 1, int hour = 1, int minute = 1) - { - return Cron.Monthly(day, hour, minute); - } - - /// - /// 周期性为年的任务 - /// - /// 几月开始,默认从一月开始 - /// 几号开始,默认从一号开始 - /// 第几小时开始,默认从1点开始 - /// 第几分钟开始,默认从第1分钟开始 - /// - public static string Year(int month = 1, int day = 1, int hour = 1, int minute = 1) - { - return Cron.Yearly(month, day, hour, minute); - } - } -} \ No newline at end of file diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CustomHangfireAuthorizeFilter.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CustomHangfireAuthorizeFilter.cs deleted file mode 100644 index 08e95248..00000000 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/CustomHangfireAuthorizeFilter.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Lion.AbpPro.Extensions.Hangfire -{ - public class CustomHangfireAuthorizeFilter : IDashboardAuthorizationFilter - { - public bool Authorize(DashboardContext context) - { - var _currentUser = context.GetHttpContext().RequestServices.GetRequiredService(); - return _currentUser.IsAuthenticated; - } - } -} diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/RecurringJobsExtensions.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/RecurringJobsExtensions.cs deleted file mode 100644 index 93676afe..00000000 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/RecurringJobsExtensions.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Lion.AbpPro.Jobs; - -namespace Lion.AbpPro.Extensions.Hangfire -{ - public static class RecurringJobsExtensions - { - public static void CreateRecurringJob(this ApplicationInitializationContext context) - { - RecurringJob.AddOrUpdate("测试Job", e => e.ExecuteAsync(), CronType.Minute(1), new RecurringJobOptions() - { - TimeZone = TimeZoneInfo.Local - }); - } - } -} \ No newline at end of file diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs index d9c3fe10..d9bf9117 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs +++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs @@ -21,8 +21,6 @@ global using Lion.AbpPro.CAP; global using Lion.AbpPro.CAP.EntityFrameworkCore; global using Lion.AbpPro.EntityFrameworkCore; global using Lion.AbpPro.Core; -global using Lion.AbpPro.Extensions; -global using Lion.AbpPro.Extensions.Hangfire; global using Lion.AbpPro.MultiTenancy; global using Lion.AbpPro.Starter; global using Magicodes.ExporterAndImporter.Core; @@ -80,5 +78,6 @@ global using Volo.Abp.Json; global using Volo.Abp.Localization; global using Volo.Abp.Modularity; global using Volo.Abp.MultiTenancy; +global using Volo.Abp.Swashbuckle; global using Volo.Abp.Users; global using Volo.Abp.Validation; \ No newline at end of file diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj index 3d0c5e8a..598c755b 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj +++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj @@ -1,6 +1,4 @@ - - net9.0 Lion.AbpPro @@ -8,59 +6,47 @@ Lion.AbpPro-4681b4fd-151f-4221-84a4-929d86723e4c + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - - - - - - - + + + + + + + - - - - + + + + - + diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs index 81051bd8..1727b219 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs +++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs @@ -1,4 +1,6 @@ -#pragma warning disable CS0618 // Type or member is obsolete +using Lion.AbpPro.Hangfire; + +#pragma warning disable CS0618 // Type or member is obsolete namespace Microsoft.Extensions.DependencyInjection; @@ -99,14 +101,13 @@ public static class ServiceCollectionExtensions service.AddHangfire(config => { - config.UseRedisStorage( - service.GetConfiguration().GetValue("Hangfire:Redis:Host"), redisStorageOptions) + config.UseRedisStorage(service.GetConfiguration().GetValue("Hangfire:Redis:Host"), redisStorageOptions) .WithJobExpirationTimeout(TimeSpan.FromDays(7)); var delaysInSeconds = new[] { 10, 60, 60 * 3 }; // 重试时间间隔 const int attempts = 3; // 重试次数 config.UseFilter(new AutomaticRetryAttribute() { Attempts = 3, DelaysInSeconds = delaysInSeconds }); //config.UseFilter(new AutoDeleteAfterSuccessAttribute(TimeSpan.FromDays(7))); - config.UseFilter(new JobRetryLastFilter(attempts)); + //config.UseFilter(new JobRetryLastFilter(attempts)); }); return service; } diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Production.json b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Production.json index d3e28981..656874b1 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Production.json +++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Production.json @@ -5,7 +5,7 @@ "Serilog.Sinks.File" ], "MinimumLevel": { - "Default": "Information", + "Default": "Debug", "Override": { "Microsoft": "Information", "Volo.Abp": "Information", @@ -26,25 +26,35 @@ "path": "logs/logs-.txt", "rollingInterval": "Day" } + }, + { + "Name": "Elastic", + "Args": { + "Enabled": false, + "Url": "http://es.cn", + "IndexFormat": "Lion.AbpPro.development.{0:yyyy.MM.dd}", + "UserName": "elastic", + "Password": "aVVhjQ95RP7nbwNy", + "ApplicationName": "Lion.AbpPro.HttpApi.Host" + } } ] }, "App": { "SelfUrl": "http://localhost:44315", - "CorsOrigins": "http://localhost:80,http://43.139.143.143:80,http://43.139.143.143" }, "ConnectionStrings": { - "Default": "Data Source=mysql;Port=3306;Database=LionAbpProDB;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" - }, - "Redis": { - "Configuration": "redis:6379,password=1q2w3E*,defaultdatabase=3" + "Default": "Data Source=localhost;Port=3306;Database=LionAbpProDemo9;uid=root;pwd=f616b8803ac7a9a0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" }, "Hangfire": { "Redis": { - "Host": "redis:6379,password=1q2w3E*", + "Host": "localhost:6379,password=1q2w3E*", "DB": "2" } }, + "Redis": { + "Configuration": "localhost:6379,password=75He82bB5jFA84XZ1,defaultdatabase=2" + }, "Jwt": { "Audience": "Lion.AbpPro", "SecurityKey": "dzehzRz9a8asdfasfdadfasdfasdfafsdadfasbasdf=", @@ -53,23 +63,40 @@ }, "Cap": { "RabbitMq": { - "HostName": "rabbitmq", + "HostName": "localhost", "UserName": "admin", "Password": "1q2w3E*", "Port": 5672 } }, "ElasticSearch": { - "Enabled": false, - "Url": "http://es.cn", - "IndexFormat": "Lion.AbpPro.development.{0:yyyy.MM.dd}", + "Host": "http://es.cn", "UserName": "elastic", - "Password": "aVVhjQ95RP7nbwNy", - "SearchIndexFormat": "Lion.AbpPro.development*" + "Password": "aVVhjQ95RP7nbwNy" + }, + "MiniProfiler": { + "Enabled": true, + "RouteBasePath": "/profiler" + }, + "Swagger": { + "Enabled": true + }, + "Audit": { + "Enabled": true, + "ApplicationName": "Lion.AbpPro" + }, + "Cors": { + "Enabled": true, + "CorsOrigins": "http://localhost:4200,http://localhost:4201" + }, + "Gateway": { + "Enabled": false + }, + "MultiTenancy": { + "Enabled": true }, - "Consul": { - "Enabled": false, - "Host": "http://localhost:8500", - "Service": "Project-Service" + "Preheat": { + "Enabled": true, + "RequestUrl": "http://localhost:44315/api/abp/application-configuration?IncludeLocalizationResources=false" } } \ No newline at end of file diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json index 10bb14d3..656874b1 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json +++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json @@ -26,24 +26,34 @@ "path": "logs/logs-.txt", "rollingInterval": "Day" } + }, + { + "Name": "Elastic", + "Args": { + "Enabled": false, + "Url": "http://es.cn", + "IndexFormat": "Lion.AbpPro.development.{0:yyyy.MM.dd}", + "UserName": "elastic", + "Password": "aVVhjQ95RP7nbwNy", + "ApplicationName": "Lion.AbpPro.HttpApi.Host" + } } ] }, "App": { "SelfUrl": "http://localhost:44315", - "CorsOrigins": "https://*.AbpPro.com,http://localhost:4200,http://localhost:44320,http://localhost:44321,http://localhost:44322,http://localhost:44318" }, "ConnectionStrings": { - "Default": "Data Source=localhost;Port=3306;Database=LionAbpProDemo9;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" + "Default": "Data Source=localhost;Port=3306;Database=LionAbpProDemo9;uid=root;pwd=f616b8803ac7a9a0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" }, "Hangfire": { "Redis": { - "Host": "117.72.203.231:6379,password=1q2w3E*", + "Host": "localhost:6379,password=1q2w3E*", "DB": "2" } }, "Redis": { - "Configuration": "117.72.203.231:6379,password=75He82bB5jFA84XZ1,defaultdatabase=2" + "Configuration": "localhost:6379,password=75He82bB5jFA84XZ1,defaultdatabase=2" }, "Jwt": { "Audience": "Lion.AbpPro", @@ -60,16 +70,13 @@ } }, "ElasticSearch": { - "Enabled": false, - "Url": "http://es.cn", - "IndexFormat": "Lion.AbpPro.development.{0:yyyy.MM.dd}", + "Host": "http://es.cn", "UserName": "elastic", - "Password": "aVVhjQ95RP7nbwNy", - "SearchIndexFormat": "Lion.AbpPro.development*" + "Password": "aVVhjQ95RP7nbwNy" }, "MiniProfiler": { "Enabled": true, - "RouteBasePath": "profiler" + "RouteBasePath": "/profiler" }, "Swagger": { "Enabled": true diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Jobs/IRecurringJob.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Jobs/IRecurringJob.cs deleted file mode 100644 index 71f5ad39..00000000 --- a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Jobs/IRecurringJob.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Lion.AbpPro.Jobs -{ - public interface IRecurringJob : ITransientDependency - { - /// - /// 执行任务 - /// - /// - Task ExecuteAsync(); - } -} \ No newline at end of file diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Lion.AbpPro.Application.Contracts.csproj b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Lion.AbpPro.Application.Contracts.csproj index 6b3fc8ff..3cbbf77b 100644 --- a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Lion.AbpPro.Application.Contracts.csproj +++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Lion.AbpPro.Application.Contracts.csproj @@ -5,6 +5,7 @@ + diff --git a/aspnet-core/services/src/Lion.AbpPro.Application/Jobs/TestJob.cs b/aspnet-core/services/src/Lion.AbpPro.Application/Jobs/TestJob.cs deleted file mode 100644 index f4a2b438..00000000 --- a/aspnet-core/services/src/Lion.AbpPro.Application/Jobs/TestJob.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Lion.AbpPro.Jobs -{ - public class TestJob : IRecurringJob - { - public Task ExecuteAsync() - { - Console.WriteLine($"job 测试"); - return Task.CompletedTask; - } - } -} \ No newline at end of file diff --git a/aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json b/aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json index 226024d7..54ef0094 100644 --- a/aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json +++ b/aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json @@ -1,5 +1,5 @@ { "ConnectionStrings": { - "Default": "Data Source=localhost;Port=3306;Database=LionAbpProDemo9;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" + "Default": "Data Source=117.72.203.231;Port=3306;Database=LionAbpProDemo9;uid=root;pwd=f616b8803ac7a9a0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" } } \ No newline at end of file