setName('updateact') ->setDescription('the updateact command'); } protected function execute(Input $input, Output $output) { // 指令输出 if(Cache::get('createPro2')==1) return; Cache::set('createPro2',1,60); $actGood=new \app\txx\model\ActGood();//同步券码 $actGood->startTrans(); try{ $info = $actGood->with(['act','promocode']) ->where(['version'=>'2.0','status'=>2,'is_del'=>0])->order("updatetime asc")->findOrEmpty(); if(!$info->isEmpty()){ if($info->promocode_status==0){ $info->updatetime=date("Y-m-d H:i:s"); $info->save(); }elseif($info->promocode_status==1){ $info->status=3; $info->save(); }else{ $info->status=5; $info->remark=$info->promocode_remark; $info->save(); } } $actGood->commit(); }catch (\Exception $e){ $actGood->rollback(); $output->writeln(''.$e->getMessage().''); } Cache::set('createPro2',0); } }