作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into master-server

... ... @@ -108,7 +108,13 @@ class InquiryForwardLogic extends BaseLogic
try {
$num = 0;
$now = date('Y-m-d H:i:s');
foreach ($this->param['forward_url'] as $url) {
if (is_array($this->param['forward_url'])) {
$forward_url = $this->param['forward_url'];
} else {
$forward_url = explode(',', $this->param['forward_url']);
}
foreach ($forward_url as $url) {
$url = trim($url);
$domain_array = parse_url($url);
$website = $domain_array['host'] ?? '';
if (!$website) {
... ... @@ -183,7 +189,7 @@ class InquiryForwardLogic extends BaseLogic
} catch (\Exception $e) {
DB::rollback();
Log::error('inquiry_forward error:' . $e->getMessage());
@file_put_contents(storage_path('logs/lk_error.log'), $e->getMessage());
$this->fail('转发询盘失败');
}
... ... @@ -284,12 +290,23 @@ class InquiryForwardLogic extends BaseLogic
*/
public function aiRewrite()
{
$ai_command = AiCommand::where('key', 'inquiry_text_rewrite')->value('ai');
if (!$ai_command) {
$ai_info = AiCommand::select(['ai', 'not_use_probability'])->where('key', 'inquiry_text_rewrite')->first();
if (!$ai_info) {
$this->fail('AI重写指令未配置');
}
$ai_command = $ai_info['ai'];
$not_use_probability = $ai_info['not_use_probability'];
$in_content = $this->param['message'];
// 当原始询盘内容长度大于15个字符, 60%几率直接发送原始内容。
if (strlen($in_content) >= 15) {
$randomNumber = rand(0, 100);
if ($randomNumber < $not_use_probability) {
return $this->success(['ai_message' => $in_content]);
}
}
$translateSl = Translate::translateSl($in_content);
$lang = $translateSl['texts']['sl'] ?? 'en';
if ($lang == 'en' || $lang == 'ja' || $lang == 'ko' || Str::contains($lang, 'zh')) {
... ...