vali 6 years ago
parent
commit
53145d2189
1 changed files with 17 additions and 1 deletions
  1. 17 1
      vendor/GatewayWorker_windows/Applications/whisper/Events.php

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

@@ -372,7 +372,10 @@ class Events
                     self::serverClose($client['0']);
                 }
                 break;
+            // default:
+            //    Gateway::closeClient($client_id);
         }
+
     }
 
     /**
@@ -404,9 +407,22 @@ class Events
         $group = $_SESSION['group'];
         $kefuinfo_old = $kefuinfo_old_new = self::$global->kfList;
         $user_info = $kefuinfo_old_new[$group][$uid]['user_info'];
+
+        $simpliUsers = self::$global->uidSimpleList;
+        $simpliUsersID_UID_Arr = [];
+        if (!empty($simpliUsers)) {
+            foreach ($simpliUsers as $key => $val) {
+                $simpliUsersID_UID_Arr[$val['0']] = $key;
+            }
+        }
+
+        $now = time();
         if (!empty($user_info)) {
             foreach ($user_info as $val) {
                 Gateway::sendToClient($val, json_encode(['type' => 'serviceoffline', 'msg' => '客户人员下线!'], 256));
+                if (isset($simpliUsersID_UID_Arr[$val])) {
+                    self::$db->query("update `ws_service_log` set `status` = '2',end_time=$now  where `user_id`= '$simpliUsersID_UID_Arr[$val]' and  kf_id='$uid' and  group_id=$group  and  `status`!=2 ");
+                }
                 Gateway::closeClient($val);
             }
         }
@@ -483,7 +499,7 @@ class Events
                                 'time' => date('H:i'),
                             ]
                         ];
-                        self::$db->query("update `ws_service_log` set `status` = '3' where `user_id`= '$uid' and  kf_id='$kfuid' and  group_id=$kfgroup  and  status!=3 ");
+                        self::$db->query("update `ws_service_log` set `status` = '3' where `user_id`= '$uid' and  kf_id='$kfuid' and  group_id=$kfgroup  and  status=1 ");
                         Gateway::sendToClient($krclient_id, json_encode($chat_message, 256));
                     }
                 }