浏览代码

下麦优化

lizhen_gitee 1 年之前
父节点
当前提交
8cf305593d
共有 1 个文件被更改,包括 12 次插入2 次删除
  1. 12 2
      application/api/controller/Party.php

+ 12 - 2
application/api/controller/Party.php

@@ -2473,10 +2473,20 @@ class Party extends Api
     //下麦
     //下麦
     public function seat_down(){
     public function seat_down(){
         $party_id = input("party_id");// 派对ID
         $party_id = input("party_id");// 派对ID
-        $seat_num = input('seat_num',0);//麦位数字0-7
+        $userId   = input("user_id", 0);// 用户ID
 
 
+        /*$seat_num = input('seat_num',0);//麦位数字0-7
         $key = "party_seat_".$party_id;
         $key = "party_seat_".$party_id;
-        $this->redis->HDel($key, $seat_num);
+        $this->redis->HDel($key, $seat_num);*/
+
+        //轮询下麦
+        $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->success(1);
         $this->success(1);
     }
     }