From c257c3a8b77b0a4057cd80ffca6512a42efb3500 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期一, 05 八月 2024 15:53:34 +0800 Subject: [PATCH] 1 --- Turf/Web.config | 2 ++ Turf/Controllers/AiController.cs | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletions(-) diff --git a/Turf/Controllers/AiController.cs b/Turf/Controllers/AiController.cs index c852293..242f4b7 100644 --- a/Turf/Controllers/AiController.cs +++ b/Turf/Controllers/AiController.cs @@ -1,5 +1,7 @@ 锘縰sing System; using System.Collections.Generic; +using System.Configuration; +using System.IO; using System.Linq; using System.Net; using System.Net.Http; @@ -11,6 +13,11 @@ { public class AiController : ApiController { + private string getSourcePath() + { + return ConfigurationManager.AppSettings["geoJsonPath"]; + } + [HttpPost] [Route("footprint/predict/2")] [Route("riverface/predict/2")] @@ -25,7 +32,18 @@ return new R<Result>(2, "Sorry, the parameter is wrong"); } - Thread.Sleep(7000); + //Thread.Sleep(10000); + String target = Path.Combine(args.data_dir, "results"); + if (!Directory.Exists(target)) Directory.CreateDirectory(target); + + String source = getSourcePath(); + string[] files = Directory.GetFiles(source, "*.geojson"); + foreach (string file in files) + { + string newFile = Path.Combine(target, Path.GetFileName(file)); + File.Copy(file, newFile, true); + } + Result rs = new Result(); return new R<Result>(0, "ok", rs); diff --git a/Turf/Web.config b/Turf/Web.config index 4de8560..39c9a99 100644 --- a/Turf/Web.config +++ b/Turf/Web.config @@ -9,6 +9,8 @@ <add key="webpages:Enabled" value="false" /> <add key="ClientValidationEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" /> + <!-- geojson鐩綍 --> + <add key="geoJsonPath" value="D:\AI\datacache\1722828277901\results"/> </appSettings> <system.web> <compilation debug="true" targetFramework="4.5.2" /> -- Gitblit v1.9.3