调整商品毛利率计算
This commit is contained in:
parent
717a1c2a1c
commit
7f38a8183e
@ -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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user