using iTextSharp.text; using Microsoft.AspNetCore.Mvc; using System; using System.Threading.Tasks; using XYY.Core.Standard.Mvc; using XYY.Data.Standard.Channel; using XYY.Data.Standard.Order; using XYY.Model.Standard.Channel; namespace XYY.Api.Order.Controllers { [Route("api/[controller]/[action]")] [ApiController] public class FrayunController : ApiControllerBase { IFrayunRepository frayunRepository; IOrderRepository orderRepository; ILogistics_ChannelRepository logistics_ChannelRepository; public FrayunController(IFrayunRepository frayunRepository, IOrderRepository orderRepository, ILogistics_ChannelRepository logistics_ChannelRepository) { this.frayunRepository = frayunRepository; this.orderRepository = orderRepository; this.logistics_ChannelRepository = logistics_ChannelRepository; } public async Task GetCancelOrders(DateTime dateTime) { var list = await this.frayunRepository.GetOrders(dateTime.ToString_yyyyMMdd()); return Ok(list); } public async Task CancelOrder(string orderId) { var channel = await logistics_ChannelRepository.GetAsync(237); XYY.Service.Standard.ChannelApi.Frayun.Api api = new Service.Standard.ChannelApi.Frayun.Api(orderRepository); var model = new XYY.Model.Standard.Channel.logistics_ChannelCancel { ApiHost = channel.ApiHost, ApiSecret = channel.ApiSecret, ApiKey = channel.ApiKey, ServiceCode = channel.ServiceCode, SystemNo = orderId }; api.CannelOrdersByModel(model); if (model.ResultState == ResultStateEnum.成功.GetValue()) { return Ok(); } else { return Error(model.ResultMessage); } } } }