diff --git a/crmeb/listens/SetProductProfitRateListen.php b/crmeb/listens/SetProductProfitRateListen.php index be2c597c..b84c0a86 100644 --- a/crmeb/listens/SetProductProfitRateListen.php +++ b/crmeb/listens/SetProductProfitRateListen.php @@ -24,7 +24,7 @@ class SetProductProfitRateListen extends TimerService implements ListenerInterfa ->limit(100) ->select(); foreach ($storeProducts as $storeProduct) { - $storeProduct->profit_rate = bcdiv($storeProduct->procure_price, $storeProduct->price, 2) * 100; + $storeProduct->profit_rate = bcdiv(bcsub($storeProduct->price, $storeProduct->procure_price, 2), $storeProduct->price, 2) * 100; $storeProduct->save(); } } catch (\Throwable $e) {