setName('excel_export')->setDescription('表格导出'); } protected function execute(Input $input, Output $output) { set_time_limit(180); ini_set('memory_limit', '1024M'); try { Export::where('generate_status',0)->where('createtime','<',(time()-86400*2))->delete(); $result = Export::where('generate_status',0)->findOrEmpty(); if(!$result->isEmpty()){ (new ExcelExportService)->download($result->id,true); } return true; } catch (\Exception $e) { Log::write('ExcelExport:'.$e->getMessage()); return $e->getMessage(); } } }