Ver Fonte

送礼物变量优化,删去注释内容

lizhen_gitee há 1 ano atrás
pai
commit
653e9cd16b
1 ficheiros alterados com 12 adições e 70 exclusões
  1. 12 70
      application/api/controller/Party.php

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

@@ -1896,9 +1896,8 @@ class Party extends Api
             $giftInfo['is_baobi'] = 0;
 
             $giftValue = $giftInfo["value"] * $number;
-            $getValue  = $giftValue;
 
-            $giftCountValue = $giftInfo["value"] * $number * $userCount;
+            $giftCountValue = $giftValue * $userCount;
         } else {
 
             // 获取礼物信息
@@ -1909,10 +1908,9 @@ class Party extends Api
             }
 
             $giftValue = $giftInfo["value"] * $number;
-            $getValue  = $giftValue;
 
             // 判断当前用户余额,这里不需要锁表,钱包操作会锁
-            $giftCountValue = $giftInfo["value"] * $number * $userCount;
+            $giftCountValue = $giftValue * $userCount;
             $user_jewel = model('wallet')->getWallet($this->auth->id,'jewel');
             if($user_jewel < $giftCountValue){
                 $this->error("您的金币余额不足!");
@@ -1920,8 +1918,6 @@ class Party extends Api
 
         }
 
-        //此时 $giftValue,$getValue,$hotValue是相等的(除了盒子礼物特殊)
-        $hotValue = $getValue;
 
         //进行抽点设置
         $partyInfo = null;
@@ -1949,14 +1945,7 @@ class Party extends Api
         try {
 
 
-            // 获取当天零点
-            $day = date("Ymd");
-            // 获取本周第一天
-            $weekday = $this->firstOfWeek(date("Y-m-d H:i:s"));
-            // 获取本月第一天
-            $monthday = date("Ym01");
 
-            $allVal = 0;
             $i = 0;
 
             //用户大循环
@@ -2046,11 +2035,11 @@ class Party extends Api
                     $i++;
                     if($party_id > 0) {
                         // 添加redis记录做魅力排行榜日榜用
-//                        $this->redis->zIncrBy($this->roomTypeArr[$room_type] . "_jewel_get_" . $party_id . ":" . $day . "d", $hotValue, $user_id);
+//                        $this->redis->zIncrBy($this->roomTypeArr[$room_type] . "_jewel_get_" . $party_id . ":" . $day . "d", $giftValue, $user_id);
                         // 添加redis记录做魅力排行榜周榜用
-//                        $this->redis->zIncrBy($this->roomTypeArr[$room_type] . "_jewel_get_" . $party_id . ":" . $weekday . "w", $hotValue, $user_id);
+//                        $this->redis->zIncrBy($this->roomTypeArr[$room_type] . "_jewel_get_" . $party_id . ":" . $weekday . "w", $giftValue, $user_id);
                         // 添加redis记录做魅力排行榜月榜用
-//                        $this->redis->zIncrBy($this->roomTypeArr[$room_type] . "_jewel_get_" . $party_id . ":" . $monthday . "m", $hotValue, $user_id);
+//                        $this->redis->zIncrBy($this->roomTypeArr[$room_type] . "_jewel_get_" . $party_id . ":" . $monthday . "m", $giftValue, $user_id);
                         // 添加redis记录做财富排行榜日榜用
 //                        $this->redis->zIncrBy($this->roomTypeArr[$room_type] . "_jewel_to_" . $party_id . ":" . $day . "d", $giftValue, $userauthid);
                         // 添加redis记录做财富排行榜周榜用
@@ -2059,56 +2048,22 @@ class Party extends Api
 //                        $this->redis->zIncrBy($this->roomTypeArr[$room_type] . "_jewel_to_" . $party_id . ":" . $monthday . "m", $giftValue, $userauthid);
 
                         // tcp 更新用户魅力值
-                        $this->redis->zIncrBy("hourCharm_".$party_id, $hotValue, $user_id);
+                        $this->redis->zIncrBy("hourCharm_".$party_id, $giftValue, $user_id);
 
                         // tcp 更新用户贡献值
-                        $this->redis->zIncrBy("hourWealth_".$party_id, $hotValue, $userauthid);
+                        $this->redis->zIncrBy("hourWealth_".$party_id, $giftValue, $userauthid);
 
 
-                        //更新麦位魅力值
-                        //$this->updateSeatCharm($partyInfo['easemob_room_id'],$seat_id_arr[$user_id_key],$hotValue,$partyInfo);
-
-                        // 如果是主播,则添加魅力值记录做榜单统计
-                        /*if($room_type == 2) {
-                            $data = [];
-                            $data["user_id"] = $user_id;
-                            $data["party_id"] = $party_id;
-                            $data["charm"] = $hotValue;
-                            $data["createtime"] = time();
-                            \app\common\model\UserCharmRank::insert($data);
-
-                        }*/
-
                     }
 
                     //用户经验升级
-                    /*$getempirical = config("site.getempirical");
-                    $getempirical = $getempirical * $hotValue;
-                    // 获取用户贵族信息
-                    $noble = \app\common\model\User::getUserNoble($this->auth->id);
-                    if(isset($noble["noble_on"]) && $noble["noble_on"] == 1) {
-                        $getempirical = $getempirical + $getempirical * ($noble["explain"]/100);
-                    }
-
-                    // 增加用户经验值
-                    $res = \app\common\model\User::addEmpirical($this->auth->id,$getempirical);
-                    if ($res){
-                        $this->auth->level = $res->level;
-                    }
-
+                    /*
                     //增加被送礼物用户的魅力等级
                     $res_charm = \app\common\model\User::add_charm_level($user_id,$giftValue);
-
-                    // +exp
-                    \app\common\model\TaskLog::tofinish($this->auth->id,"OBHqCX4g",$number);
                     */
                     // +message
                     \app\common\model\Message::addMessage($user_id,"礼物通知","收到 ".$this->auth->nickname." 赠送的".$giftInfo["name"]." x".$number." 价值 ".$giftValue ." 金币");
 
-                    //增加送礼用户的财富等级
-                    $res_wealth = \app\common\model\User::add_wealth_level($this->auth->id,$giftValue);
-
-                    $allVal = $allVal + $hotValue;
 
                 }
             }
