|
...
|
...
|
@@ -338,7 +338,7 @@ class RelayInquiry extends Command |
|
|
|
$re_website = 'https://' . $domain . '/';
|
|
|
|
|
|
|
|
//urls
|
|
|
|
list($urls, $lang) = $this->getUrls($is_v6, $domain, $re_website, $form, $task);
|
|
|
|
list($urls, $lang, $inquiry_product_url) = $this->getUrls($is_v6, $domain, $re_website, $form, $task);
|
|
|
|
if(!$urls){
|
|
|
|
continue;
|
|
|
|
}
|
|
...
|
...
|
@@ -349,7 +349,7 @@ class RelayInquiry extends Command |
|
|
|
$country_name = $ip_data->ip_area;
|
|
|
|
|
|
|
|
//message
|
|
|
|
list($message, $message_id, $msg_lang) = $this->getMessage($task, $form->message, $domain);
|
|
|
|
list($message, $message_id, $msg_lang) = $this->getMessage($task, $form->message, $domain, $inquiry_product_url);
|
|
|
|
$lang = $lang ?: $msg_lang;
|
|
|
|
|
|
|
|
$this->output('获取转发设备信息');
|
|
...
|
...
|
@@ -406,6 +406,7 @@ class RelayInquiry extends Command |
|
|
|
$ip_data = $this->getIpData($form->country_name);
|
|
|
|
$ip = $ip_data->ip;
|
|
|
|
$country_name = $ip_data->ip_area;
|
|
|
|
|
|
|
|
//message
|
|
|
|
list($message, $message_id, $lang) = $this->getMessage($task, $form->message, $domain);
|
|
|
|
|
|
...
|
...
|
@@ -477,7 +478,7 @@ class RelayInquiry extends Command |
|
|
|
return $ip_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getMessage($task, $message, $domain){
|
|
|
|
public function getMessage($task, $message, $domain, $inquiry_product_url = ''){
|
|
|
|
$this->output('转发内容');
|
|
|
|
$form_message = $message;
|
|
|
|
$message_id = 0;
|
|
...
|
...
|
@@ -486,7 +487,7 @@ class RelayInquiry extends Command |
|
|
|
//AI生成
|
|
|
|
$error = 0;
|
|
|
|
while ($error<3){
|
|
|
|
$message = $this->ai_send($task['ai_param'], $message);
|
|
|
|
$message = $this->ai_send($task['ai_param'], $message, $inquiry_product_url);
|
|
|
|
if(!$message){
|
|
|
|
$this->output('AI文案生成失败');
|
|
|
|
$error++;
|
|
...
|
...
|
@@ -580,7 +581,13 @@ class RelayInquiry extends Command |
|
|
|
$urls[] = Arr::random($inquiry_urls);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return [$urls, $lang];
|
|
|
|
//着陆页是否是产品页面或产品列表页
|
|
|
|
$inquiry_product_url = '';
|
|
|
|
if(in_array(Arr::last($urls), $product_url) || in_array(Arr::last($urls), $product_cate_url)){
|
|
|
|
$inquiry_product_url = Arr::last($urls);
|
|
|
|
}
|
|
|
|
|
|
|
|
return [$urls, $lang, $inquiry_product_url];
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* 获取待处理询盘表单
|
|
...
|
...
|
@@ -693,7 +700,7 @@ class RelayInquiry extends Command |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ai_send($ai_param, $incontent)
|
|
|
|
public function ai_send($ai_param, $incontent, $inquiry_product_url)
|
|
|
|
{
|
|
|
|
$ai_command = AiCommand::where('key', 'fb_inquiry_text')->value('ai');
|
|
|
|
if (!$ai_command) {
|
|
...
|
...
|
@@ -707,6 +714,16 @@ class RelayInquiry extends Command |
|
|
|
}else{
|
|
|
|
$language = Translate::getTls($lang);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//着陆页是否是产品页面或产品列表页
|
|
|
|
if($inquiry_product_url){
|
|
|
|
$title = Common::getUrlTitle($inquiry_product_url);
|
|
|
|
if($title){
|
|
|
|
$ai_command = str_replace('{mkeywords}', $title, $ai_command);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$ai_command = str_replace('{mkeywords}', Arr::random(explode("\r\n", $ai_param['mkeywords'])), $ai_command);
|
|
|
|
$ai_command = str_replace('{incontent}', Arr::random(explode("\r\n", $incontent)), $ai_command);
|
|
|
|
$ai_command = str_replace('{characters}', Arr::random(explode("\r\n", $ai_param['characters'])), $ai_command);
|
...
|
...
|
|