作者 赵彬吉

update

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