@@ -2132,22 +2087,9 @@ class Party extends Api
                 }
             }
 
-            // 获取用户魅力值。大概率没用了
-
-            // tcp 更新房间热度
-            //$partyHot = $this->updatePartyHot($partyInfo, $allVal, $room_type);
-
-            // 如果是派对,则添加派对热度值记录做榜单统计
-            /*if($room_type == 1) {
-                $data = [];
-                $data["party_id"] = $party_id;
-                $data["hot"] = $allVal;
-                $data["createtime"] = time();
-                \app\common\model\PartyHot::insert($data);
-            }*/
 
             //增加送礼用户的财富等级
-//            $res_wealth = \app\common\model\User::add_wealth_level($this->auth->id,$allVal);
+            $res_wealth = \app\common\model\User::add_wealth_level($this->auth->id,$giftCountValue);
 
             // tcp 获取房间用户周前三名
             $this->getPartyUserTop($partyInfo, $room_type);
@@ -2342,12 +2284,12 @@ class Party extends Api
     /**
      * 更新派对信息(热度等)
      */
-    private function updatePartyHot($partyInfo,$hotValue,$room_type) {
+    private function updatePartyHot($partyInfo,$giftValue,$room_type) {
 //        $partyInfo = \app\common\model\Party::where(['id'=>$party_id])->find();
-        if(!$partyInfo) return $hotValue;
+        if(!$partyInfo) return $giftValue;
 
         $party_hot = $partyInfo->party_hot > 0 ? $partyInfo->party_hot:0;
-        $party_hot_value = $party_hot + $hotValue;
+        $party_hot_value = $party_hot + $giftValue;
         $party_hot_value = $party_hot_value > 0 ? $party_hot_value : 0;
         if($party_hot_value != $party_hot) {
             // 保存数据