From d3df5273d83fefa80e988300f1d33387985c811c Mon Sep 17 00:00:00 2001 From: zhengyuxuan <zhengyuxuan1995> Date: 星期一, 31 三月 2025 17:33:28 +0800 Subject: [PATCH] fix:支付宝支付回调 --- LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 32 +++++++++++++++++++++++++++++--- 1 files changed, 29 insertions(+), 3 deletions(-) diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs index 11bdb9b..5bae261 100644 --- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs +++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs @@ -46,6 +46,7 @@ private readonly IRepository<LifePayChannles, Guid> _lifePayChannlesRep; private readonly IRepository<LifePayAccount, Guid> _lifePayAccount; private readonly IRepository<OperateHistory, Guid> _operateHistory; + private readonly IRepository<LifePayChannlesRake, Guid> _lifePayChannlesRakeRepository; private readonly IDataFilter dataFilter; private readonly IChannelFilter _channelFilter; private readonly IAliPayApi _aliPayApi; @@ -64,6 +65,7 @@ IRepository<LifePayUser, Guid> lifePayUserRepository, IRepository<LifePayPremium, Guid> lifePayPremiumRepository, IRepository<LifePayIntroInfo, Guid> lifePayIntroInfoRepository, + IRepository<LifePayChannlesRake, Guid> lifePayChannlesRakeRepository, IRepository<OperateHistory, Guid> operateHistory, IAliPayApi aliPayApi, IAlipayInterfaceManager aliPayInterfaceManager, @@ -80,6 +82,7 @@ _lifePayRateRepository = lifePayRateRepository; _lifePayOrderRepository = lifePayOrderRepository; _lifePayUserRepository = lifePayUserRepository; + _lifePayChannlesRakeRepository = lifePayChannlesRakeRepository; _lifePayPremiumRepository = lifePayPremiumRepository; _lifePayIntroInfoRepository = lifePayIntroInfoRepository; _aliPayApi = aliPayApi; @@ -872,6 +875,8 @@ return await _wxPayApi.WxPayTradeQuery(outTradeNo); } + + #endregion #region 鎿嶄綔 @@ -1316,7 +1321,7 @@ await _lifePayOrderRepository.UpdateAsync(order); } - public async Task WxPayDomesticRefundsHandler(string orderNo, LifePayRefundStatusEnum refundStatus) + public async Task LifePayRefundsHandler(string orderNo, LifePayRefundStatusEnum refundStatus) { var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync(); CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�"); @@ -1333,6 +1338,7 @@ default: break; } } + /// <summary> /// ACOOLYO璁㈠崟閫氱煡澶勭悊 @@ -1370,6 +1376,27 @@ order.ACOOLYStatus = acoolyStatus; order.FinishTime = DateTime.Now; await _lifePayOrderRepository.UpdateAsync(order); + + if (order.LifePayOrderStatus == LifePayOrderStatusEnum.宸插畬鎴�) + { + /// 姣涘埄 + var grossProfit = order.RechargeAmount * (order.ChannleRate - order.PlatformRate) / 100; + /// 娓犻亾浣i噾 锛�(鍏呭�奸潰棰� * 娓犻亾鎶樻墸姣斾緥)-(鍏呭�奸潰棰� * 骞冲彴鎶樻墸姣斾緥)锛�* 浣i噾姣斾緥 + var channlesRakePrice = grossProfit * (order.ChannlesRakeRate) / 100; + if (channlesRakePrice.HasValue) + { + LifePayChannlesRake lifePayChannlesRake = new LifePayChannlesRake() + { + OrderNo = order.OrderNo, + PayAmount = order.PayAmount.Value, + ChannlesRakeRate = order.ChannlesRakeRate.Value, + ChannlesRakePrice = channlesRakePrice.Value, + FinishTime = order.FinishTime.Value, + ChannelId = order.ChannelId, + }; + await _lifePayChannlesRakeRepository.InsertAsync(lifePayChannlesRake); + } + } } /// <summary> @@ -1572,7 +1599,7 @@ await _lifePayAccount.InsertAsync(userAccount); } - if (input.LifePayType == LifePayOrderTypeEnum.PhoneOrder) + if (input.LifePayType == LifePayOrderTypeEnum.PhoneOrder || input.LifePayType == LifePayOrderTypeEnum.ElectricOrder) { var extraProperties = JsonConvert.DeserializeObject<Model_UserAccountExtraProperties>(input.ExtraProperties); if (!string.IsNullOrEmpty(extraProperties.Name) && extraProperties.Phone == user.PhoneNumber) @@ -2013,7 +2040,6 @@ string message = $"{method}\n{uri}\n{timestamp}\n{nonce}\n{body}\n"; return message; } - private async Task<IQueryable<LifePayOrderListOutput>> GetLifePayOrderListFilter(QueryLifePayOrderListInput input) { -- Gitblit v1.9.1