setName('outchildsend') ->setDescription('the outchildsend command'); } protected function execute(Input $input, Output $output) { // 指令输出 $key='outchildsend'; $rs = Cache::store('redis')->get($key); if ($rs==1)return true; Cache::store('redis')->set($key,1,3000); $date = date("Y-m-d H:i:s",time()-3600); $list = OrderOutChild::where([["addtime",">=",$date],["is_del","=",0]])->hidden(["id"])->select(); if($list->isEmpty()==false){ $Insert=[]; foreach ($list->toArray() as $item){ $isT =FhdChild::where(["outChildCode"=>$item['outChildCode']])->findOrEmpty(); if($isT->isEmpty()){ $Insert[]=$item; } if(count($Insert)>500){ FhdChild::strict(false)->insertAll($Insert); $Insert=[]; } } if(!empty($Insert))FhdChild::strict(false)->insertAll($Insert); } $output->writeln('outchildsend'); } }