setName('mobile:export'); } protected function execute(Input $input, Output $output) { if(MobileExportLog::where('status',1)->find()){ return; } $export=MobileExportLog::where('status',0)->find(); if(!$export){ return; } $export['status']=1; $export->save(); try { $list=Db::query($export['sql']); $listCount=count($list); self::log("【{$export['id']}】共{$listCount}条数据"); MobileExportCsv::export($list,$export); }catch (\Exception $e){ Db::rollback(); $export['status']=3; $export->save(); self::logError($e); } } }