zhengyuxuan
2025-03-28 182c7edd7c70eddbf33e2358f1f1aba96eb58cb3
fix:查询优化
6个文件已修改
46 ■■■■ 已修改文件
LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain.Shared/WeChat/WxPayPostBaseModel.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain/Ali/AliPayApi.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain/WeChat/IWxPayApi.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain/WeChat/WxPayApi.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.HttpApi/LifePay/ChannelFilterAttribute.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
@@ -12,6 +12,7 @@
using Microsoft.EntityFrameworkCore;
using ZeroD.Util;
using LifePayment.Domain;
using static LifePayment.Domain.Shared.LifePaymentConstant;
namespace LifePayment.Application.LifePay
{
@@ -140,7 +141,24 @@
                            }
                        }
                        break;
                    case LifePayTypeEnum.WxPay: break;
                    case LifePayTypeEnum.WxPay:
                        if (input.ExpensesReceiptsType == ExpensesReceiptsTypeEnum.Expenses)
                        {
                            var query = await _wxPayApi.WxPayTradeQuery(input.OrderNo);
                            if (query.Code == AlipayResultCode.Success && query.Status == WxPayStatus.支付成功)
                            {
                                await _lifePayExpensesReceiptsRepository.InsertAsync(data);
                            }
                        }
                        else
                        {
                            var query = await _wxPayApi.WxPayDomesticRefundsQuery(input.OrderNo);
                            if (query.Code == AlipayResultCode.Success && query.RefundStatus == WxPayRefundStatus.退款成功)
                            {
                                await _lifePayExpensesReceiptsRepository.InsertAsync(data);
                            }
                        }
                        break;
                    default: break;
                }
                
LifePayment/LifePayment.Domain.Shared/WeChat/WxPayPostBaseModel.cs
@@ -810,6 +810,7 @@
        /// </summary>
        [JsonProperty("code")]
        public string Code { get; set; }
        /// <summary>
        /// 返回信息
        /// </summary>
@@ -821,6 +822,14 @@
        /// </summary>
        [JsonProperty("refund_id ")]
        public string RefundId { get; set; }
        /// <summary>
        /// 微信支付退款状态
        /// </summary>
        [JsonProperty("refund_status ")]
        public string RefundStatus { get; set; }
        /// <summary>
        /// 商户退款单号
        /// </summary>
LifePayment/LifePayment.Domain/Ali/AliPayApi.cs
@@ -5,6 +5,7 @@
using LifePayment.Domain.Shared;
using Microsoft.Extensions.Options;
using Nest;
using Spire.Pdf;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -17,12 +18,14 @@
    {
        private readonly Config _options;
        public const string SDKVERSION = "alipay-easysdk-net-2.0.0";
        protected Alipay.EasySDK.Kernel.Client _kernel;
        public AliPayApi(
               IOptionsMonitor<Config> optionsMonitor, Client kernel)
               IOptionsMonitor<Config> optionsMonitor, string optionsName = null)
        {
            Alipay.EasySDK.Kernel.Context context = new Alipay.EasySDK.Kernel.Context(optionsName.IsNullOrEmpty() ? optionsMonitor.CurrentValue : optionsMonitor.Get(optionsName), SDKVERSION);
            _options = optionsMonitor.CurrentValue;
            _kernel = kernel;
            this._kernel = new Client(context);
        }
        public async Task<AlipayTradePrecreateResponse> GetAliPayQRCode(GetPayQrCodeInput input)
@@ -45,7 +48,6 @@
            AlipayTradeQueryResponse response = Factory.Payment.Common().Query(input.OutTradeNo);
            return response;
        }
        /// <summary>
        /// 查询支付宝退款订单信息
LifePayment/LifePayment.Domain/WeChat/IWxPayApi.cs
@@ -26,7 +26,7 @@
        Task<WxPayDomesticRefundsQueryReponse> WxPayDomesticRefundsQuery(string outTradeNo);
        Task WxPayTradeQuery(string outTradeNo);
        Task<WxPayDomesticRefundsQueryReponse> WxPayTradeQuery(string outTradeNo);
        Task<WxPayTradeBillApplyReponse> WxPayTradeBillApply(WxPayTradeBillApplyRequest input);
LifePayment/LifePayment.Domain/WeChat/WxPayApi.cs
@@ -43,10 +43,11 @@
            return result;
        }
        public async Task WxPayTradeQuery(string outTradeNo)
        public async Task<WxPayDomesticRefundsQueryReponse> WxPayTradeQuery(string outTradeNo)
        {
            var url = $"{string.Format(LifePaymentConstant.WxPayTradeQyery, outTradeNo)}";
            var result = await Certificates<WxPayDomesticRefundsQueryReponse>(url);
            return result;
        }
        public async Task<WxPayTradeBillApplyReponse> WxPayTradeBillApply(WxPayTradeBillApplyRequest input)
LifePayment/LifePayment.HttpApi/LifePay/ChannelFilterAttribute.cs
@@ -48,6 +48,10 @@
                        }
                    }
                    else
                    {
                        throw new UserFriendlyException("没有对应的渠道");
                    }
                }
            }