vali %!s(int64=6) %!d(string=hai) anos
pai
achega
2c865732db
Modificáronse 1 ficheiros con 30 adicións e 28 borrados
  1. 30 28
      vendor/GatewayWorker_windows/Applications/whisper/Events.php

+ 30 - 28
vendor/GatewayWorker_windows/Applications/whisper/Events.php

@@ -475,7 +475,7 @@ class Events
 
         if (!isset(self::$global->groupmap[$group])) {
             self::MySendMsg($client_id, (json_encode(['message_type' => 'reLoginErr', 'msg' => '不存在客服组....'], 256)));
-            return  true;
+            return true;
             //Gateway::closeCurrentClient();
         }
 
@@ -490,8 +490,8 @@ class Events
         if ($hisdata) {
             $hisdata = json_decode($hisdata, true);
             $oldclientid = $hisdata['client_id'];
-            self::MySendMsg($oldclientid, json_encode(['type' => 'reLoginErr', 'msg' => '相同账号登陆,本次退出'], 256));
-            self::MySendMsg($client_id, json_encode(['type' => 'reLoginErr', 'msg' => '相同账号登陆,本次退出'], 256));
+            self::MySendMsg($oldclientid, json_encode(['type' => 'reLoginErr', 'msg' => '相同账号登陆1,本次退出'], 256));
+            self::MySendMsg($client_id, json_encode(['type' => 'reLoginErr', 'msg' => '相同账号登陆2,本次退出'], 256));
             Gateway::closeClient($oldclientid);
             Gateway::closeCurrentClient();
             return;
@@ -499,7 +499,7 @@ class Events
         $last = self::UserHasOldTalk($uid);
 
         $onlinekf = self::getOnlineKfData($group, 1);
-        if (empty($onlinekf)&&empty($last)) {
+        if (empty($onlinekf) && empty($last)) {
             Gateway::sendToClient($client_id, json_encode(['message_type' => 'notice', 'content' => '暂时没有客服上班,请稍后再咨询。'], 256));
             //Gateway::closeClient($client_id);
             return;
@@ -795,7 +795,7 @@ class Events
      * @param $group
      * @param $uid
      */
-    private static function userOnlineTask($group = 0, $uid = 0, $last=[], $client_id='')
+    private static function userOnlineTask($group = 0, $uid = 0, $last = [], $client_id = '')
     {
         $allusergkarr = self::getUserListData();
         if (empty($allusergkarr)) {
@@ -823,35 +823,37 @@ class Events
                 ];
                 Gateway::sendToCurrentClient(json_encode($toOld_message, 256));
                 return;
-            } else {
-                //系统定时调用时,无组,无用户
-                foreach ($allusergkarr as $group => $gusersArr) {
-                    if (!isset($allkfgkarr[$group]) || count($allkfgkarr[$group]) <= 0) {
-                        //所属客服组无人在线
-                        continue;
-                    }
-                    $nowkfs = $allkfgkarr[$group];
-                    $count = count($nowkfs);
-                    $i = 0;
+            }
+        }
+
+
+        //系统定时调用时,无组,无用户
+        foreach ($allusergkarr as $group => $gusersArr) {
+            if (!isset($allkfgkarr[$group]) || count($allkfgkarr[$group]) <= 0) {
+                //所属客服组无人在线
+                continue;
+            }
+            $nowkfs = $allkfgkarr[$group];
+            $count = count($nowkfs);
+            $i = 0;
 
-                    foreach ($gusersArr as $user) {
-                        if ($nowkfs[$i]['task'] > $maxset) {
-                            break;
-                        }
-                        $nowkfs[$i]['task']++;
+            foreach ($gusersArr as $user) {
+                if ($nowkfs[$i]['task'] > $maxset) {
+                    break;
+                }
+                $nowkfs[$i]['task']++;
 
-                        self::BeginTalk($nowkfs[$i]['id'], $user['id'], $group, 0, $user);
-                        self::$redis->hdel(self::USERLIST, $user['id']);
+                self::BeginTalk($nowkfs[$i]['id'], $user['id'], $group, 0, $user);
+                self::$redis->hdel(self::USERLIST, $user['id']);
 
-                        $i++;
-                        if ($i >= $count) {
-                            $i = 0;
-                        }
-                    }
+                $i++;
+                if ($i >= $count) {
+                    $i = 0;
                 }
-                return;
             }
         }
+        return;
+        
     }
 
     //开启一个会话