From b9da5837aa515adfa4f0452a7566df89b9e81ed4 Mon Sep 17 00:00:00 2001
From: lg <999544862qq.com>
Date: 星期四, 15 八月 2024 15:10:52 +0800
Subject: [PATCH] Merge branch 'master' of http://43.142.96.171:8080/r/~tjx/StandardPda

---
 MESApplication/Startup.cs |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/MESApplication/Startup.cs b/MESApplication/Startup.cs
index fb5ae6c..17e9bf6 100644
--- a/MESApplication/Startup.cs
+++ b/MESApplication/Startup.cs
@@ -1,4 +1,6 @@
-锘縰sing Microsoft.OpenApi.Models;
+锘縰sing MES.Service.Dto.@base;
+using MES.Service.util;
+using Microsoft.OpenApi.Models;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Serialization;
 using Swashbuckle.AspNetCore.SwaggerUI;
@@ -13,6 +15,8 @@
     public Startup(IConfiguration configuration)
     {
         Configuration = configuration;
+
+        new AppsettingsUtility().Initial(configuration);
     }
 
     public IConfiguration Configuration { get; }
@@ -21,11 +25,16 @@
     public void ConfigureServices(IServiceCollection services)
     {
         services.AddControllers();
+
+        // 璇诲彇 绯荤粺 璁剧疆骞舵敞鍏ュ埌鏈嶅姟涓�
+        services.Configure<AppSettings>(
+            Configuration.GetSection("AppSettings"));
+
         services.AddSwaggerGen(c =>
         {
             c.SwaggerDoc("v1",
                 new OpenApiInfo
-                    { Title = "WebFirst.Api", Version = "v1" });
+                    { Title = "MESApplication.Api", Version = "v1" });
         });
 
         //閰嶇疆JSON.NET
@@ -42,6 +51,9 @@
             // 璁剧疆鍛藉悕绛栫暐涓洪┘宄板懡鍚�
             opt.SerializerSettings.ContractResolver =
                 new CamelCasePropertyNamesContractResolver();
+
+            //杩斿洖缁欏墠绔殑鏃堕棿鏍煎紡鍖�
+            opt.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
         });
 
         //閰嶇疆鍙互璺ㄥ煙
@@ -54,6 +66,14 @@
                         "OPTIONS")
             );
         });
+
+        #region 鎺ュ彛琛屽姩杩囨护鍣�
+        services.AddControllers(options => {
+            options.Filters.Add(new ActionFilter());
+        });
+        var serviceProvider = services.BuildServiceProvider();
+        ActionFilter.LoggerError = serviceProvider.GetRequiredService<ILogger<ActionFilter>>();
+        #endregion
     }
 
     // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -80,5 +100,10 @@
         app.UseAuthorization();
 
         app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
+
+        //////////////////////////
+        
+        ///////////////////////////
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3