添加定时确认商品改价
This commit is contained in:
parent
acac4d2950
commit
abf1e55bc7
@ -67,6 +67,31 @@ class Task
|
||||
});
|
||||
|
||||
$this->updateProductPrice();
|
||||
$this->confirmProductPrice();
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认商品改价
|
||||
* @return void
|
||||
*/
|
||||
public function confirmProductPrice()
|
||||
{
|
||||
new Crontab('0 */10 * * * *', function () {
|
||||
$value = DictData::getDictValue('update_product_price_task', 'confirm');
|
||||
if ($value == 1) {
|
||||
$list = StoreProductPrice::where('status', 0)->select()->toArray();
|
||||
$update = [];
|
||||
foreach ($list as $item) {
|
||||
$update[] = [
|
||||
'id' => $item['id'],
|
||||
'status' => 1,
|
||||
];
|
||||
}
|
||||
if (count($update) > 0) {
|
||||
(new StoreProduct())->saveAll($update);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user