lizhen_gitee 1 год назад
Родитель
Сommit
1d2173fc18
1 измененных файлов с 20 добавлено и 8 удалено
  1. 20 8
      application/api/controller/Party.php

+ 20 - 8
application/api/controller/Party.php

@@ -1009,6 +1009,15 @@ class Party extends Api
         // 扣除在线用户在房间情况
         $this->redis->hDel("livingUser", $this->auth->id);
 
+        //下麦
+        $key = "party_seat_".$party_id;
+        $seats = $this->redis->hGetAll($key);
+        foreach($seats as $seat_num => $seatuserid){
+            if($seatuserid == $userId){
+                $this->redis->HDel($key, $seat_num);
+            }
+        }
+
         // 更新房间在线状态
         $partyInfo = $this->redis->get($this->roomTypeArr[$room_type].'_'.$party_id);
         if ($partyInfo) {
@@ -1027,14 +1036,7 @@ class Party extends Api
             ];
             $easemob->room_setRoomCustomAttributeForced($partyInfo['easemob_room_id'],$partyInfo['user_id'],$matedata);
 
-            //下麦
-            $key = "party_seat_".$party_id;
-            $seats = $this->redis->hGetAll($key);
-            foreach($seats as $seat_num => $seatuserid){
-                if($seatuserid == $userId){
-                    $this->redis->HDel($key, $seat_num);
-                }
-            }
+
 
             //清除这个人点的歌,前台自己处理了
             /*$easemob_room_id = $partyInfo['easemob_room_id'];
@@ -2442,6 +2444,16 @@ class Party extends Api
             $this->error('麦上有人了');
         }
 
+        //轮询下麦
+        $key = "party_seat_".$party_id;
+        $seats = $this->redis->hGetAll($key);
+        foreach($seats as $seat_num => $seatuserid){
+            if($seatuserid == $userId){
+                $this->redis->HDel($key, $seat_num);
+            }
+        }
+
+        //上麦
         $this->redis->hSet($key,$seat_num,$userId);
 
         //获取魅力值