using MoonExp.cs;
|
using MoonExp.Models;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Net;
|
using System.Net.Http;
|
using System.Security;
|
using System.Web.Http;
|
|
namespace MoonExp.Controllers
|
{
|
public class ExportController : ApiController
|
{
|
[HttpGet]
|
public string Test()
|
{
|
string str = "http://219.153.49.10:7511/sj_raster/v6/wmts/service/system/10000201/1?ak=mf72ff9295c740ec0f37e61433e8a3ad8d&a=1";
|
string escapeStr = SecurityElement.Escape(str);
|
|
Tools.ExecCmd("dir", true, true);
|
|
return DateTime.Now.ToString("yyyyy-MM-dd HH:mm:ss");
|
}
|
|
[HttpPost]
|
public ResponseMsg<string> Start([FromBody]ExportArgs args)
|
{
|
try
|
{
|
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("参数不完整");
|
}
|
|
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);
|
}
|
}
|
}
|
}
|