From 744ce126fd5dc3a0448719832d1e9667e44d30b5 Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期三, 06 八月 2025 18:39:52 +0800
Subject: [PATCH] fix:bug

---
 FlexJobApi.Core/FlexJobApiCoreStartup.cs |   29 ++++++++++++++++++++++++-----
 1 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/FlexJobApi.Core/FlexJobApiCoreStartup.cs b/FlexJobApi.Core/FlexJobApiCoreStartup.cs
index 2c53b2d..cc2c31d 100644
--- a/FlexJobApi.Core/FlexJobApiCoreStartup.cs
+++ b/FlexJobApi.Core/FlexJobApiCoreStartup.cs
@@ -1,4 +1,5 @@
-锘縰sing Furion;
+锘縰sing Consul;
+using Furion;
 using Furion.EventBus;
 using MediatR;
 using Microsoft.AspNetCore.Builder;
@@ -19,6 +20,8 @@
     {
         public void ConfigureServices(IServiceCollection services)
         {
+            services.AddHealthChecks();
+
             services.AddConsoleFormatter(options =>
             {
                 options.WithTraceId = true;
@@ -41,6 +44,12 @@
                 options.WithStackFrame = true;
             });
 
+            services.AddConfigurableOptions<AliyunOptions>();
+
+            services.AddHttpRemote();
+
+            services.AddComponent<ConsulServiceComponent>();
+
             services.AddComponent<EventBusServiceComponent>();
 
             services.AddComponent<DistributedCacheServiceComponent>();
@@ -48,6 +57,7 @@
             services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblies(App.Assemblies.ToArray()));
 
             services.AddHostedService<XmlDocBuildHostedService>();
+            services.AddHostedService<BuildDynamicControllersHostedService>();
 
             services.AddJwt<JwtHandler>(enableGlobalAuthorize: true);
 
@@ -55,20 +65,21 @@
 
             services.AddSpecificationDocuments(options =>
             {
-                options.OperationFilter<FurionCustomOperationIdFilter>();
+                options.OperationFilter<CustomOperationIdFilter>();
+                options.SchemaFilter<EnumSchemaFilter>();
             });
 
             services.AddControllers()
                     .AddNewtonsoftJson(options =>
                     {
-                        options.SerializerSettings.Converters.Add(new StringEnumConverter());
+                        //options.SerializerSettings.Converters.Add(new StringEnumConverter());
                     })
                     .AddFriendlyException()
                     .AddDataValidation()
                     .AddInjectWithUnifyResult<FriendlyResultProvider>();
         }
 
-        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
+        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime)
         {
             // 瑙f瀽浜嬩欢鎬荤嚎鍙戝竷鏈嶅姟
             var eventPublisher = app.ApplicationServices.GetRequiredService<IEventPublisher>();
@@ -86,7 +97,7 @@
 
             app.UseUnifyResultStatusCodes();
 
-            app.UseHttpsRedirection();
+            //app.UseHttpsRedirection();
 
             app.UseRouting();
 
@@ -102,7 +113,15 @@
             app.UseEndpoints(endpoints =>
             {
                 endpoints.MapControllers();
+                endpoints.MapHealthChecks("/healthz");
             });
+
+            app.UseComponent<ConsulApplicationComponent>(env);
+
+            //lifetime.ApplicationStarted.Register(async () =>
+            //{
+            //    await ResourceUtils.BuildDynamicControllersAsync();
+            //});
         }
     }
 }

--
Gitblit v1.9.1