diff --git a/process/Task.php b/process/Task.php index aa10565b..fec68c71 100644 --- a/process/Task.php +++ b/process/Task.php @@ -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); + } + } + }); } /**