From 3ae7cd530f9b35dd2dcd729b2a633bdebac32754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BC=9F?= <421281095@qq.com> Date: Thu, 28 Nov 2024 16:44:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=A4=A9=E7=BD=91=E6=85=A7?= =?UTF-8?q?=E7=9C=BC=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenAuth.App/ServiceApp/Job/FileMonitor.cs | 15 ++++++++------- OpenAuth.WebApi/appsettings.json | 3 ++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/OpenAuth.App/ServiceApp/Job/FileMonitor.cs b/OpenAuth.App/ServiceApp/Job/FileMonitor.cs index 9259a16..6c2c222 100644 --- a/OpenAuth.App/ServiceApp/Job/FileMonitor.cs +++ b/OpenAuth.App/ServiceApp/Job/FileMonitor.cs @@ -6,14 +6,12 @@ using Quartz; namespace OpenAuth.App.ServiceApp.Job; -class FileMonitor: IJob +class FileMonitor : IJob { public async System.Threading.Tasks.Task Execute(IJobExecutionContext context) { - - var targetDirectory = ConfigHelper.GetConfigRoot().GetSection("Insight:Dir").Value; - var tifExtensions = new[] { ".tif", ".tfw", ".ovr", ".aux"}; + var tifExtensions = new[] { ".tif", ".tfw", ".ovr", ".aux" }; // 相关文件扩展名 var shpExtensions = new[] { ".shp", ".shx", ".dbf", ".prj", ".cpg" }; var targetExtensions = new[] { ".tif", ".shp" }; @@ -123,7 +121,9 @@ class FileMonitor: IJob private static async Task AddInsTif(string tifPath) { using var client = new HttpClient(); - var url = "http://localhost:5007/api/InsTif/Insert"; + var config = ConfigHelper.GetConfigRoot(); + var serverUrl = config.GetSection("Insight:ServerUrl").Value; + var url = serverUrl + "/api/InsTif/Insert"; var tifName = Path.GetFileName(tifPath); var tifDate = new DirectoryInfo(tifPath).Parent?.Name; @@ -165,7 +165,9 @@ class FileMonitor: IJob private static async Task AddInsAiShp(String shpPath) { using var client = new HttpClient(); - var url = "http://localhost:5007/api/InAiShp/Insert"; + var config = ConfigHelper.GetConfigRoot(); + var serverUrl = config.GetSection("Insight:ServerUrl").Value; + var url = serverUrl + "/api/InAiShp/Insert"; // 县区/shp名称 var fileName = Path.GetFileName(shpPath); @@ -207,5 +209,4 @@ class FileMonitor: IJob return false; } - } \ No newline at end of file diff --git a/OpenAuth.WebApi/appsettings.json b/OpenAuth.WebApi/appsettings.json index e1346ba..064f28b 100644 --- a/OpenAuth.WebApi/appsettings.json +++ b/OpenAuth.WebApi/appsettings.json @@ -70,6 +70,7 @@ "Insight": { "Dir": "e:/insight", "TifDir" : "e:/insight/tif", - "AiShpDir": "E:/insight/ai解析成果" + "AiShpDir": "E:/insight/ai解析成果", + "ServerUrl": "http://localhost:5007" } }