瀏覽代碼

优化魅力榜,财富榜的赋值

lizhen_gitee 1 年之前
父節點
當前提交
fd706d0e7b
共有 1 個文件被更改,包括 5 次插入57 次删除
  1. 5 57
      application/api/controller/Party.php

+ 5 - 57
application/api/controller/Party.php

@@ -1964,8 +1964,11 @@ class Party extends Api
                         $this->redis->zIncrBy($this->roomTypeArr[$room_type] . "_jewel_to_" . $party_id . ":" . $monthday . "m", $giftValue, $userauthid);
 
                         // tcp 更新用户魅力值
-                        $this->updateUserCharm($party_id, $user_id, $hotValue);
-                        $this->updateUserWealth($party_id, $user_id, $hotValue);
+                        $this->redis->zIncrBy("hourCharm_".$party_id, $hotValue, $user_id);
+
+                        // tcp 更新用户贡献值
+                        $this->redis->zIncrBy("hourWealth_".$party_id, $hotValue, $user_id);
+
 
                         //更新麦位魅力值
                         //$this->updateSeatCharm($partyInfo['easemob_room_id'],$seat_id_arr[$user_id_key],$hotValue,$partyInfo);
@@ -2312,61 +2315,6 @@ class Party extends Api
 
     }
 
-    /**
-     *  用户赠送礼物后房间内用户魅力值增加
-     */
-    private function updateUserCharm($party_id,$user_id,$giftValue) {
-
-
-        // 获取用户魅力值
-        $users = $this->redis->zRevRange("hourCharm_".$party_id,0,-1,true);
-
-        if(!$users) $users[$user_id] = 0;
-
-        if(isset($users[$user_id])) {
-            $value = $users[$user_id] + $giftValue;
-        } else {
-            $value = $giftValue;
-        }
-        $this->redis->zAdd("hourCharm_".$party_id,$value,$user_id);
-
-        return true;
-
-    }
-
-    public function testredis(){
-        $party_id = 1;
-        $users = $this->redis->zRevRange("hourCharm_".$party_id,0,-1,true);
-        dump($users);
-        $users = $this->redis->zRange("hourCharm_".$party_id,0,-1,true);
-        dump($users);
-    }
-
-    /**
-     *  用户赠送礼物后房间内用户贡献值增加
-     */
-    private function updateUserWealth($party_id,$user_id,$giftValue) {
-
-
-        // 获取用户魅力值
-        $users = $this->redis->zRevRange("hourWealth_".$party_id,0,-1,true);
-
-        if(!$users) $users[$user_id] = 0;
-
-        if(isset($users[$user_id])) {
-            $value = $users[$user_id] + $giftValue;
-        } else {
-            $value = $giftValue;
-        }
-        $this->redis->zAdd("hourWealth_".$party_id,$value,$user_id);
-
-        return true;
-
-    }
-
-
-
-