Browse Source

房间内送礼物,优化

lizhen_gitee 1 năm trước cách đây
mục cha
commit
7ae939b602
2 tập tin đã thay đổi với 16 bổ sung15 xóa
  1. 15 14
      application/api/controller/Party.php
  2. 1 1
      application/common/model/User.php

+ 15 - 14
application/api/controller/Party.php

@@ -1367,9 +1367,9 @@ class Party extends Common
         }
 
         //送礼物权限
-        if($this->auth->power['give_gift'] == 1){
+        /*if($this->auth->power['give_gift'] == 1){
             $this->error('您已被限制:赠送礼物,请联系管理员');
-        }
+        }*/
 
         //接收参数
         $user_ids  = input("user_id");// 赠送对象
@@ -1442,7 +1442,7 @@ class Party extends Common
 
             // 获取礼物信息
 
-            $giftInfo = Db::name('gift')->field('id,value,box_type,name,image,special')->where('id',$gift_id)->find();
+            $giftInfo = Db::name('gift')->field('id,value,name,image,special')->where('id',$gift_id)->find();
             if (!$giftInfo) {
                 $this->error("请选择礼物!");
             }
@@ -1451,14 +1451,15 @@ class Party extends Common
             $getValue  = $giftValue;
 
             // 判断如果是礼物盒则随机开礼物盒礼物
-            if($giftInfo['box_type'] > 0) {
+            /*if($giftInfo['box_type'] > 0) {
                 $boxgiftInfo = $this->getBoxGift($giftInfo['box_type']);
                 $getValue = $boxgiftInfo["price"];
-            }
+            }*/
 
             // 判断当前用户余额,这里不需要锁表,钱包操作会锁
             $giftCountValue = $giftInfo["value"] * $number * $userCount;
-            if($this->auth->jewel < $giftCountValue){
+            $user_jewel = model('wallet')->getWallet($this->auth->id,'jewel');
+            if($user_jewel < $giftCountValue){
                 $this->error("您的钻石余额不足!");
             }
 
@@ -1532,7 +1533,7 @@ class Party extends Common
                     $res2 = true;
 
                     // 扣除当前用户钻石余额
-                    $rs_wallet = model('wallet')->lockChangeAccountRemain($userauthid, $giftValue, '-', $this->auth->jewel, "赠送礼物:'" . $giftInfo["name"] . "',扣除" . $giftValue . "钻石!", 3,'jewel');
+                    $rs_wallet = model('wallet')->lockChangeAccountRemain($userauthid, $giftValue, '-', 0, "赠送礼物:'" . $giftInfo["name"] . "',扣除" . $giftValue . "钻石!", 3,'jewel');
                     if($rs_wallet['status'] == false){
                         Db::rollback();
                         $this->error($rs_wallet['msg']);
@@ -1545,7 +1546,7 @@ class Party extends Common
                 $data["user_to_id"] = $user_id;
                 $data["party_id"] = $party_id;
 
-                if($boxgiftInfo){
+                /*if($boxgiftInfo){
                     $data["gift_id"] = $boxgiftInfo['gift_id'];
                     $data["gift_give_type"] = 2;
                     $data["gift_name"] = $boxgiftInfo["gift_name"];
@@ -1553,7 +1554,7 @@ class Party extends Common
                     $data["number"] = $number;
                     $data["price"] = $boxgiftInfo["price"];
                     $data["value"] = $boxgiftInfo["price"] * $number;
-                }else{
+                }else{*/
                     $data["gift_id"] = $backGiftId > 0 ? $backGiftId : $gift_id;
                     $data["gift_give_type"] = $is_back ? 1 : 2;
                     $data["gift_name"] = $giftInfo["name"];
@@ -1561,7 +1562,7 @@ class Party extends Common
                     $data["number"] = $number;
                     $data["price"] = $giftInfo["value"];
                     $data["value"] = $giftValue;
-                }
+                /*}*/
 
                 //每个礼物都要计算平台抽成和房主抽成
                 $data['platvalue']    = bcmul($platRate/100        ,$data["value"],2);//平台抽成
@@ -1574,7 +1575,7 @@ class Party extends Common
                 $res5 = Db::name('gift_user_party')->insertGetId($data);
 
                 //大礼物飘屏
-                $this->bigGiftNotice($this->auth->nickname,$touserInfo['nickname'],$partyInfo,$data);
+                //$this->bigGiftNotice($this->auth->nickname,$touserInfo['nickname'],$partyInfo,$data);
 
                 // 添加获赠用户余额
                 /*if($data['getvalue'] > 0){
@@ -1695,16 +1696,16 @@ class Party extends Common
                 $returnData["partyHot"] = $this->changeW($partyHot);
                 $returnData["partyUserTop"] = $partyUserTop;
                 if($is_back != 1) {
-                    if($giftInfo['box_type'] > 0) { // 不是背包,宝箱中赠送
+                    /*if($giftInfo['box_type'] > 0) { // 不是背包,宝箱中赠送
                         $returnData["box_type"] = $giftInfo['box_type'];
                         $returnData["box_image"] = $giftInfo['image'];
                         $returnData["image"] = $boxgiftInfo["image"];
                         $returnData["name"] = $boxgiftInfo["gift_name"];
                         $returnData["gif_image"] = $boxgiftInfo["special"];
-                    } else {
+                    } else {*/
                         $returnData["image"] = $giftInfo["image"];
                         $returnData["gif_image"] = $giftInfo["special"];
-                    }
+                    /*}*/
                 } else {
                     $returnData["image"] = $giftInfo["image"];
                     $returnData["gif_image"] = $giftInfo["gif_image"];

+ 1 - 1
application/common/model/User.php

@@ -189,7 +189,7 @@ class User extends Model
                     "nickname" => $userIdKeyList[$k]["nickname"],
                     "gender" => $userIdKeyList[$k]["gender"], // 性别
                     "level" => $userIdKeyList[$k]["level"], // 积分等级
-//                    "jewel" => $v, // 财富数
+                    "jewel" => $v, // 财富数
                 ];
                 $rank ++;
             }