|
@@ -83,6 +83,11 @@ class Party extends Common
|
|
|
$backGiftId = 0; //背包礼物表的 gift_id
|
|
|
$boxgiftInfo = [];
|
|
|
|
|
|
+ //每个人都能得到的礼物价值
|
|
|
+ $giftValue = 0;
|
|
|
+ //每个人都能得到的礼物价值
|
|
|
+ $getValue = 0;
|
|
|
+
|
|
|
if($is_back == 1) {
|
|
|
// 获取背包礼物信息
|
|
|
$giftInfo = \app\common\model\GiftBack::get($gift_id);
|
|
@@ -110,7 +115,7 @@ class Party extends Common
|
|
|
|
|
|
if($giftcount < $allCount) $this->error("背包数量不足");
|
|
|
$giftValue = $giftInfo["value"] * $number;
|
|
|
- $getValue = $giftInfo["value"] * $number;
|
|
|
+ $getValue = $giftValue;
|
|
|
} else {
|
|
|
|
|
|
// 获取礼物信息
|
|
@@ -119,20 +124,14 @@ class Party extends Common
|
|
|
$this->error("请选择礼物!");
|
|
|
}
|
|
|
$giftValue = $giftInfo["value"] * $number;
|
|
|
+ $getValue = $giftValue;
|
|
|
+
|
|
|
+ // 判断当前用户余额,这里不需要锁表,钱包操作会锁
|
|
|
$giftCountValue = $giftInfo["value"] * $number * $userCount;
|
|
|
- $getValue = $giftValue;
|
|
|
- // 判断如果是礼物盒则随机开礼物盒礼物
|
|
|
- if($giftInfo->box_type > 0) {
|
|
|
- $boxgiftInfo = $this->getBoxGift($giftInfo->box_type);
|
|
|
- $getValue = $boxgiftInfo["price"];
|
|
|
+ if($this->auth->jewel < $giftCountValue){
|
|
|
+ $this->error("您的钻石余额不足!");
|
|
|
}
|
|
|
|
|
|
- // 判断当前用户余额
|
|
|
- $where = [];
|
|
|
- $where["id"] = $userauthid;
|
|
|
- $userInfo = $userModel->where($where)->lock(true)->find();
|
|
|
- if (!$userInfo) $this->error("用户信息查询失败!");
|
|
|
- if($userInfo["jewel"] < $giftCountValue) $this->error("您的钻石余额不足!");
|
|
|
}
|
|
|
|
|
|
$hotValue = $getValue;
|