vali 6 年之前
父节点
当前提交
1253679508
共有 1 个文件被更改,包括 16 次插入1 次删除
  1. 16 1
      vendor/GatewayWorker_windows/Applications/whisper/Events.php

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

@@ -475,12 +475,25 @@ class Events
         self::KFStatusCg($client_id, ['data' => ['uid' => $uid, 'status' => 1]]);
 
         self::SendKFHistoryRecord($client_id, $uid);
+        self::updateWebsockName($client_id, $uid);
+
         echo date("Y-m-d H:i:s") . ' - ' . '客服上线-' . $message['name'] . "\n";
 
         return;
     }
 
 
+    //连接信息里保存用户,以便观察
+    private static function updateWebsockName($client_id, $uid)
+    {
+        $info = json_decode(self::$redis->hget(self::WEBSOCKALLUSER, $client_id), true);
+        if ($info) {
+            $info['name'] = strval($uid);
+            self::$redis->hset(self::WEBSOCKALLUSER, $client_id, json_encode($info, 256));
+        }
+        return true;
+    }
+
     //客服掉线后 历史聊天记录
     private static function SendKFHistoryRecord($client_id, $userId)
     {
@@ -645,6 +658,8 @@ class Events
         Gateway::bindUid($client_id, $uid);
         $_SESSION['iskefu'] = 0;
         $_SESSION['uid'] = $message['uid'];
+        self::updateWebsockName($client_id, $uid);
+
 
         // 尝试分配新会员进入服务
         self::userOnlineTask($group, $uid, $last, $client_id);
@@ -699,7 +714,7 @@ class Events
                 self::MySendMsg($val, json_encode(['message_type' => 'serviceoffline', 'msg' => '客服人员下线!'], 256));
             }
         }
-        echo date("Y-m-d H:i:s") . ' - ' . "客服退出: " . $uid . "\n";
+        //echo date("Y-m-d H:i:s") . ' - ' . "客服退出: " . $uid . "\n";
         self::writeLogKfStatus($uid, 0);
         return;
     }