From 7b77ac597eaacf2618a85d9506e918a4052201c0 Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期四, 20 三月 2025 14:30:52 +0800
Subject: [PATCH] fix:bug修复

---
 LifePayment/LifePayment.Application/LifePay/LifePayService.cs |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index 0a8d5cf..bbba5e5 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -271,6 +271,7 @@
         var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync();
         var platformRate = await _lifePayRateRepository.FirstOrDefaultAsync(r => r.RateType == LifePayRateTypeEnum.渚涘簲鍟嗘姌鎵d环);
         var channleRate = await _lifePayChannlesRep.FirstOrDefaultAsync(r => r.ChannlesNum == order.ChannelId);
+        var premiumRate = await _lifePayPremiumRepository.Where(x => x.IsDeleted == false && x.PremiumType == order.LifePayType).FirstOrDefaultAsync();
         CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�");
         var result = new LifePayOrderOutput()
                 {
@@ -299,8 +300,10 @@
             PlatformPrice = order.PlatformDeductionAmount,
             ChannleRate = channleRate.ChannlesRate,
             ChannlesRakeRate = channleRate.ChannlesRakeRate,
-            ChannlesRakePrice = (order.PayAmount - order.PlatformDeductionAmount) * channleRate.ChannlesRakeRate,
-            //PremiumRate = 
+            ChannlesRakePrice = (order.PayAmount - order.PlatformDeductionAmount) * channleRate.ChannlesRakeRate / 100,
+            PremiumRate = premiumRate == null ? default : premiumRate.Rate,
+            PremiumPrice = premiumRate == null ? default : Math.Round(order.PayAmount * premiumRate.Rate, 2),
+            Profit = (order.PayAmount - order.PlatformDeductionAmount) * (1.00m - channleRate.ChannlesRakeRate / 100) - (premiumRate == null ? 0 : Math.Round(order.PayAmount * premiumRate.Rate, 2))
         };
 
         return result;

--
Gitblit v1.9.1