|
|
@@ -144,20 +144,25 @@ class Message extends BaseModel
|
|
|
|
|
|
// 机器人自动回复问题推送给用户
|
|
|
if ($is_robot && $param['type'] == 'text') {
|
|
|
- //获取关键词匹配
|
|
|
- $keyword_ids = KeywordLanguages::getKeywordByContent($param['content']);
|
|
|
- $question = QuestionLanguages::getQuestion($keyword_ids, $param['content']);
|
|
|
- $data['question'] = $question;
|
|
|
- if ($question) {
|
|
|
- $param['type'] = 'list';
|
|
|
- $content = [
|
|
|
- 'title' => Config::where('field','reply_keyword')->value('val'),
|
|
|
- 'list' => $question,
|
|
|
- ];
|
|
|
- $param['content'] = json_encode($content);
|
|
|
- } else {
|
|
|
+ if (!empty($param['question_id'])) {
|
|
|
$param['type'] = 'text';
|
|
|
- $param['content'] = Config::where('field','reply_keyword_math_fail')->value('val');
|
|
|
+ $param['content'] = QuestionLanguages::where('id', $param['question_id'])->value('answer');
|
|
|
+ } else {
|
|
|
+ //获取关键词匹配
|
|
|
+ $keyword_ids = KeywordLanguages::getKeywordByContent($param['content']);
|
|
|
+ $question = QuestionLanguages::getQuestion($keyword_ids, $param['content']);
|
|
|
+ $data['question'] = $question;
|
|
|
+ if ($question) {
|
|
|
+ $param['type'] = 'list';
|
|
|
+ $content = [
|
|
|
+ 'title' => Config::where('field','reply_keyword')->value('val'),
|
|
|
+ 'list' => $question,
|
|
|
+ ];
|
|
|
+ $param['content'] = json_encode($content);
|
|
|
+ } else {
|
|
|
+ $param['type'] = 'text';
|
|
|
+ $param['content'] = Config::where('field','reply_keyword_math_fail')->value('val');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$fromUserId = (int)$param['toContactId'];
|