using CoreCms.Net.IServices; using CoreCms.Net.Model.FromBody; using CoreCms.Net.Model.ViewModels.UI; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using SqlSugar; using System.Threading.Tasks; namespace CoreCms.Net.Web.WebApi.Controllers { /// /// 充值接口 /// [Route("api/[controller]/[action]")] [ApiController] public class TopUpController : ControllerBase { private readonly ICoreCmsTopUpTypeServices _topUpTypeServices; /// /// 构造函数 /// /// public TopUpController(ICoreCmsTopUpTypeServices topUpTypeServices) { _topUpTypeServices = topUpTypeServices; } #region 获取充值规则列表 /// /// 获取通知列表 /// /// [HttpPost] public async Task TypeList() { var jm = new WebApiCallBack(); var list = await _topUpTypeServices.QueryListByClauseAsync(p => p.isEnable == true, p => p.sortId, OrderByType.Desc, true, true); jm.status = true; jm.data = list; return jm; } #endregion #region 获取单个充值规则 /// /// 获取单个充值规则 /// /// /// [HttpPost] public async Task GetTypeDetail([FromBody] FMIntId entity) { var jm = new WebApiCallBack(); var model = await _topUpTypeServices.QueryByClauseAsync(p => p.id == entity.id, true, true); if (model == null) { jm.msg = "数据获取失败"; return jm; } jm.status = true; jm.data = model; return jm; } #endregion } }