Browse Source

直播排行榜

lizhen_gitee 3 years ago
parent
commit
fd2f003af8

+ 29 - 2
application/api/controller/Livebc.php

@@ -156,9 +156,11 @@ class Livebc extends Api
             $redisconfig = config("redis");
             $redis->connect($redisconfig["host"], $redisconfig["port"], 86400 * 31);
 
-            // 添加redis记录做财富排行榜日榜用,用直播用户的uid作为房间号
-            $redis->zIncrBy("livebc_jewel_to_" . $partyid, $giftinfo['value'], $this->auth->id);
+            // 添加redis记录做财富排行榜
+            $redis->zIncrBy("livebc_jewel_get_" . $partyid, $giftinfo['value'], $user_id);
 
+            // 添加redis记录做贡献排行榜
+            $redis->zIncrBy("livebc_jewel_to_" . $partyid, $giftinfo['value'], $this->auth->id);
         }
 
         // tcp 获取房间用户周前三名
@@ -199,4 +201,29 @@ class Livebc extends Api
     }
 
 
+    //准备返回数据,刷礼物的总值,刷礼物人数,榜一信息
+    public function outlivebc(){
+        $party_id = input('party_id');
+        if(empty($party_id)){
+            $this->error();
+        }
+
+        $redis = new Redis();
+        $redisconfig = config("redis");
+        $redis->connect($redisconfig["host"], $redisconfig["port"]);
+
+        $userModel = new \app\common\model\User();
+        // 获取条数
+        $num = 3;
+        // 获取3条财富排行周记录
+        $getweek = $redis->zRevRange("livebc_jewel_to_".$party_id,0,$num-1,true);
+        $userList = $userModel->rankList($getweek);
+
+        //主播共获得礼物值
+        //$valuesum = $redis->get('livebc_jewel_get_'.$party_id,$this->auth->id);
+
+    }
+
+
+
 }

+ 1 - 0
application/api/controller/Party.php

@@ -648,6 +648,7 @@ class Party extends Common
 
     /**
      * 退出派对
+     * 前端没用到,转移到trtc_callback了
      */
     public function outParty() {
         $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID

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

@@ -22,10 +22,14 @@ class Test
         $num = 100;
         // 获取3条财富排行周记录
         $getweek = $redis->zRevRange("livebc_jewel_to_".$party_id,0,$num-1,true);
+        $getweek2 = $redis->zRevRange("livebc_jewel_get_".$party_id,0,$num-1,true);
         $userList = $userModel->rankList($getweek);
+        $userList2 = $userModel->rankList($getweek2);
 
         dump($getweek);
+        dump($getweek2);
         dump($userList);
+        dump($userList2);
 
         $heads = $redis->hGet("livebc_jewel_top3",$party_id);
         dump($heads);