From 394393e91e51dea4ae5b689cc471fa62f2913da3 Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期一, 31 三月 2025 13:54:18 +0800
Subject: [PATCH] 提交

---
 LifePayment/LifePayment.Application/LifePay/LifePayService.cs |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index 1b8a173..10a0cd7 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;
@@ -1372,6 +1375,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>

--
Gitblit v1.9.1