Explorar el Código

Merge branch 'master' of http://git.bocai108.com:10180/Ethan/Customer-Service

Jonlin hace 6 años
padre
commit
5b782b55c9
Se han modificado 1 ficheros con 12 adiciones y 1 borrados
  1. 12 1
      vendor/GatewayWorker_windows/Applications/whisper/Events.php

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

@@ -405,18 +405,29 @@ class Events
                     break;
                 // 客服更改状态.
                 case 'kfOnline':
+                    if (!isset($_SESSION['iskefu']) || $_SESSION['iskefu'] != 1) {
+                        return;
+                    }
                     $kfList = self::$global->kfList;
                     $userId = $message['data']['uid'];
                     $status = $message['data']['status'];
+                    $oldstatus = '';
                     foreach ($kfList as $k => $v) {
                         foreach ($v as $ke => $va) {
                             if ($ke == $userId) {
-                                $kfList[$k][$ke]['status'] = $status;
+                                $oldstatus = $kfList[$k][$ke]['status'];
+                                if ($oldstatus != $status) {
+                                    $kfList[$k][$ke]['status'] = $status;
+                                    break 2;
+                                } else {
+                                    return;
+                                }
                             }
                         }
                     }
                     self::$global->kfList = $kfList;
                     self::writeLogKfStatus($userId, $status);
+                    Gateway::sendToCurrentClient(json_encode(['message_type' => 'cgstatus', 'data' => ['new_status' => $status, 'old_status' => $oldstatus]]));
 
                     break;
                 case 'changeOtherhKeFu';