From b1da50e1809b1254f812f8b6809c2b418b859796 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 7 Mar 2024 11:50:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=97=E9=93=BA=E6=8A=BC?= =?UTF-8?q?=E9=87=91=E8=AE=A1=E7=AE=97=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/merchant/MerchantRepository.php | 14 +++++++------- crmeb/listens/OrderDeliveryListen.php | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/common/repositories/system/merchant/MerchantRepository.php b/app/common/repositories/system/merchant/MerchantRepository.php index 7dce5736..cdb95ff4 100755 --- a/app/common/repositories/system/merchant/MerchantRepository.php +++ b/app/common/repositories/system/merchant/MerchantRepository.php @@ -776,12 +776,12 @@ class MerchantRepository extends BaseRepository } $rate = $this->forceMargin ? 100 : $merchant['auto_margin_rate']; // //商户押金未完全缴纳且设置了自动扣除比例 - $margin= bcmul($income, bcdiv($rate, 100,2), 2); - // $margin = min(bcsub($margin, $merchant['paid_margin'], 2), $margin); - // $income = max(bcsub($income, $margin, 2), 0); - // if ($margin <= 0) { - // return [$income, $financeDao]; - // } + $margin = bcmul($income, bcdiv($rate, 100,2), 2); + $margin = min(bcsub($merchant['margin'], $merchant['paid_margin'], 2), $margin); + $income = max(bcsub($income, $margin, 2), 0); + if ($margin <= 0) { + return [$income, $financeDao]; + } $financeDao->platformIn($margin, 'auto_margin', $this->merId); if(bcadd($merchant['paid_margin'],$margin)>=$merchant['margin']){ $is_margin=10; @@ -816,7 +816,7 @@ class MerchantRepository extends BaseRepository throw new \Exception('merchant 保存出错', 500); } - return [bcsub($income,$margin,2), $financeDao]; + return [$income, $financeDao]; } /** diff --git a/crmeb/listens/OrderDeliveryListen.php b/crmeb/listens/OrderDeliveryListen.php index 67465549..31540949 100644 --- a/crmeb/listens/OrderDeliveryListen.php +++ b/crmeb/listens/OrderDeliveryListen.php @@ -42,7 +42,7 @@ class OrderDeliveryListen implements ListenerInterface $rate = 0.10; } elseif ($orderAmount >= 10000 && $orderAmount < 50000) { $rate = 0.15; - } elseif ($orderAmount >= 50000 && $orderAmount <= 100000) { + } elseif ($orderAmount >= 50000) { $rate = 0.20; } return $rate ?? 0;