浏览代码

'修改组概念'

Ethan 6 年之前
父节点
当前提交
ce6a16ae30
共有 3 个文件被更改,包括 28 次插入5 次删除
  1. 2 1
      application/config.php
  2. 3 3
      application/redis.php
  3. 23 1
      vendor/GatewayWorker_windows/Applications/whisper/Events.php

+ 2 - 1
application/config.php

@@ -21,7 +21,7 @@ return [
     'salt' => '~NickBai!@#',
 
     // socket server
-    'socket' => '192.168.2.168:9101',
+    'socket' => '192.168.2.187:9101',
 
     // 管理员登录时间
     'save_time' => 86400,
@@ -34,6 +34,7 @@ return [
         'expire' => 0,
     ],
 
+
     // 应用命名空间
     'app_namespace' => 'app',
     // 应用调试模式

+ 3 - 3
application/redis.php

@@ -7,9 +7,9 @@
  */
 
 return [
-    'host' => '192.168.2.200',
+    'host' => '192.168.2.220',
     'port' => 26379,
-    'passwd' => '',
+    'passwd' => '123456',
     'db' => 1,
     'overtime' => 1,
-];
+];

+ 23 - 1
vendor/GatewayWorker_windows/Applications/whisper/Events.php

@@ -208,13 +208,16 @@ class Events
                 case 'updateusercache':
                     //更新用户缓存信息
                     self::updateusercache($client_id, $message['data']);
+                // 客服更改状态.
+                case 'joinServiceGroup':
+                    //后台更改了数据,sock里的缓存强制更新一下,做到即时更新的效果
+                    self::joinServiceGroup($client_id, $message['data']);
                     break;
             }
         }
         return true;
     }
 
-
     //更新用户缓存信息
     public static function updateusercache($client_id, $dataArray)
     {
@@ -222,6 +225,25 @@ class Events
         self::getUserInfoCache($uid, 180, 0);
     }
 
+    //加入工单群组(未完)
+    public static function joinServiceGroup($client_id, $message) {
+        $uid = $message['uid'];
+        $serviceLogId = $message['conversationId'];
+        $userInfo = self::$db->select('user_overview')->from('ws_users')->where('id=:id')->bindValues(['id' => $uid])->row();
+        if ($userInfo[0]['user_overview'] !== 1) {
+            $chat_message = [
+                'message_type' => 'error',
+                'data' => [
+                    'flag' => 1,
+                    'msg' => '取消排队成功!'
+                ]
+            ];
+            Gateway::sendToCurrentClient(json_encode($chat_message, 256));
+            return;
+        }
+        Gateway::joinGroup($client_id, $serviceLogId);
+    }
+
     //强制更新缓存信息
     public static function updatecache($client_id, $dataArray)
     {