作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

@@ -87,21 +87,28 @@ class postInquiry extends Command @@ -87,21 +87,28 @@ class postInquiry extends Command
87 87
88 if($val['type'] == 1){ 88 if($val['type'] == 1){
89 $this->visit($detail, $val); 89 $this->visit($detail, $val);
  90 +
  91 + $init_num = ReInquiryDetailLog::where('detail_id', $val['detail_id'])->where('status', ReInquiryDetailLog::STATUS_INIT)->count();
  92 + if(!$init_num){
  93 + //转发详情
  94 + $detail->status = ReInquiryDetail::STATUS_SUCCESS;
  95 + $detail->result = $val['url'];
  96 + $detail->save();
  97 + }
90 }else{ 98 }else{
91 - $this->inquiry($detail, $val);  
92 - } 99 + $res = $this->inquiry($detail, $val);
93 100
94 - $init_num = ReInquiryDetailLog::where('detail_id', $val['detail_id'])->where('status', ReInquiryDetailLog::STATUS_INIT)->count();  
95 - if(!$init_num){  
96 //转发详情 101 //转发详情
97 - $detail->status = ReInquiryDetail::STATUS_SUCCESS; 102 + $detail->status = $res ? ReInquiryDetail::STATUS_SUCCESS : ReInquiryDetail::STATUS_FAIL;
98 $detail->result = $val['url']; 103 $detail->result = $val['url'];
99 $detail->save(); 104 $detail->save();
100 //转发表单 105 //转发表单
101 - $form = ReInquiryForm::find($detail['form_id']);  
102 - $form->success_num = $form->success_num + 1;  
103 - $form->save();  
104 - Log::channel('inquiry_relay')->info('询盘成功:',[$detail['form_id'], $val->id, getmypid()]); 106 + if($res){
  107 + $form = ReInquiryForm::find($detail['form_id']);
  108 + $form->success_num = $form->success_num + 1;
  109 + $form->save();
  110 + Log::channel('inquiry_relay')->info('询盘成功:',[$detail['form_id'], $val->id, getmypid()]);
  111 + }
105 } 112 }
106 }catch (\Exception $e){ 113 }catch (\Exception $e){
107 Log::channel('inquiry_relay')->error('inquiry_relay handle error', [$e->getMessage(), $e->getFile(), $e->getLine()]); 114 Log::channel('inquiry_relay')->error('inquiry_relay handle error', [$e->getMessage(), $e->getFile(), $e->getLine()]);