using Infrastructure;
using Infrastructure.Extensions;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.App.ServiceApp;
using OpenAuth.Repository.Domain;
namespace OpenAuth.WebApi.Controllers.ServiceControllers
{
///
/// 后台管理模块
///
[Route("api/[controller]/[action]")]
[ApiController]
public class ManageController : ControllerBase
{
private readonly ManageApp _app;
public ManageController(ManageApp app)
{
_app = app;
}
#region 机场管理
///
/// 获取机场列表
///
///
///
///
///
[HttpGet]
public async Task>>> GetDataList(int page, int limit, string key)
{
var result = new Response>>();
try
{
result = await _app.GetPageList(page, limit, key);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.Message;
}
return result;
}
#endregion
#region 无人机管理
///
/// 获取无人机列表
///
///
///
///
///
[HttpGet]
public async Task>>> GetUavPageList(int page, int limit, string key)
{
var result = new Response>>();
try
{
result = await _app.GetUavPageList(page, limit, key);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.Message;
}
return result;
}
#endregion
#region 任务管理
///
/// 获取任务列表
///
///
///
///
///
[HttpGet]
public async Task>>> GetTaskPageList(int page, int limit, string key)
{
var result = new Response>>();
try
{
result = await _app.GetTaskPageList(page, limit, key);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.Message;
}
return result;
}
///
/// 添加任务
///
///
[HttpPost]
public async Task> AddTask(LasaTask info)
{
return await _app.AddTask(info);
}
///
/// 编辑任务
///
///
[HttpPost]
public async Task> EditTask(LasaTask info)
{
return await _app.EditTask(info);
}
///
/// 删除任务
///
///
[HttpPost]
public async Task> DeleteTask(string id)
{
return await _app.DeleteTask(id);
}
#endregion
#region 航线管理
///
/// 获取航线列表
///
///
///
///
///
[HttpGet]
public async Task>>> GetAirLineList(int page, int limit, string key)
{
var result = new Response>>();
try
{
result = await _app.GetAirLinePageList(page, limit, key);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.Message;
}
return result;
}
///
/// 添加航线
///
///
[HttpPost]
public async Task> AddAirLine(LasaAirLine info)
{
return await _app.AddAirLine(info);
}
///
/// 编辑航线
///
///
[HttpPost]
public async Task> EdiAirLine(LasaAirLine info)
{
return await _app.EditAirLine(info);
}
///
/// 删除航线
///
///
[HttpPost]
public async Task> DeleteAirLine(string id)
{
return await _app.DeleteAirLine(id);
}
#endregion
}
}