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