配置天网慧眼服务器地址

FileMonitor
陈伟 2024-11-28 16:44:12 +08:00
parent ab1ba82721
commit 3ae7cd530f
2 changed files with 10 additions and 8 deletions

View File

@ -10,8 +10,6 @@ class FileMonitor: IJob
{ {
public async System.Threading.Tasks.Task Execute(IJobExecutionContext context) public async System.Threading.Tasks.Task Execute(IJobExecutionContext context)
{ {
var targetDirectory = ConfigHelper.GetConfigRoot().GetSection("Insight:Dir").Value; var targetDirectory = ConfigHelper.GetConfigRoot().GetSection("Insight:Dir").Value;
var tifExtensions = new[] { ".tif", ".tfw", ".ovr", ".aux" }; var tifExtensions = new[] { ".tif", ".tfw", ".ovr", ".aux" };
// 相关文件扩展名 // 相关文件扩展名
@ -123,7 +121,9 @@ class FileMonitor: IJob
private static async Task<bool> AddInsTif(string tifPath) private static async Task<bool> AddInsTif(string tifPath)
{ {
using var client = new HttpClient(); 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 tifName = Path.GetFileName(tifPath);
var tifDate = new DirectoryInfo(tifPath).Parent?.Name; var tifDate = new DirectoryInfo(tifPath).Parent?.Name;
@ -165,7 +165,9 @@ class FileMonitor: IJob
private static async Task<bool> AddInsAiShp(String shpPath) private static async Task<bool> AddInsAiShp(String shpPath)
{ {
using var client = new HttpClient(); 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名称 // 县区/shp名称
var fileName = Path.GetFileName(shpPath); var fileName = Path.GetFileName(shpPath);
@ -207,5 +209,4 @@ class FileMonitor: IJob
return false; return false;
} }
} }

View File

@ -70,6 +70,7 @@
"Insight": { "Insight": {
"Dir": "e:/insight", "Dir": "e:/insight",
"TifDir" : "e:/insight/tif", "TifDir" : "e:/insight/tif",
"AiShpDir": "E:/insight/ai解析成果" "AiShpDir": "E:/insight/ai解析成果",
"ServerUrl": "http://localhost:5007"
} }
} }