retry > 0) { $lg_success = Lg::find()->where(['id' => $this->id,'store_id'=>$this->store_id,'is_delete'=>0,'status'=>1])->one(); if (!$lg_success){ $queue_id = \queue_push(new LgApplyJob(['id'=>$this->id,'store_id'=>$this->store_id,'retry' => $this->retry--]), 60); } } try { /** * 查询待进件成功的记录 */ $lgApi = new LgApi($this->store_id); $lg = Lg::find()->where(['id' => $this->id,'store_id'=>$this->store_id,'is_delete'=>0]) ->andWhere(['status'=>0]) ->one(); if ($lg){ $post_data = []; $post_data['certCard'] = $lg['cert_card'];//身份证号 $res = $lgApi->FlexibleQuery($post_data); //审核中 if ($res[0]['status'] == 100 || $res[0]['status'] == 200){ $lg->status = 0; $lg->updated_at = time(); $lg->save(); } //成功 if ($res[0]['status'] == 300){ $lg->status = 1; $lg->updated_at = time(); $lg->save(); } //失败 if ($res[0]['status'] == 999){ $lg->status = 2; $lg->updated_at = time(); $lg->refuse_desc = $res['msg']; $lg->save(); } } } catch(\Exception $e) { debug_log('--------auto-lg-apply-error---- '.$this->id.' ----auto-lg-apply-error--------' . $e->getMessage() . $e->getFile() . $e->getLine()); } if (isset($queue_id) && !\Yii::$app->queue->isDone($queue_id)) { \Yii::$app->queue->remove($queue_id); } } }