From e612459ad1265042cae223c102d54919b478b755 Mon Sep 17 00:00:00 2001 From: "HESU\\HESU" <1696136552@qq.com> Date: Tue, 20 May 2025 09:28:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=9B=BE=E7=89=87=E7=BC=93?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/process/Task.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/process/Task.php b/app/process/Task.php index 1b5dcae..2f85156 100644 --- a/app/process/Task.php +++ b/app/process/Task.php @@ -19,7 +19,7 @@ class Task public function onWorkerStart() { - // 每半小时执行一次 + // 每6点执行 new Crontab('*/10 6 * * *', function(){ echo date('Y-m-d H:i:s') . "\n"; Log::info('img cache start',[time()]); @@ -33,6 +33,20 @@ class Task Log::info('img cache end',[time()]); }); + // 每9点执行 + new Crontab('*/10 9 * * *', function(){ + echo date('Y-m-d H:i:s') . "\n"; + Log::info('img cache start',[time()]); + $vehicles = Vehicle::get(); + $ossservice = new OssService(); + foreach ($vehicles as $vehicle) { + $img_url = $ossservice->generatePrivateUrl($vehicle['img_url'],86400); + Cache::set('img_dibai_'.$vehicle->id, $img_url, 86390); + } + + Log::info('img cache end',[time()]); + }); + } } \ No newline at end of file