| | |
| | | using LFServer.Models; |
| | | using ExportMap.cs; |
| | | using LFServer.cs; |
| | | using LFServer.Models; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | 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(err); |
| | | } |
| | | |
| | | return ResponseMsg<string>.success("成功", imgPath); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogOut.Error(ex.StackTrace); |
| | | return ResponseMsg<string>.fail(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |