作者 赵彬吉

update

@@ -352,18 +352,21 @@ class RelayInquiry extends Command @@ -352,18 +352,21 @@ class RelayInquiry extends Command
352 $country_name = $ip_data->ip_area; 352 $country_name = $ip_data->ip_area;
353 353
354 $this->output('转发内容'); 354 $this->output('转发内容');
355 - // 推送消息 消息内容小于10个字符, 使用内置询盘内容  
356 - $message = $form->message;  
357 - $message_id = 0; 355 +
358 // 通过字符数量区分, 改成完全获取内置询盘内容 356 // 通过字符数量区分, 改成完全获取内置询盘内容
359 - if (true) {  
360 - $use_ids = ReInquiryDetail::where(['re_website' => $domain])->where('status', '<>', ReInquiryDetail::STATUS_FAIL)->pluck('text_id')->toArray();  
361 - $text = ReInquiryText::whereNotIn('id', $use_ids)->where('status', ReInquiryText::STATUS_USABLE)->inRandomOrder()->first();  
362 - $message = $text->content;  
363 - $message_id = $text->id;  
364 - // 获取后,使用次数+1  
365 - $text->use_time += 1;  
366 - $text->save(); 357 + $use_ids = ReInquiryDetail::where(['re_website' => $domain])->where('status', '<>', ReInquiryDetail::STATUS_FAIL)->pluck('text_id')->toArray();
  358 + $text = ReInquiryText::whereNotIn('id', $use_ids)->where('status', ReInquiryText::STATUS_USABLE)->inRandomOrder()->first();
  359 + $message = $text->content;
  360 + $message_id = $text->id;
  361 + // 获取后,使用次数+1
  362 + $text->use_time += 1;
  363 + $text->save();
  364 +
  365 + //原内容非英语,转为对应语种
  366 + $translateSl = Translate::translateSl($form->message);
  367 + $lang = $translateSl['texts']['sl'] ?? 'en';
  368 + if($lang != 'en'){
  369 + $message = Translate::tran($message, $lang);
367 } 370 }
368 371
369 $this->output('获取转发设备信息'); 372 $this->output('获取转发设备信息');
@@ -175,7 +175,7 @@ class postInquiry extends Command @@ -175,7 +175,7 @@ class postInquiry extends Command
175 ]; 175 ];
176 176
177 $res = Http::withoutVerifying()->post('https://form.globalso.com/api/external-interface/add/fa043f9cbec6b38f', $data)->json(); 177 $res = Http::withoutVerifying()->post('https://form.globalso.com/api/external-interface/add/fa043f9cbec6b38f', $data)->json();
178 - if(empty($res['data'][0]['code']) || $res['data'][0]['code'] != 200){ 178 + if(empty($res['data'][0]['code']) || !in_array($res['data'][0]['code'], [200,300])){
179 $log->status = ReInquiryDetailLog::STATUS_FAIL; 179 $log->status = ReInquiryDetailLog::STATUS_FAIL;
180 $log->remark = $res['message'] ?? ''; 180 $log->remark = $res['message'] ?? '';
181 $log->save(); 181 $log->save();