vali 6 년 전
부모
커밋
33c7f11a99

+ 5 - 3
vendor/GatewayWorker_linux/GatewayWorker/Applications/whisper/Events.php

@@ -241,6 +241,7 @@ class Events
     public static function kfzdclose($client_id, $datas)
     {
         Gateway::closeClient($client_id);
+        $_SESSION['kfzdclose'] = 1;
         return;
     }
 
@@ -743,8 +744,7 @@ class Events
     }
 
 //客服登陆验证
-    public
-    static function KfloginCheck($client, $messageArray)
+    public static function KfloginCheck($client, $messageArray)
     {
         $uid = isset($messageArray['uid']) ? $messageArray['uid'] : '';
         $token = isset($messageArray['token']) ? $messageArray['token'] : '';
@@ -941,7 +941,9 @@ class Events
             echo date("Y-m-d H:i:s") . ' - ' . "客服发生异常退出." . print_r([$client_id, $uid, $group, $uinfo], true) . "\n";
             return;
         }
-        self::$db->update('ws_users')->cols(['token' => uniqid()])->where('id=' . self::getkfid($uid))->query();
+        if (isset($_SESSION['kfzdclose']) && $_SESSION['kfzdclose']==1 ){
+            self::$db->update('ws_users')->cols(['token' => uniqid()])->where('id=' . self::getkfid($uid))->query();
+        }
 
         $user_info = self::$redis->hgetall(self::getKfServiceKey($uid));
         if (!empty($user_info)) {

+ 1 - 1
vendor/GatewayWorker_linux/GatewayWorker/Applications/whisper/start_gateway.php

@@ -86,7 +86,7 @@ $gateway->onConnect = function ($connection) {
             $connection->close();
             return;
         }
-        $_SESSION['remotip'] = $connection->getRemoteIp();
+        $_SESSION['remotip'] = isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $connection->getRemoteIp();
         $_SESSION['remotport'] = $connection->getRemotePort();
 
 

+ 5 - 3
vendor/GatewayWorker_windows/Applications/whisper/Events.php

@@ -241,6 +241,7 @@ class Events
     public static function kfzdclose($client_id, $datas)
     {
         Gateway::closeClient($client_id);
+        $_SESSION['kfzdclose'] = 1;
         return;
     }
 
@@ -743,8 +744,7 @@ class Events
     }
 
 //客服登陆验证
-    public
-    static function KfloginCheck($client, $messageArray)
+    public static function KfloginCheck($client, $messageArray)
     {
         $uid = isset($messageArray['uid']) ? $messageArray['uid'] : '';
         $token = isset($messageArray['token']) ? $messageArray['token'] : '';
@@ -941,7 +941,9 @@ class Events
             echo date("Y-m-d H:i:s") . ' - ' . "客服发生异常退出." . print_r([$client_id, $uid, $group, $uinfo], true) . "\n";
             return;
         }
-        self::$db->update('ws_users')->cols(['token' => uniqid()])->where('id=' . self::getkfid($uid))->query();
+        if (isset($_SESSION['kfzdclose']) && $_SESSION['kfzdclose']==1 ){
+            self::$db->update('ws_users')->cols(['token' => uniqid()])->where('id=' . self::getkfid($uid))->query();
+        }
 
         $user_info = self::$redis->hgetall(self::getKfServiceKey($uid));
         if (!empty($user_info)) {

+ 1 - 1
vendor/GatewayWorker_windows/Applications/whisper/start_gateway.php

@@ -85,7 +85,7 @@ $gateway->onConnect = function ($connection) {
             $connection->close();
             return;
         }
-        $_SESSION['remotip'] = $connection->getRemoteIp();
+        $_SESSION['remotip'] = isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $connection->getRemoteIp();
         $_SESSION['remotport'] = $connection->getRemotePort();