From f048afe6e62af3c30ebdceea663c72b78c7e3ccc Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期二, 01 八月 2023 13:55:40 +0800 Subject: [PATCH] 1 --- ExportMap/cs/TerraUtils.cs | 10 +++++++++- ExportMap/Controllers/UploadController.cs | 7 ++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ExportMap/Controllers/UploadController.cs b/ExportMap/Controllers/UploadController.cs index bc3e567..56a4741 100644 --- a/ExportMap/Controllers/UploadController.cs +++ b/ExportMap/Controllers/UploadController.cs @@ -14,8 +14,13 @@ public class UploadController : ApiController { [HttpPost] - public Task<IEnumerable<FileDesc>> Post([FromUri]string path) + public Task<IEnumerable<FileDesc>> Post([FromUri] string path, [FromUri] string token) { + if (string.IsNullOrEmpty(token) || !ExportUtil.VerifyToken(token)) + { + throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.Unauthorized, "浠ょ墝涓虹┖鎴栨棤鏁堬紒")); + } + //string root = HttpContext.Current.Server.MapPath("~/uploads"); if (string.IsNullOrEmpty(path)) return null; string root = Path.Combine(Tools.GetSetting("tempFolder"), path); diff --git a/ExportMap/cs/TerraUtils.cs b/ExportMap/cs/TerraUtils.cs index 72d4a56..da87efa 100644 --- a/ExportMap/cs/TerraUtils.cs +++ b/ExportMap/cs/TerraUtils.cs @@ -242,7 +242,15 @@ string layerJson = Path.Combine(dirPath, "layer.json"); string[] lines = File.ReadAllLines(layerJson, Encoding.UTF8); - lines[12] = " [ {\"endX\":1,\"endY\":0,\"startX\":0,\"startY\":0} ]"; + //lines[12] = " [ { \"startX\": 0, \"startY\": 0, \"endX\": 1, \"endY\": 0 } ]"; + for (int i = 0, c = lines.Length; i < c; i++) + { + if (lines[i].IndexOf("startX") > -1) + { + lines[i] = " [ { \"startX\": 0, \"startY\": 0, \"endX\": 1, \"endY\": 0 } ]"; + break; + } + } File.WriteAllLines(layerJson, lines, Encoding.UTF8); } -- Gitblit v1.9.3