using ExportMap.cs;
|
using ExportMap.Models;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Net;
|
using System.Net.Http;
|
using System.Web.Http;
|
using System.IO;
|
|
namespace ExportMap.Controllers
|
{
|
public class TBController : ApiController
|
{
|
[HttpGet]
|
public ResponseMsg<string> CreateMpt(string path, string token)
|
{
|
try
|
{
|
if (string.IsNullOrEmpty(path) || string.IsNullOrEmpty(token))
|
return ResponseMsg<string>.fail("path和token参数不能为空");
|
if (!ExportUtil.VerifyToken(token))
|
return ResponseMsg<string>.fail("令牌无效");
|
if (!Directory.Exists(path))
|
return ResponseMsg<string>.fail("文件路径不存在");
|
|
string err = null;
|
string rs = TBUtils.CreateMpt(path, ref err);
|
|
if (string.IsNullOrEmpty(rs))
|
return ResponseMsg<string>.fail(null == err ? "失败" : err);
|
|
return ResponseMsg<string>.success("成功", rs, 1);
|
}
|
catch (Exception ex)
|
{
|
LogOut.Error(ex.Message + "\r\n" + ex.StackTrace);
|
return ResponseMsg<string>.fail(ex.Message);
|
}
|
}
|
}
|
}
|