From 7f38a8183e1e1251626c6125af55bd3321f03689 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Wed, 28 Feb 2024 14:27:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=95=86=E5=93=81=E6=AF=9B?= =?UTF-8?q?=E5=88=A9=E7=8E=87=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/listens/SetProductProfitRateListen.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crmeb/listens/SetProductProfitRateListen.php b/crmeb/listens/SetProductProfitRateListen.php index b84c0a86..135d70b3 100644 --- a/crmeb/listens/SetProductProfitRateListen.php +++ b/crmeb/listens/SetProductProfitRateListen.php @@ -24,8 +24,8 @@ class SetProductProfitRateListen extends TimerService implements ListenerInterfa ->limit(100) ->select(); foreach ($storeProducts as $storeProduct) { - $storeProduct->profit_rate = bcdiv(bcsub($storeProduct->price, $storeProduct->procure_price, 2), $storeProduct->price, 2) * 100; - $storeProduct->save(); + $profitRate = bcdiv(bcsub($storeProduct->price, $storeProduct->procure_price, 2), $storeProduct->price, 2) * 100; + ProductAttrValue::where('unique', $storeProduct->unique)->update(['profit_rate' => $profitRate]); } } catch (\Throwable $e) { Log::info('定时任务:更新商品利润率,error => ' . $e->getMessage());