Browse Source

'系统欢迎语设置'

Ethan 6 years ago
parent
commit
4ee186a20b
1 changed files with 10 additions and 6 deletions
  1. 10 6
      vendor/GatewayWorker_windows/Applications/whisper/Events.php

+ 10 - 6
vendor/GatewayWorker_windows/Applications/whisper/Events.php

@@ -86,15 +86,15 @@ class Events
     public static function onConnect($client_id)
     {
         // 检测是否开启自动应答
-        $sayHello = self::$global->replay['1'];
-        if (!empty($sayHello) && 1 == $sayHello['status']) {
+        $sayHello = self::$global->systemReplay;
+        if (!empty($sayHello)) {
 
             $hello = [
                 'message_type' => 'helloMessage',
                 'data' => [
                     'name' => '智能助手',
                     'time' => date('H:i'),
-                    'content' => $sayHello['word']
+                    'content' => $sayHello
                 ]
             ];
             Gateway::sendToClient($client_id, json_encode($hello, 256));
@@ -1027,7 +1027,7 @@ class Events
         ];
         self::MySendMsg($userInfo['client_id'], json_encode($noticeUser, 256));
 
-        $sayHello = (self::$global->replay)['2'];
+        $sayHello = (self::$global->kfReplay)[0];
         if (!empty($sayHello) && 1 == $sayHello['status'] && !$isChangeKF) {
             $chat_message = [
                 'message_type' => 'chatMessage',
@@ -1404,9 +1404,13 @@ class Events
         }
 
         $arr = [];
-        $systemReplay = self::$db->query('select * from `ws_reply` where `type`=1');
+        $systemReplay = self::$db->query('select * from `ws_reply` where `type`=1 order by `sort`');
         $kfReplay = self::$db->query('select * from `ws_reply` where `type`=2');
-        self::$global->systemReplay = $systemReplay;
+        $systemWelcome = [];
+        foreach ($systemReplay as $v) {
+            $systemWelcome[] = htmlspecialchars_decode($v['word']);
+        }
+        self::$global->systemReplay = $systemWelcome;
         self::$global->kfReplay = $kfReplay;
 
         $arr = [];