using Tiobon.Core.IServices; using Tiobon.Core.Model; using Tiobon.Core.Model.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Tiobon.Core.Controllers { /// /// WeChatConfigController /// [Route("api/[controller]/[action]")] [ApiController] [Authorize(Permissions.Name)] public partial class WeChatConfigController : Controller { readonly IWeChatConfigServices _WeChatConfigServices; /// /// 构造函数 /// /// public WeChatConfigController(IWeChatConfigServices iWeChatConfigServices) { _WeChatConfigServices = iWeChatConfigServices; } /// /// 获取 /// /// 分页条件 /// [HttpGet] public async Task>> Get([FromQuery] PaginationModel pagination) { var data = await _WeChatConfigServices.QueryPage(pagination); return new MessageModel> { success = true, response = data}; } /// /// 获取(id) /// /// 主键ID /// [HttpGet("{id}")] public async Task> Get(string id) { var data = await _WeChatConfigServices.QueryById(id); return new MessageModel { success = true, response = data }; } /// /// 添加 /// /// [HttpPost] public async Task> Post([FromBody] WeChatConfig obj) { await _WeChatConfigServices.Add(obj); return new MessageModel { success = true}; } /// /// 更新 /// /// [HttpPut] public async Task> Put([FromBody] WeChatConfig obj) { await _WeChatConfigServices.Update(obj); return new MessageModel { success = true}; } /// /// 删除 /// /// [HttpDelete] public async Task> Delete(string id) { await _WeChatConfigServices.DeleteById(id); return new MessageModel { success = true}; } /// /// 批量删除 /// /// [HttpDelete] public async Task> BatchDelete(string ids) { var i = ids.Split(","); await _WeChatConfigServices.DeleteByIds(i); return new MessageModel { success = true }; } } }