Browse Source

开箱子的资格,修改送礼物扣钱

lizhen_gitee 1 year ago
parent
commit
9c0c1fee47
2 changed files with 22 additions and 7 deletions
  1. 9 7
      application/api/controller/Party.php
  2. 13 0
      application/common/library/Auth.php

+ 9 - 7
application/api/controller/Party.php

@@ -1527,7 +1527,7 @@ class Party extends Common
         $user_id_arr = explode(",",$user_ids);
         $userCount = count($user_id_arr);
         $userauthid = $this->auth->id;
-        $soundCoinRate = config("site.giftCoin"); // 声币兑换比例
+        //$soundCoinRate = config("site.giftCoin"); // 声币兑换比例
         $money_to_jewel = config('site.money_to_jewel') ?: 10; //余额兑换钻石
         $userModel = new \app\common\model\User();
 
@@ -1584,7 +1584,7 @@ class Party extends Common
 
         $hotValue = $getValue;
 
-        $getValue = round($getValue * ($soundCoinRate/100));
+        //$getValue = round($getValue * ($soundCoinRate/100));
 
         // 转换统计
         $progetValue = $hotValue - $getValue;
@@ -1664,12 +1664,14 @@ class Party extends Common
                     }
                     $res2 = true;
                 } else {
+                    $res2 = true;
+
                     // 扣除当前用户钻石余额
-                    $where = [];
-                    $where["id"] = $userauthid;
-                    $res1 = $userModel->where($where)->setDec("jewel", $giftValue);
-                    // 添加当前用户钻石流水记录
-                    $res2 = $userjewellogModel->addUserJewelLog($userauthid, $giftValue, "-", $userInfo["jewel"], "赠送礼物:'" . $giftInfo["name"] . "',扣除" . $giftValue . "钻石!", 3);
+                    $rs_wallet = model('wallet')->lockChangeAccountRemain($userauthid, $giftValue, '-', $userInfo["jewel"], "赠送礼物:'" . $giftInfo["name"] . "',扣除" . $giftValue . "钻石!", 3,'jewel');
+                    if($rs_wallet['status'] == false){
+                        $this->error($rs_wallet['msg']);
+                        Db::rollback();
+                    }
                 }
 
                 $giftuserpartyModel = new \app\common\model\GiftUserParty();

+ 13 - 0
application/common/library/Auth.php

@@ -492,6 +492,19 @@ class Auth
         $userinfo['bind_alipay'] = !empty($userAlipay) ? 1 : 0;
         $userinfo['bind_bank'] = !empty($userBank) ? 1 : 0;
 
+        //消费额是否能开箱子和大转盘
+        $userinfo['can_egggift'] = 0;
+        $where = [];
+        $where["user_id"] = $this->_user->id;
+        $where["mode"] = '-';//查看wallet.php文件
+        $jewel_sum = Db::name('user_jewel_log')->where($where)->sum('value');
+        $eggplay_paymoney_min = config('site.eggplay_paymoney_min');
+        if($jewel_sum >= $eggplay_paymoney_min){
+            $userinfo['can_egggift'] = 1;
+        }
+
+        //
+
         return $userinfo;
     }