修改定时更新出库商品供货价

This commit is contained in:
lewis 2025-01-10 14:21:40 +08:00
parent c55533e764
commit e2a3472a11

View File

@ -138,6 +138,7 @@ class Task
*/
public function setPurchase()
{
new Crontab('0 0 * * * *', function () {
$list = WarehouseProduct::where('purchase', 0)->order('id desc')->limit(100)->select()->toArray();
$productIds = array_unique(array_column($list, 'product_id'));
$products = StoreProduct::whereIn('id', $productIds)->field('id,purchase')->select()->toArray();
@ -154,6 +155,7 @@ class Task
];
}
(new WarehouseProduct())->saveAll($update);
});
}
}