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;