setName('execpush') ->setDescription('the execpush command'); } protected function execute(Input $input, Output $output) { $key = Cache::store("redis")->handler()->get("reportKey"); if($key==1) return ''; Cache::store("redis")->handler()->set("reportKey",1,180); $list =Db::name("exec_log")->where([["expiretime","<=",date("Y-m-d H:i:s")],["status","=",1],["is_del","=", 0]])->select()->toArray(); if(!empty($list)){ foreach ($list as $value){ Cache::store("redis")->handler()->lpush("Reportexec",json_encode($value,JSON_UNESCAPED_UNICODE)); Db::name("exec_log")->where($value)->update(["status"=>4,"updatetime"=>date("Y-m-d H:i:s")]); $date=date("Y-m-d H:i:s"); $output->writeln("[{$date}] 脚本记录{$value['id']}放入待执行中"); } } Cache::store("redis")->handler()->set("reportKey",0); } }