From 275e2b9dec977546dd1a3f75eac29c22e6bb4ed2 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期五, 11 十一月 2022 09:10:52 +0800 Subject: [PATCH] 1 --- ExportMap/Controllers/ExportController.cs | 33 ++++++++++++++++++++++++++------- 1 files changed, 26 insertions(+), 7 deletions(-) diff --git a/ExportMap/Controllers/ExportController.cs b/ExportMap/Controllers/ExportController.cs index b7c6cc6..beeaf36 100644 --- a/ExportMap/Controllers/ExportController.cs +++ b/ExportMap/Controllers/ExportController.cs @@ -12,16 +12,35 @@ public class ExportController : ApiController { [HttpPost] - public string Start([FromBody]ExportArgs args) + public ResponseMsg<string> Start([FromBody]ExportArgs args) { - if (args == null || - string.IsNullOrWhiteSpace(args.layers)|| - (args.xmin == 0 && args.ymin == 0 && args.xmax == 0 && args.ymax == 0)) + try { - return null; - } + if (args == null || + string.IsNullOrWhiteSpace(args.layers) || + string.IsNullOrWhiteSpace(args.token) || + (args.xmin == 0 && args.ymin == 0 && args.xmax == 0 && args.ymax == 0)) + { + return ResponseMsg<string>.fail("鍙傛暟涓嶅畬鏁�"); + } - return ExportUtil.Generate(args); + if (!ExportUtil.VerifyToken(args.token)) + { + return ResponseMsg<string>.fail("浠ょ墝鏃犳晥"); + } + + string imgPath = ExportUtil.Generate(args); + if (string.IsNullOrEmpty(imgPath)) + { + return ResponseMsg<string>.fail("澶辫触"); + } + + return ResponseMsg<string>.success("鎴愬姛", imgPath); + } + catch (Exception ex) + { + return ResponseMsg<string>.fail(ex.Message); + } } } } -- Gitblit v1.9.3