فهرست منبع

加入派对,功能下移

lizhen_gitee 1 سال پیش
والد
کامیت
95ca479569
1فایلهای تغییر یافته به همراه21 افزوده شده و 20 حذف شده
  1. 21 20
      application/api/controller/Party.php

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

@@ -753,26 +753,6 @@ class Party extends Api
         }
         $user_id = $this->auth->id;
 
-        $this->redis->zAdd("party_user_".$party_id,$user_id,$user_id);
-        $this->redis->hSet("online_".$party_id,$user_id,$user_id); //新增的
-
-        // 判断当前用户是否存在在直播间通过切换过来的
-        $livingUserPartyId = $this->redis->hGet("livingUser", $user_id);
-        if ($livingUserPartyId) {
-            if($livingUserPartyId != $party_id){
-                // 扣除房间在线人数
-                $this->redis->HDel("online_" . $livingUserPartyId, $user_id);
-                //首页用户头像
-                $this->redis->zRem("party_user_".$livingUserPartyId, $user_id);
-                // 扣除在线用户在房间情况
-                $this->redis->hDel("livingUser", $user_id);
-            }
-        }
-
-
-        // 记录在线用户在房间情况
-        $this->redis->hSet("livingUser", $user_id, $party_id);
-
 
         // 判断当前用户是否被该房间设置限制 //项目:1=房管,2=禁言,3=拉黑,4=踢出
         $lsetList = [];
@@ -838,6 +818,27 @@ class Party extends Api
             $this->error("派对信息获取失败!");
         }
 
+        //下移
+        $this->redis->zAdd("party_user_".$party_id,$user_id,$user_id);
+        $this->redis->hSet("online_".$party_id,$user_id,$user_id); //新增的
+
+        // 判断当前用户是否存在在直播间通过切换过来的
+        $livingUserPartyId = $this->redis->hGet("livingUser", $user_id);
+        if ($livingUserPartyId) {
+            if($livingUserPartyId != $party_id){
+                // 扣除房间在线人数
+                $this->redis->HDel("online_" . $livingUserPartyId, $user_id);
+                //首页用户头像
+                $this->redis->zRem("party_user_".$livingUserPartyId, $user_id);
+                // 扣除在线用户在房间情况
+                $this->redis->hDel("livingUser", $user_id);
+            }
+        }
+
+        // 记录在线用户在房间情况
+        $this->redis->hSet("livingUser", $user_id, $party_id);
+        //下移
+
         // 获取用户魅力值
         $users = $this->redis->zRange("hourCharm_".$party_id,0,-1,true);
         $u = [];