From abf1e55bc7d1e2e8ca77ecbab609b402f68efeac Mon Sep 17 00:00:00 2001 From: lewis <604446095@qq.com> Date: Sat, 4 Jan 2025 10:31:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=9A=E6=97=B6=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E5=95=86=E5=93=81=E6=94=B9=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- process/Task.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/process/Task.php b/process/Task.php index aa10565b3..fec68c71a 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); + } + } + }); } /**