|  |  | 
 |  |  | using DynamicQuery.Net.Dto.Input; | 
 |  |  | using LifePayment.Application.Contracts; | 
 |  |  | using LifePayment.Application.Contracts; | 
 |  |  | using LifePayment.Domain; | 
 |  |  | using LifePayment.Domain.LifePay; | 
 |  |  | using LifePayment.Domain.Models; | 
 |  |  | using LifePayment.Domain.Shared; | 
 |  |  | using MailKit.Search; | 
 |  |  | using Microsoft.EntityFrameworkCore; | 
 |  |  | using Microsoft.Extensions.Logging; | 
 |  |  | using Microsoft.Extensions.Options; | 
 |  |  | using Nest; | 
 |  |  | using Newtonsoft.Json; | 
 |  |  | using NPOI.OpenXmlFormats.Dml.Chart; | 
 |  |  | using NPOI.SS.Formula.Functions; | 
 |  |  | using StackExchange.Redis; | 
 |  |  | using System; | 
 |  |  | using System.Collections.Generic; | 
 |  |  | using System.Linq; | 
 |  |  | using System.Security.Cryptography; | 
 |  |  | using System.Linq.Dynamic.Core; | 
 |  |  | using System.Threading.Tasks; | 
 |  |  | using Volo.Abp; | 
 |  |  | using Volo.Abp.Application.Services; | 
 |  |  | using Volo.Abp.Domain.Entities; | 
 |  |  | using Volo.Abp.Data; | 
 |  |  | using Volo.Abp.Domain.Repositories; | 
 |  |  | using Volo.Abp.EventBus.Distributed; | 
 |  |  | using ZeroD.Util; | 
 |  |  | using ZeroD.Util.Fadd; | 
 |  |  | using static LifePayment.Domain.Shared.LifePaymentConstant; | 
 |  |  | using Volo.Abp.Data; | 
 |  |  | using Z.EntityFramework.Plus; | 
 |  |  | using LifePayment.Domain.LifePay; | 
 |  |  | using pingan.openbank.api.sdk.enums; | 
 |  |  | using ZeroD.Util; | 
 |  |  | using Alipay.EasySDK.Payment.Common.Models; | 
 |  |  | using static LifePayment.Domain.Shared.LifePaymentConstant; | 
 |  |  |  | 
 |  |  | namespace LifePayment.Application; | 
 |  |  |  | 
 |  |  | 
 |  |  |     private readonly IRepository<LifePayChannles, Guid> _lifePayChannlesRep; | 
 |  |  |     private readonly IRepository<LifePayAccount, Guid> _lifePayAccount; | 
 |  |  |     private readonly IDataFilter dataFilter; | 
 |  |  |  | 
 |  |  |     private readonly IChannelFilter _channelFilter; | 
 |  |  |     private readonly IAliPayApi _aliPayApi; | 
 |  |  |     private readonly IWxPayApi _wxPayApi; | 
 |  |  |     private readonly WxPayOption _wxPayOptions; | 
 |  |  | 
 |  |  |                           IOptions<WxPayOption> wxPayOptions, | 
 |  |  |                           IRepository<LifePayChannles, Guid> lifePayChannlesRep, | 
 |  |  |                           IRepository<LifePayAccount, Guid> lifePayAccount, | 
 |  |  |                           IDataFilter dataFilter) | 
 |  |  |                           IDataFilter dataFilter, | 
 |  |  |                           IChannelFilter channelFilter) | 
 |  |  |     { | 
 |  |  |         _logger = logger; | 
 |  |  |         _aCOOLYManager = aCOOLYManager; | 
 |  |  | 
 |  |  |         _lifePayChannlesRep = lifePayChannlesRep; | 
 |  |  |         _lifePayAccount = lifePayAccount; | 
 |  |  |         this.dataFilter = dataFilter; | 
 |  |  |         _channelFilter = channelFilter; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     #region 查询 | 
 |  |  | 
 |  |  |     public async Task<List<LifePayIntroInfoOutput>> GetIntroInfo(LifePayOrderTypeEnum lifePayType) | 
 |  |  |     { | 
 |  |  |         return await _lifePayIntroInfoRepository.Where(x => x.IsDeleted == false && x.LifePayType == lifePayType).OrderBy(x => x.Sequence) | 
 |  |  |             .Select(x => new LifePayIntroInfoOutput() { Type = x.Type, ContentSummary = x.ContentSummary, Content = x.Content, LifePayType = x.LifePayType,Path = x.Path,Sequence = x.Sequence }) | 
 |  |  |             .Select(x => new LifePayIntroInfoOutput() { Type = x.Type, ContentSummary = x.ContentSummary, Content = x.Content, LifePayType = x.LifePayType, Path = x.Path, Sequence = x.Sequence }) | 
 |  |  |                                            .ToListAsync(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |     /// </summary> | 
 |  |  |     /// <param name="input"></param> | 
 |  |  |     /// <returns></returns> | 
 |  |  |     public async Task<PageOutput<UserListOutput>> GetUserPage(PageInput input) | 
 |  |  |     public async Task<PageOutput<UserListOutput>> GetUserPage(QueryUserPageInput input) | 
 |  |  |     { | 
 |  |  |         return await _lifePayUserRepository.Select(x => | 
 |  |  |         return await _channelFilter.GetChannelLifePayUserFilter(_lifePayUserRepository).Where(x => x.IsDeleted == false) | 
 |  |  |             .WhereIf(!string.IsNullOrEmpty(input.QueryCondition), x => x.PhoneNumber.Contains(input.QueryCondition) || x.Name.Contains(input.QueryCondition)) | 
 |  |  |             .WhereIf(input.CreationTime.HasValue, x => x.CreationTime.ToString("yyyy-MM-dd") == input.CreationTime.Value.ToString("yyyy-MM-dd")) | 
 |  |  |                                             .Select(x => | 
 |  |  |                                                    new UserListOutput() | 
 |  |  |                                                    { | 
 |  |  |                                                        Id = x.Id, | 
 |  |  |                                                        CreationChannle = string.IsNullOrEmpty(x.CreationChannleNum) ? "" : _lifePayChannlesRep.Where(c => c.ChannlesNum == x.CreationChannleNum).FirstOrDefault().ChannlesName, | 
 |  |  |                                                        LastLoginChannle = string.IsNullOrEmpty(x.LastLoginChannleNum) ? "" : _lifePayChannlesRep.Where(c => c.ChannlesNum == x.LastLoginChannleNum).FirstOrDefault().ChannlesName, | 
 |  |  |                                                        PhoneNumber = x.PhoneNumber, | 
 |  |  |                                                        Name = string.IsNullOrEmpty(x.Name) ? "" : x.Name, | 
 |  |  |                                                        CreationTime = x.CreationTime, | 
 |  |  |                                                        LastLoginTime = x.LastLoginTime | 
 |  |  |                                                    }) | 
 |  |  | 
 |  |  |                                     }) | 
 |  |  |                                     .GetPageResult(input.PageModel); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /// <summary> | 
 |  |  | 
 |  |  |     /// <returns></returns> | 
 |  |  |     public async Task<PageOutput<LifePayOrderListOutput>> GetLifePayOrderPage(QueryLifePayOrderListInput input) | 
 |  |  |     { | 
 |  |  |         var result = await (from a in _lifePayOrderRepository.Where(x => x.PayStatus != LifePayStatusEnum.未支付) | 
 |  |  |         var result = await (from a in _channelFilter.GetChannelLifePayOrderFilter(_lifePayOrderRepository) | 
 |  |  |                       .WhereIf(input.BeginFinishTime.HasValue, x => x.FinishTime >= input.BeginFinishTime) | 
 |  |  |                                             .WhereIf(input.EndFinishTime.HasValue, x => x.FinishTime <= input.EndFinishTime) | 
 |  |  |                                             .WhereIf(input.BeginPayTime.HasValue, x => x.PayTime >= input.BeginPayTime) | 
 |  |  | 
 |  |  |                                             .WhereIf(input.LifePayOrderType.HasValue, x => x.LifePayOrderType == input.LifePayOrderType.Value) | 
 |  |  |                                             .WhereIf(input.UserId.HasValue, x => x.UserId == input.UserId.Value) | 
 |  |  |                                             .WhereIf(input.KeyWords.IsNotNullOrEmpty(), x => x.PhoneNumber.Contains(input.KeyWords) || x.OrderNo.Contains(input.KeyWords) || x.OutOrderNo.Contains(input.KeyWords) || x.ACOOLYOrderNo.Contains(input.KeyWords)) | 
 |  |  |                             join b in _lifePayChannlesRep on a.ChannelId equals b.Id into temp | 
 |  |  |                             join b in _lifePayChannlesRep on a.ChannelId equals b.ChannlesNum into temp | 
 |  |  |                             from b in temp.DefaultIfEmpty() | 
 |  |  |                             select new LifePayOrderListOutput | 
 |  |  |                             { | 
 |  |  | 
 |  |  |                                 RefundCheckRemark = a.RefundCheckRemark, | 
 |  |  |                                 RefundApplyRemark = a.RefundApplyRemark, | 
 |  |  |                                 RefundTime = a.RefundTime, | 
 |  |  |                                 ChannelName = b.ChannlesName | 
 |  |  |                                 ChannelName = b.ChannlesName, | 
 |  |  |                                 ActualRechargeAmount = a.ActualRechargeAmount, | 
 |  |  |                                 PlatformDeductionAmount = a.PlatformDeductionAmount, | 
 |  |  |                                 ACOOLYStatus = a.ACOOLYStatus, | 
 |  |  |                                 LifePayRefundStatus = a.LifePayRefundStatus, | 
 |  |  |                             }).GetPageResult(input.PageModel); | 
 |  |  |  | 
 |  |  |         return result; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public async Task<LifePayOrderOutput> GetLifePayOrderDetail(string orderNo) | 
 |  |  |     { | 
 |  |  |         var result = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo) | 
 |  |  |                                             .Select(x => | 
 |  |  |                                                     new LifePayOrderOutput | 
 |  |  |                                                     { | 
 |  |  |                                                         DiscountAmount = x.DiscountAmount, | 
 |  |  |                                                         FinishTime = x.FinishTime, | 
 |  |  |                                                         Id = x.Id, | 
 |  |  |                                                         LifePayOrderStatus = x.LifePayOrderStatus, | 
 |  |  |                                                         LifePayOrderType = x.LifePayOrderType, | 
 |  |  |                                                         LifePayType = x.LifePayType, | 
 |  |  |                                                         OrderNo = x.OrderNo, | 
 |  |  |                                                         PayAmount = x.PayAmount, | 
 |  |  |                                                         RechargeAmount = x.RechargeAmount, | 
 |  |  |                                                         PayStatus = x.PayStatus, | 
 |  |  |                                                         PayTime = x.PayTime, | 
 |  |  |                                                         OrderParamDetailJsonStr = x.OrderParamDetailJsonStr, | 
 |  |  |                                                         RefundCredentialsImgUrl = x.RefundCredentialsImgUrl.GetOssPath(), | 
 |  |  |                                                         CreationTime = x.CreationTime, | 
 |  |  |                                                         RefundCheckRemark = x.RefundCheckRemark, | 
 |  |  |                                                         RefundApplyRemark = x.RefundApplyRemark, | 
 |  |  |                                                         RefundTime = x.RefundTime, | 
 |  |  |                                                         ACOOLYOrderNo = x.ACOOLYOrderNo, | 
 |  |  |                                                     }) | 
 |  |  |                                             .FirstOrDefaultAsync(); | 
 |  |  |         CheckExtensions.IfTrueThrowUserFriendlyException(result == null, "订单不存在"); | 
 |  |  |  | 
 |  |  |         return result; | 
 |  |  |     } | 
 |  |  | 
 |  |  |             return new PageOutput<UserLifePayOrderOutput>(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return await _lifePayOrderRepository.Where(x => x.PayStatus != LifePayStatusEnum.未支付) | 
 |  |  |         return await _channelFilter.GetChannelLifePayOrderFilter(_lifePayOrderRepository).Where(x => x.PayStatus != LifePayStatusEnum.未支付) | 
 |  |  |                                             .WhereIf(input.BeginFinishTime.HasValue, x => x.FinishTime >= input.BeginFinishTime) | 
 |  |  |                                             .WhereIf(input.EndFinishTime.HasValue, x => x.FinishTime <= input.EndFinishTime) | 
 |  |  |                                             .WhereIf(input.BeginPayTime.HasValue, x => x.PayTime >= input.BeginPayTime) | 
 |  |  | 
 |  |  |         return result; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /// <summary> | 
 |  |  |     /// 根据订单号获取支付状态 | 
 |  |  |     /// </summary> | 
 |  |  | 
 |  |  |  | 
 |  |  |     public async Task<UserLifePayOrderRefundOutput> GetUserLifePayOrderRefund(Guid id) | 
 |  |  |     { | 
 |  |  |         var order = await _lifePayOrderRepository.Where(x => x.Id == id).Select(x => | 
 |  |  |         var order = await _channelFilter.GetChannelLifePayOrderFilter(_lifePayOrderRepository).Where(x => x.Id == id).Select(x => | 
 |  |  |                                                     new UserLifePayOrderRefundOutput | 
 |  |  |                                                     { | 
 |  |  |                                                         Id = x.Id, | 
 |  |  | 
 |  |  |  | 
 |  |  |         var orderInput = new CreateLifePayOrderInput | 
 |  |  |         { | 
 |  |  |             OrderNo = CreateOrderNo(), | 
 |  |  |             OrderNo = channle.ChannlesNum + CreateOrderNo(), | 
 |  |  |             LifePayOrderStatus = LifePayOrderStatusEnum.待确认, | 
 |  |  |             LifePayOrderType = LifePayOrderTypeEnum.话费订单, | 
 |  |  |             //LifePayType = input.LifePayType, | 
 |  |  | 
 |  |  |             PayAmount = amount.PayAmont, | 
 |  |  |             DiscountAmount = amount.DiscountAmount, | 
 |  |  |             RechargeAmount = amount.RechargeAmount, | 
 |  |  |             ChannelId = channle.Id | 
 |  |  |             ChannelId = channle.ChannlesNum | 
 |  |  |         }; | 
 |  |  |  | 
 |  |  |         await CreateLifePayOrder(orderInput); | 
 |  |  | 
 |  |  |  | 
 |  |  |         var orderInput = new CreateLifePayOrderInput | 
 |  |  |         { | 
 |  |  |             OrderNo = CreateOrderNo(), | 
 |  |  |             OrderNo = channle.ChannlesNum + CreateOrderNo(), | 
 |  |  |             LifePayOrderStatus = LifePayOrderStatusEnum.待确认, | 
 |  |  |             LifePayOrderType = LifePayOrderTypeEnum.电费订单, | 
 |  |  |             // LifePayType = input.LifePayType, | 
 |  |  | 
 |  |  |             PayAmount = amount.PayAmont, | 
 |  |  |             DiscountAmount = amount.DiscountAmount, | 
 |  |  |             RechargeAmount = amount.RechargeAmount, | 
 |  |  |             ChannelId = channle.Id | 
 |  |  |             ChannelId = channle.ChannlesNum | 
 |  |  |         }; | 
 |  |  |  | 
 |  |  |         await CreateLifePayOrder(orderInput); | 
 |  |  | 
 |  |  |  | 
 |  |  |         var orderInput = new CreateLifePayOrderInput | 
 |  |  |         { | 
 |  |  |             OrderNo = CreateOrderNo(), | 
 |  |  |             OrderNo = channle.ChannlesNum + CreateOrderNo(), | 
 |  |  |             LifePayOrderStatus = LifePayOrderStatusEnum.待确认, | 
 |  |  |             LifePayOrderType = LifePayOrderTypeEnum.燃气订单, | 
 |  |  |             // LifePayType = input.LifePayType, | 
 |  |  | 
 |  |  |             PayAmount = amount.PayAmont, | 
 |  |  |             DiscountAmount = amount.DiscountAmount, | 
 |  |  |             RechargeAmount = amount.RechargeAmount, | 
 |  |  |             ChannelId = channle.Id | 
 |  |  |             ChannelId = channle.ChannlesNum | 
 |  |  |         }; | 
 |  |  |  | 
 |  |  |         await CreateLifePayOrder(orderInput); | 
 |  |  | 
 |  |  |     /// <param name="orderNo"></param> | 
 |  |  |     /// <param name="outOrderNo"></param> | 
 |  |  |     /// <returns></returns> | 
 |  |  |     public async Task ACOOLYOrderNotifyHandler(string orderNo, string acoolyOrderNo, LifePayOrderStatusEnum status) | 
 |  |  |     public async Task ACOOLYOrderNotifyHandler(string orderNo, string acoolyOrderNo, LifePayOrderStatusEnum status, ACOOLYStatusEnum acoolyStatus, decimal payAmount) | 
 |  |  |     { | 
 |  |  |         var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync(); | 
 |  |  |         CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "订单不存在"); | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         order.LifePayOrderStatus = status; | 
 |  |  |         order.ACOOLYStatus = acoolyStatus; | 
 |  |  |         order.PlatformDeductionAmount = payAmount; | 
 |  |  |         if (acoolyOrderNo.IsNotNullOrEmpty()) | 
 |  |  |         { | 
 |  |  |             order.ACOOLYOrderNo = acoolyOrderNo; | 
 |  |  | 
 |  |  |             throw new UserFriendlyException("当前订单状态无法退款"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// TODO 退款请求完成后如何操作 | 
 |  |  |         /// var refundResult = await WxPayDomesticRefunds(order.OrderNo, order.RefundApplyRemark, Convert.ToInt32(order.PayAmount * 100), Convert.ToInt32(order.PayAmount * 100)); | 
 |  |  |         switch (order.LifePayType) | 
 |  |  |         { | 
 |  |  |             case LifePayTypeEnum.WxPay: | 
 |  |  |                 var wxRefundResult = await WxPayDomesticRefunds(order.OrderNo, order.RefundApplyRemark, Convert.ToInt32(order.PayAmount * 100), Convert.ToInt32(order.PayAmount * 100)); | 
 |  |  |                 if (wxRefundResult.Status == "SUCCESS") | 
 |  |  |                 { | 
 |  |  |                     order.PayStatus = LifePayStatusEnum.已退款; | 
 |  |  |                     order.LifePayOrderStatus = LifePayOrderStatusEnum.已退款; | 
 |  |  |                 } | 
 |  |  |                 else if (wxRefundResult.Status == "PROCESSING") | 
 |  |  |                 { | 
 |  |  |                     order.PayStatus = LifePayStatusEnum.退款中; | 
 |  |  |                     order.LifePayOrderStatus = LifePayOrderStatusEnum.退款中; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     throw new UserFriendlyException("退款失败"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |         order.PayStatus = LifePayStatusEnum.已退款; | 
 |  |  |         order.LifePayOrderStatus = LifePayOrderStatusEnum.已退款; | 
 |  |  |                 break; | 
 |  |  |             case LifePayTypeEnum.AliPay: | 
 |  |  |                 var aliRefundResult = await AliTradeRefund(new AlipayTradeRefundRequest() { OutTradeNo = order.OrderNo, RefundAmount = order.PayAmount.ToString() }); | 
 |  |  |                 if (aliRefundResult.Code != AlipayResultCode.Success) | 
 |  |  |                 { | 
 |  |  |                     throw new UserFriendlyException("退款失败"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 order.PayStatus = LifePayStatusEnum.已退款; | 
 |  |  |                 order.LifePayOrderStatus = LifePayOrderStatusEnum.已退款; | 
 |  |  |                 break; | 
 |  |  |             default: throw new UserFriendlyException("退款失败"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         order.RefundCredentialsImgUrl = input.RefundCredentialsImgUrl; | 
 |  |  |         order.RefundCheckRemark = input.RefundCheckRemark; | 
 |  |  |         order.RefundTime = DateTime.Now; | 
 |  |  |         order.RefundCheckUserId = CurrentUser.Id; | 
 |  |  |         order.RefundPrice = order.PayAmount; | 
 |  |  |  | 
 |  |  |         await _lifePayOrderRepository.UpdateAsync(order); | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |         order.LifePayOrderStatus = LifePayOrderStatusEnum.退款待审核; | 
 |  |  |         order.RefundApplyRemark = input.RefundApplyRemark; | 
 |  |  |         order.RefundTime = DateTime.Now; | 
 |  |  |         order.RefundApplyTime = DateTime.Now; | 
 |  |  |  | 
 |  |  |         await _lifePayOrderRepository.UpdateAsync(order); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /// <summary> | 
 |  |  |     /// 微信退款 | 
 |  |  |     /// </summary> | 
 |  |  |     /// <param name="outTradeNo"></param> | 
 |  |  |     /// <param name="reason"></param> | 
 |  |  |     /// <param name="refund"></param> | 
 |  |  |     /// <param name="total"></param> | 
 |  |  |     /// <param name="currency"></param> | 
 |  |  |     /// <returns></returns> | 
 |  |  |     public async Task<WxPayDomesticRefundsReponse> WxPayDomesticRefunds(string outTradeNo, string reason, int refund, int total, string currency = "CNY") | 
 |  |  |     { | 
 |  |  |         WxPayDomesticRefundsRequest req = new WxPayDomesticRefundsRequest | 
 |  |  | 
 |  |  |         return res; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private async Task<AlipayTradeRefundResponse> AliTradeRefund(AlipayTradeRefundRequest input) | 
 |  |  |     { | 
 |  |  |         return await _aliPayApi.TradeRefund(input); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public async Task<int> AddUpdateUserAccount(AddUpdateUserAccountInput input) | 
 |  |  |     { | 
 |  |  |         var user = await _lifePayUserRepository.Where(r => r.Id == input.UserId && !r.IsDeleted).FirstOrDefaultAsync(); | 
 |  |  |         CheckExtensions.IfTrueThrowUserFriendlyException(user == null, "用户不存在"); | 
 |  |  |  | 
 |  |  |         if (input.Id.HasValue) | 
 |  |  |         { | 
 |  |  |             var userAccount = await _lifePayAccount.Where(x => x.UserId == input.UserId && x.Id == input.Id) | 
 |  |  | 
 |  |  |             }; | 
 |  |  |             await _lifePayAccount.InsertAsync(userAccount); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         if (input.LifePayType == LifePayOrderTypeEnum.话费订单) | 
 |  |  |         { | 
 |  |  |             var extraProperties = JsonConvert.DeserializeObject<Model_UserAccountExtraProperties>(input.ExtraProperties); | 
 |  |  |             if (!string.IsNullOrEmpty(extraProperties.Name)) | 
 |  |  |             { | 
 |  |  |                 user.Name = extraProperties.Name; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         return Constant.SUCCESS; | 
 |  |  |     } | 
 |  |  | 
 |  |  |     private (decimal PayAmont, decimal DiscountAmount, decimal RechargeAmount) CalculateAmount(decimal amount, decimal rate) | 
 |  |  |     { | 
 |  |  |         /// 正常支付 | 
 |  |  |         var payAmount = decimal.Round(amount * rate / 100, 2, MidpointRounding.AwayFromZero); | 
 |  |  |         //var payAmount = decimal.Round(amount * rate / 100, 2, MidpointRounding.AwayFromZero); | 
 |  |  |  | 
 |  |  |         /// 1分钱支付 | 
 |  |  |         //decimal payAmount = 0.01m; | 
 |  |  |         decimal payAmount = 0.01m; | 
 |  |  |  | 
 |  |  |         CheckExtensions.IfTrueThrowUserFriendlyException(payAmount < 0.01m, "支付金额错误"); | 
 |  |  |  | 
 |  |  | 
 |  |  |         CheckExtensions.IfTrueThrowUserFriendlyException(amount <= 0, | 
 |  |  |                                                          CustomeErrorMessage.SometingMustSometing, | 
 |  |  |                                                          "获取支付二维码时金额", "大于0"); | 
 |  |  |  | 
 |  |  |         var res = await _wxPayApi.PayTransactionsH5(new PayTransactionsNativeH5 | 
 |  |  |         { | 
 |  |  |             Appid = _wxPayOptions.AppID, | 
 |  |  | 
 |  |  |  | 
 |  |  |         return res.QrCode; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /// <summary> | 
 |  |  |     /// 构造待签名字符串 | 
 |  |  |     /// </summary> | 
 |  |  | 
 |  |  |                                             .WhereIf(input.LifePayOrderType.HasValue, x => x.LifePayOrderType == input.LifePayOrderType.Value) | 
 |  |  |                                             .WhereIf(input.UserId.HasValue, x => x.UserId == input.UserId.Value) | 
 |  |  |                                             .WhereIf(input.KeyWords.IsNotNullOrEmpty(), x => x.PhoneNumber.Contains(input.KeyWords) || x.OrderNo.Contains(input.KeyWords) || x.OutOrderNo.Contains(input.KeyWords) || x.ACOOLYOrderNo.Contains(input.KeyWords)) | 
 |  |  |                       join b in _lifePayChannlesRep on a.ChannelId equals b.Id into temp | 
 |  |  |                       join b in _lifePayChannlesRep on a.ChannelId equals b.ChannlesNum into temp | 
 |  |  |                       from b in temp.DefaultIfEmpty() | 
 |  |  |                       select new LifePayOrderListOutput | 
 |  |  |                       { | 
 |  |  | 
 |  |  |                     }); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |         #endregion | 
 |  |  |     } | 
 |  |  |     #endregion | 
 |  |  | } |