110 lines
3.1 KiB
C#
110 lines
3.1 KiB
C#
using Infrastructure;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using OpenAuth.App.BaseApp.Subscribe;
|
|
using OpenAuth.App.ServiceApp;
|
|
using OpenAuth.Repository.Domain;
|
|
|
|
namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
|
{
|
|
/// <summary>
|
|
/// 消息推送模块
|
|
/// </summary>
|
|
[Route("api/[controller]/[action]")]
|
|
[ApiController]
|
|
public class LasaPlatformPushController : ControllerBase
|
|
{
|
|
private readonly LasaPlatformPushApp _app;
|
|
public LasaPlatformPushController(LasaPlatformPushApp app)
|
|
{
|
|
_app = app;
|
|
}
|
|
/// <summary>
|
|
/// 获取推送平台列表
|
|
/// </summary>
|
|
/// <param name="page"></param>
|
|
/// <param name="limit"></param>
|
|
/// <param name="key">平台名称</param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[AllowAnonymous]
|
|
public async Task<Response<PageInfo<List<LasaPlatform>>>> GetPlatformList(int page, int limit, string key)
|
|
{
|
|
var result = new Response<PageInfo<List<LasaPlatform>>>();
|
|
try
|
|
{
|
|
result = await _app.GetPlatformList(page, limit, key);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.Message;
|
|
}
|
|
return result;
|
|
}
|
|
/// <summary>
|
|
/// 添加平台
|
|
/// </summary>
|
|
/// <param name="info"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[AllowAnonymous]
|
|
public async Task<Response<bool>> AddPlatform(LasaPlatform info)
|
|
{
|
|
var result = new Response<bool>();
|
|
try
|
|
{
|
|
result = await _app.AddPlatform(info);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.Message;
|
|
}
|
|
return result;
|
|
}
|
|
/// <summary>
|
|
/// 修改平台
|
|
/// </summary>
|
|
/// <param name="info"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[AllowAnonymous]
|
|
public async Task<Response<bool>> UpdatePlatform(LasaPlatform info)
|
|
{
|
|
var result = new Response<bool>();
|
|
try
|
|
{
|
|
result = await _app.UpdatePlatform(info);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.Message;
|
|
}
|
|
return result;
|
|
}
|
|
/// <summary>
|
|
/// 删除平台
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[AllowAnonymous]
|
|
public async Task<Response<bool>> DeletePlatform(string id)
|
|
{
|
|
var result = new Response<bool>();
|
|
try
|
|
{
|
|
result = await _app.DeletePlatform(id);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.Message;
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
}
|