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 { /// /// 消息推送模块 /// [Route("api/[controller]/[action]")] [ApiController] public class LasaPlatformPushController : ControllerBase { private readonly LasaPlatformPushApp _app; public LasaPlatformPushController(LasaPlatformPushApp app) { _app = app; } /// /// 获取推送平台列表 /// /// /// /// 平台名称 /// [HttpGet] [AllowAnonymous] public async Task>>> GetPlatformList(int page, int limit, string key) { var result = new Response>>(); try { result = await _app.GetPlatformList(page, limit, key); } catch (Exception ex) { result.Code = 500; result.Message = ex.Message; } return result; } /// /// 添加平台 /// /// /// [HttpPost] [AllowAnonymous] public async Task> AddPlatform(LasaPlatform info) { var result = new Response(); try { result = await _app.AddPlatform(info); } catch (Exception ex) { result.Code = 500; result.Message = ex.Message; } return result; } /// /// 修改平台 /// /// /// [HttpPost] [AllowAnonymous] public async Task> UpdatePlatform(LasaPlatform info) { var result = new Response(); try { result = await _app.UpdatePlatform(info); } catch (Exception ex) { result.Code = 500; result.Message = ex.Message; } return result; } /// /// 删除平台 /// /// /// [HttpPost] [AllowAnonymous] public async Task> DeletePlatform(string id) { var result = new Response(); try { result = await _app.DeletePlatform(id); } catch (Exception ex) { result.Code = 500; result.Message = ex.Message; } return result; } #region 算法推送记录 /// /// 获取推送平台列表 /// /// /// /// 平台名称 /// [HttpGet] [AllowAnonymous] public async Task>>> GetAiLogList(int page, int limit, string key) { var result = new Response>>(); try { result = await _app.GetAiLogList(page, limit, key); } catch (Exception ex) { result.Code = 500; result.Message = ex.Message; } return result; } #endregion } }