Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into master-server
正在显示
1 个修改的文件
包含
21 行增加
和
4 行删除
| @@ -108,7 +108,13 @@ class InquiryForwardLogic extends BaseLogic | @@ -108,7 +108,13 @@ class InquiryForwardLogic extends BaseLogic | ||
| 108 | try { | 108 | try { |
| 109 | $num = 0; | 109 | $num = 0; |
| 110 | $now = date('Y-m-d H:i:s'); | 110 | $now = date('Y-m-d H:i:s'); |
| 111 | - foreach ($this->param['forward_url'] as $url) { | 111 | + if (is_array($this->param['forward_url'])) { |
| 112 | + $forward_url = $this->param['forward_url']; | ||
| 113 | + } else { | ||
| 114 | + $forward_url = explode(',', $this->param['forward_url']); | ||
| 115 | + } | ||
| 116 | + foreach ($forward_url as $url) { | ||
| 117 | + $url = trim($url); | ||
| 112 | $domain_array = parse_url($url); | 118 | $domain_array = parse_url($url); |
| 113 | $website = $domain_array['host'] ?? ''; | 119 | $website = $domain_array['host'] ?? ''; |
| 114 | if (!$website) { | 120 | if (!$website) { |
| @@ -183,7 +189,7 @@ class InquiryForwardLogic extends BaseLogic | @@ -183,7 +189,7 @@ class InquiryForwardLogic extends BaseLogic | ||
| 183 | } catch (\Exception $e) { | 189 | } catch (\Exception $e) { |
| 184 | DB::rollback(); | 190 | DB::rollback(); |
| 185 | 191 | ||
| 186 | - Log::error('inquiry_forward error:' . $e->getMessage()); | 192 | + @file_put_contents(storage_path('logs/lk_error.log'), $e->getMessage()); |
| 187 | $this->fail('转发询盘失败'); | 193 | $this->fail('转发询盘失败'); |
| 188 | } | 194 | } |
| 189 | 195 | ||
| @@ -284,12 +290,23 @@ class InquiryForwardLogic extends BaseLogic | @@ -284,12 +290,23 @@ class InquiryForwardLogic extends BaseLogic | ||
| 284 | */ | 290 | */ |
| 285 | public function aiRewrite() | 291 | public function aiRewrite() |
| 286 | { | 292 | { |
| 287 | - $ai_command = AiCommand::where('key', 'inquiry_text_rewrite')->value('ai'); | ||
| 288 | - if (!$ai_command) { | 293 | + $ai_info = AiCommand::select(['ai', 'not_use_probability'])->where('key', 'inquiry_text_rewrite')->first(); |
| 294 | + if (!$ai_info) { | ||
| 289 | $this->fail('AI重写指令未配置'); | 295 | $this->fail('AI重写指令未配置'); |
| 290 | } | 296 | } |
| 291 | 297 | ||
| 298 | + $ai_command = $ai_info['ai']; | ||
| 299 | + $not_use_probability = $ai_info['not_use_probability']; | ||
| 292 | $in_content = $this->param['message']; | 300 | $in_content = $this->param['message']; |
| 301 | + | ||
| 302 | + // 当原始询盘内容长度大于15个字符, 60%几率直接发送原始内容。 | ||
| 303 | + if (strlen($in_content) >= 15) { | ||
| 304 | + $randomNumber = rand(0, 100); | ||
| 305 | + if ($randomNumber < $not_use_probability) { | ||
| 306 | + return $this->success(['ai_message' => $in_content]); | ||
| 307 | + } | ||
| 308 | + } | ||
| 309 | + | ||
| 293 | $translateSl = Translate::translateSl($in_content); | 310 | $translateSl = Translate::translateSl($in_content); |
| 294 | $lang = $translateSl['texts']['sl'] ?? 'en'; | 311 | $lang = $translateSl['texts']['sl'] ?? 'en'; |
| 295 | if ($lang == 'en' || $lang == 'ja' || $lang == 'ko' || Str::contains($lang, 'zh')) { | 312 | if ($lang == 'en' || $lang == 'ja' || $lang == 'ko' || Str::contains($lang, 'zh')) { |
-
请 注册 或 登录 后发表评论