Browse Source

直播排行榜

lizhen_gitee 3 years ago
parent
commit
24a5684f9e
2 changed files with 20 additions and 0 deletions
  1. 7 0
      application/api/controller/Tenim.php
  2. 13 0
      application/index/controller/Test.php

+ 7 - 0
application/api/controller/Tenim.php

@@ -667,8 +667,15 @@ exit;
             }elseif($input['EventType'] == 104){
                 //退出房间,主播role=20 观众role=21
                 if($input['EventInfo']['Role'] == 20){
+                    $user_id = $input['EventInfo']['UserId'];
                     $live_bc = Db::name('livebc')->where('user_id',$input['EventInfo']['UserId'])->update(['is_online'=>0]);
                     $rs_user = Db::name('user')->where('id',$input['EventInfo']['UserId'])->update(['is_livebc'=>0]);
+                    //清空房间排行榜
+                    $redis = new Redis();
+                    $redisconfig = config("redis");
+                    $redis->connect($redisconfig["host"], $redisconfig["port"]);
+                    $redis->del('livebc_jewel_to_' . $user_id);
+                    $redis->hDel("livebc_jewel_top3",$user_id);
                 }
             }
         }elseif($input['EventGroupId'] == 2){

+ 13 - 0
application/index/controller/Test.php

@@ -26,6 +26,19 @@ class Test
 
         dump($getweek);
         dump($userList);
+
+        $heads = $redis->hGet("livebc_jewel_top3",$party_id);
+        dump($heads);
+    }
+
+    public function clear(){
+        $user_id = 26;
+        //清空房间排行榜
+        $redis = new Redis();
+        $redisconfig = config("redis");
+        $redis->connect($redisconfig["host"], $redisconfig["port"]);
+        $redis->del('livebc_jewel_to_' . $user_id);
+        $redis->hDel("livebc_jewel_top3",$user_id);
     }
 
     /**