Files
coreshoppro/CoreCms.Net.Web.WebApi/Controllers/TopUpController.cs
2023-03-27 02:43:50 +08:00

78 lines
2.0 KiB
C#

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
{
/// <summary>
/// 充值接口
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class TopUpController : ControllerBase
{
private readonly ICoreCmsTopUpTypeServices _topUpTypeServices;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="topUpTypeServices"></param>
public TopUpController(ICoreCmsTopUpTypeServices topUpTypeServices)
{
_topUpTypeServices = topUpTypeServices;
}
#region
/// <summary>
/// 获取通知列表
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> 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
/// <summary>
/// 获取单个充值规则
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> 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
}
}