setName('check:dispatch-tts-task') ->setDescription($this->title); } protected function execute(Input $input, Output $output){ $Model = new TtsLog(); $ttsService = new NoticeLogic(); $Model->where('status','=',0) ->chunk(100, function ($list)use($ttsService) { foreach ($list as $item) { try { $ttsService->callIt($item); }catch (Exception $exception){ $item->status = -1; $item->content = $exception->getMessage(); $item->save(); Db::name('debug_log')->insert([ 'title' => $this->title, 'content' => '错误内容:'.$exception->getMessage().',错误行:'. $exception->getLine().',错误文件:'. $exception->getFile(), 'create_time' => date('Y-m-d H:i:s', time()) ]); } echo $item->id.PHP_EOL; } }); $output->info('OVER'); } }