setName('license') ->setDescription('the license command'); } protected function execute(Input $input, Output $output) { // 指令输出 $data=$this->getdata(); $ocr =new Ocr(); foreach ($data as $value){ $datwa = $ocr->query("",$value['license_img']); if($datwa['code']==0 && isset($datwa['data']['result'])){ $license = $datwa['data']['result']; $value['legaler']= isset($license['legal_representative'])?$license['legal_representative']:""; $value['addr']= isset($license['address'])?$license['address']:""; $value['registertime']= isset($license['found_date'])? $license['found_date']:""; $value['scope']= isset($license['business_scope'])?$license['business_scope']:""; $value['capital']= isset($license['registered_capital'])?$license['registered_capital']:""; $value['nature']= isset($license['type'])?$license['type']:""; $value['registercode']= isset($license['registration_number'])?$license['registration_number']:""; $value['status']=1; $value['ocr_status']=1; }else{ $value['remark']="营业执照识别失败"; $value['status']=0; $value['ocr_status']=2; } Db::name("supplier")->save($value); } $output->writeln('license'); } public function getdata(){ $sql = Db::name("supplier")->where(["ocr_status"=>2])->select(); return $sql; } }