|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
using Infrastructure;
|
|
|
|
|
using Infrastructure.Extensions;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using OpenAuth.App.ServiceApp;
|
|
|
|
|
using OpenAuth.Repository.Domain;
|
|
|
|
@ -159,7 +160,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<Response<bool>> EdiAirLine(LasaAirLine info)
|
|
|
|
|
public async Task<Response<bool>> EditAirLine(LasaAirLine info)
|
|
|
|
|
{
|
|
|
|
|
return await _app.EditAirLine(info);
|
|
|
|
|
}
|
|
|
|
@ -172,6 +173,101 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
|
|
|
|
{
|
|
|
|
|
return await _app.DeleteAirLine(id);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 上传航线文件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="xmlFile"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("upload")]
|
|
|
|
|
public async Task<IActionResult> UploadXmlFile(IFormFile xmlFile)
|
|
|
|
|
{
|
|
|
|
|
if (xmlFile == null || xmlFile.Length == 0)
|
|
|
|
|
return BadRequest("文件为空");
|
|
|
|
|
|
|
|
|
|
var uploadsFolder = Path.Combine(Directory.GetCurrentDirectory(), "Waylines");
|
|
|
|
|
if (!Directory.Exists(uploadsFolder))
|
|
|
|
|
Directory.CreateDirectory(uploadsFolder);
|
|
|
|
|
|
|
|
|
|
var filePath = Path.Combine(uploadsFolder, "waylines.wpml");
|
|
|
|
|
|
|
|
|
|
using (var stream = new FileStream(filePath, FileMode.Create))
|
|
|
|
|
{
|
|
|
|
|
await xmlFile.CopyToAsync(stream);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Ok(new { message = "上传成功", path = filePath });
|
|
|
|
|
}
|
|
|
|
|
[HttpPost("uploadwpmlfile")]
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
public async Task<IActionResult> UploadWpmlFile(IFormFile xmlFile, string id)
|
|
|
|
|
{
|
|
|
|
|
if (xmlFile == null || xmlFile.Length == 0)
|
|
|
|
|
return BadRequest("文件为空");
|
|
|
|
|
string baseFolder = "Waylines/" + (string.IsNullOrEmpty(id) ? Guid.NewGuid().ToString() : id);
|
|
|
|
|
var uploadsFolder = Path.Combine(Directory.GetCurrentDirectory(), baseFolder);
|
|
|
|
|
if (!Directory.Exists(uploadsFolder))
|
|
|
|
|
Directory.CreateDirectory(uploadsFolder);
|
|
|
|
|
|
|
|
|
|
var filePath = Path.Combine(uploadsFolder, "waylines.wpml");
|
|
|
|
|
|
|
|
|
|
using (var stream = new FileStream(filePath, FileMode.Create))
|
|
|
|
|
{
|
|
|
|
|
await xmlFile.CopyToAsync(stream);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Ok(new { message = "上传成功", path = filePath });
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 项目管理
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取项目列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="key"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public async Task<Response<List<LasaWorkspace>>> GetWorkspaceList(string key)
|
|
|
|
|
{
|
|
|
|
|
var result = new Response<List<LasaWorkspace>>();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
result = await _app.GetWorkspaceList(key);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
result.Code = 500;
|
|
|
|
|
result.Message = ex.Message;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 添加项目
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<Response<bool>> AddWorkspace(LasaWorkspace info)
|
|
|
|
|
{
|
|
|
|
|
return await _app.AddWorkspace(info);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 编辑项目
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<Response<bool>> EditWorkspace(LasaWorkspace info)
|
|
|
|
|
{
|
|
|
|
|
return await _app.EditWorkspace(info);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除项目
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<Response<bool>> DeleteWorkspace(string id)
|
|
|
|
|
{
|
|
|
|
|
return await _app.DeleteWorkspace(id);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|