From 6c0058d15ab61956b806f62a2b576ffd5d723ed9 Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期五, 08 八月 2025 11:16:21 +0800
Subject: [PATCH] fix:bug

---
 FlexJobApi.Core/FlexJobApiCoreStartup.cs |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/FlexJobApi.Core/FlexJobApiCoreStartup.cs b/FlexJobApi.Core/FlexJobApiCoreStartup.cs
index f52f125..1ffa807 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,33 +20,37 @@
     {
         public void ConfigureServices(IServiceCollection services)
         {
+            services.AddHealthChecks();
+
             services.AddConsoleFormatter(options =>
             {
                 options.WithTraceId = true;
-                options.WithStackFrame = true;
             });
 
             services.AddFileLogging(options =>
             {
                 options.WithTraceId = true;
-                options.WithStackFrame = true;
                 options.FileNameRule = fileName =>
                 {
-                    return string.Format(fileName, DateTime.UtcNow);    // 濡傛灉鏄湰鍦版椂闂翠娇鐢� DateTime.Now
+                    return string.Format(fileName, DateTime.Now);
                 };
             });
 
-            services.AddDatabaseLogging<DatabaseLoggingWriter>(options =>
-            {
-                options.WithTraceId = true;
-                options.WithStackFrame = true;
-            });
+            //services.AddDatabaseLogging<DatabaseLoggingWriter>(options =>
+            //{
+            //    options.WithTraceId = true;
+            //});
 
             services.AddConfigurableOptions<AliyunOptions>();
+
+            services.AddComponent<ConsulServiceComponent>();
 
             services.AddComponent<EventBusServiceComponent>();
 
             services.AddComponent<DistributedCacheServiceComponent>();
+
+            services.AddHttpRemote();
+            services.AddSingleton<ResourceHttpUtils>();
 
             services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblies(App.Assemblies.ToArray()));
 
@@ -54,6 +59,8 @@
             services.AddJwt<JwtHandler>(enableGlobalAuthorize: true);
 
             services.AddCorsAccessor();
+
+            services.AddHostedService<BuildDynamicControllersHostedService>();
 
             services.AddSpecificationDocuments(options =>
             {
@@ -69,6 +76,8 @@
                     .AddFriendlyException()
                     .AddDataValidation()
                     .AddInjectWithUnifyResult<FriendlyResultProvider>();
+
+            services.AddMvcFilter<ResourceActionFilter>();
         }
 
         public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime)
@@ -105,12 +114,15 @@
             app.UseEndpoints(endpoints =>
             {
                 endpoints.MapControllers();
+                endpoints.MapHealthChecks("/healthz");
             });
 
-            lifetime.ApplicationStarted.Register(async () =>
-            {
-                await ResourceUtils.BuildWebApis();
-            });
+            app.UseComponent<ConsulApplicationComponent>(env);
+
+            //lifetime.ApplicationStarted.Register(async () =>
+            //{
+            //    await ResourceUtils.BuildDynamicControllersAsync();
+            //});
         }
     }
 }

--
Gitblit v1.9.1