using HuanMeng.DotNetCore.Base; using HuanMeng.MiaoYu.Code.Order; using HuanMeng.MiaoYu.Model.Dto.Order; using HuanMeng.MiaoYu.WebApi.Base; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; namespace HuanMeng.MiaoYu.WebApi.Controllers { /// /// 订单 /// [Route("api/[controller]/[action]")] [ApiController] public class PaymentController : MiaoYuControllerBase { public PaymentController(IServiceProvider _serviceProvider) : base(_serviceProvider) { } /// /// 创建订单 /// /// /// [HttpPost] public async Task> CreateOrder([FromBody] IntentOrderRequest intentOrder) { OrderBLL orderBLL = new OrderBLL(ServiceProvider); return await orderBLL.CreateOrder(intentOrder.PaymentMethod, intentOrder.ProductId); } /// /// 获取订单状态 /// /// /// [HttpGet] public async Task> GetOrderRewardsInfo(string orderId) { OrderBLL orderBLL = new OrderBLL(ServiceProvider); return await orderBLL.GetOrderRewardsInfo(orderId); } /// /// 购买商城物品 /// /// /// [HttpPost] public async Task> BuyProduct([FromBody] BuyProductRequest buyProductRequest) { OrderBLL orderBLL = new OrderBLL(ServiceProvider); return await orderBLL.BuyProduct(buyProductRequest.ProductId, buyProductRequest.BuyCount ?? 1); } } }