From 52c4beb37409c657048d6bbb9a9bdc1eabba6f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Tue, 28 Dec 2021 20:06:53 +0800 Subject: [PATCH] Fix --- app/Services/DistributionPreIncomeJobService.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Services/DistributionPreIncomeJobService.php b/app/Services/DistributionPreIncomeJobService.php index 608f6b14..d6ffcf31 100644 --- a/app/Services/DistributionPreIncomeJobService.php +++ b/app/Services/DistributionPreIncomeJobService.php @@ -145,7 +145,16 @@ class DistributionPreIncomeJobService 'updated_at' => $time, ]; } elseif (in_array($preIncome->type, [DistributionPreIncome::TYPE_LEVEL_DIFF, DistributionPreIncome::TYPE_LEVEL_SAME])) { - $changeAmount = bcdiv($afterSale->amount, '100'); + if (bccomp($afterSale->sales_value, '0', 2) <= 0) { + continue; + } + + $changeAmount = $afterSale->amount; + if ($changeAmount > $afterSaleProduct->total_amount) { + $changeAmount = $afterSaleProduct->total_amount; + } + $changeAmount = bcdiv($changeAmount, '100'); + $changeSalesValue = $afterSale->sales_value; // 级差奖励和平级奖励按变更的销售值算收益 $changeRevenue = bcmul($changeSalesValue, $rule['bonus_rate']);