From 5f80de49c4a00416591054180bf809a12a76d686 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期四, 07 十一月 2024 16:40:53 +0800 Subject: [PATCH] 1 --- ExportMap/Controllers/ExportController.cs | 40 +++++++++++++++++++++++++++++++--------- 1 files changed, 31 insertions(+), 9 deletions(-) diff --git a/ExportMap/Controllers/ExportController.cs b/ExportMap/Controllers/ExportController.cs index bd0ca0c..fef2316 100644 --- a/ExportMap/Controllers/ExportController.cs +++ b/ExportMap/Controllers/ExportController.cs @@ -1,4 +1,5 @@ -锘縰sing LFServer.Models; +锘縰sing ExportMap.cs; +using ExportMap.Models; using System; using System.Collections.Generic; using System.Linq; @@ -6,21 +7,42 @@ using System.Net.Http; using System.Web.Http; -namespace LFServer.Controllers +namespace ExportMap.Controllers { public class ExportController : ApiController { [HttpPost] - public void 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; - } + 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("鍙傛暟涓嶅畬鏁�"); + } - args.SetDefault(); + if (!ExportUtil.VerifyToken(args.token)) + { + return ResponseMsg<string>.fail("浠ょ墝鏃犳晥"); + } + + string err = null; + string imgPath = ExportUtil.Generate(args, ref err); + if (string.IsNullOrEmpty(imgPath)) + { + return ResponseMsg<string>.fail(null == err ? "鐢熸垚澶辫触" : err); + } + + return ResponseMsg<string>.success("鎴愬姛", imgPath); + } + catch (Exception ex) + { + LogOut.Error(ex.Message + "\r\n" + ex.StackTrace); + return ResponseMsg<string>.fail(ex.Message); + } } } } -- Gitblit v1.9.3