|
@@ -1659,15 +1659,20 @@ class Party extends Common
|
|
|
|
|
|
if(!empty($giftbackList)) {
|
|
|
foreach($giftbackList as $k => $v) {
|
|
|
- $giftcount = $giftcount + $v["number"];
|
|
|
$giftList[$k] = $v;
|
|
|
+
|
|
|
+ $giftcount += $v["number"];
|
|
|
if($giftcount >= $allCount) {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if($giftcount < $allCount) $this->error("背包数量不足");
|
|
|
+ if($giftcount < $allCount)
|
|
|
+ {
|
|
|
+ $this->error("背包数量不足");
|
|
|
+ }
|
|
|
+
|
|
|
$giftValue = $giftInfo["value"] * $number;
|
|
|
$getValue = $giftValue;
|
|
|
} else {
|
|
@@ -1678,11 +1683,11 @@ class Party extends Common
|
|
|
if (!$giftInfo) {
|
|
|
$this->error("请选择礼物!");
|
|
|
}
|
|
|
+
|
|
|
$giftValue = $giftInfo["value"] * $number;
|
|
|
$getValue = $giftValue;
|
|
|
|
|
|
// 判断如果是礼物盒则随机开礼物盒礼物
|
|
|
-
|
|
|
if($giftInfo['box_type'] > 0) {
|
|
|
$boxgiftInfo = $this->getBoxGift($giftInfo['box_type']);
|
|
|
$getValue = $boxgiftInfo["price"];
|
|
@@ -1699,23 +1704,24 @@ class Party extends Common
|
|
|
//此时 $giftValue,$getValue,$hotValue是相等的
|
|
|
$hotValue = $getValue;
|
|
|
|
|
|
- // 转换声币后 再进行抽点设置
|
|
|
+ //进行抽点设置
|
|
|
$partyInfo = null;
|
|
|
if(!$party_id) {
|
|
|
$platRate = 10;
|
|
|
$guilderRate = 30;
|
|
|
} else {
|
|
|
- $partyInfo = \app\common\model\Party::field("user_id,platRate,guilderRate")->where(["id"=>$party_id])->find();
|
|
|
+ $partyInfo = \app\common\model\Party::field("id,room_type,party_name,user_id,platRate,guilderRate")->where(["id"=>$party_id])->find();
|
|
|
// 获取系统配置信息
|
|
|
$platRate = $partyInfo->platRate; // 平台抽成百分比
|
|
|
$guilderRate = $partyInfo->guilderRate; // 工会长抽成百分比
|
|
|
}
|
|
|
|
|
|
+ //getValue削减
|
|
|
$platValue = bcmul($platRate/100 ,$getValue,2); //平台抽成
|
|
|
$guilderValue = bcmul($guilderRate/100,$getValue,2);// 工会长抽成
|
|
|
$getValue = bcsub(bcsub($getValue ,$platValue,2),$guilderValue,2);//减去抽成剩余价值
|
|
|
|
|
|
-// $gif_image = $is_back==1?$giftInfo["gif_image"]:$giftInfo["special"];
|
|
|
+ //
|
|
|
$returnData = [];
|
|
|
Db::startTrans();
|
|
|
try {
|
|
@@ -1740,9 +1746,7 @@ class Party extends Common
|
|
|
$i = 0;
|
|
|
foreach($user_id_arr as $user_id) {
|
|
|
// 获取赠送用户信息
|
|
|
- $where = [];
|
|
|
- $where["id"] = $user_id;
|
|
|
- $touserInfo = $userModel->where($where)->find();
|
|
|
+ $touserInfo = Db::name('user')->field('nickname')->where('id',$user_id)->find();
|
|
|
|
|
|
if($is_back == 1) {
|
|
|
$b=0;
|
|
@@ -1798,13 +1802,15 @@ class Party extends Common
|
|
|
}
|
|
|
|
|
|
//每个礼物都要计算平台抽成和房主抽成
|
|
|
- $data['platvalue'] = bcmul($platRate/100,$data["value"],2);
|
|
|
- $data['guildervalue'] = bcmul($guilderRate/100,$data["value"],2);
|
|
|
+ $data['platvalue'] = bcmul($platRate/100 ,$data["value"],2);
|
|
|
+ $data['guildervalue'] = bcmul($guilderRate/100 ,$data["value"],2);
|
|
|
$data['guildermoney'] = bcdiv($data['guildervalue'],$money_to_jewel,2);
|
|
|
|
|
|
$data["createtime"] = time();
|
|
|
$res5 = $giftuserpartyModel->allowField(true)->save($data);
|
|
|
- $this->bigGiftNotice($giftuserpartyModel);
|
|
|
+
|
|
|
+ //大礼物飘屏
|
|
|
+ $this->bigGiftNotice($this->auth->nickname,$touserInfo['nickname'],$partyInfo,$data);
|
|
|
|
|
|
// 添加获赠用户余额
|
|
|
if($getValue > 0){
|
|
@@ -1975,15 +1981,14 @@ class Party extends Common
|
|
|
}
|
|
|
|
|
|
//送礼完成之后,大礼物飘屏
|
|
|
- private function bigGiftNotice($giftUserParty){
|
|
|
- if ($giftUserParty->party_id > 0) {
|
|
|
+ private function bigGiftNotice($sender,$receiver,$partyInfo,$giftUserParty){
|
|
|
+ if ($giftUserParty['party_id'] > 0) {
|
|
|
|
|
|
- $is_big = Db::name('gift')->where('id',$giftUserParty->gift_id)->value('is_big');
|
|
|
+ $is_big = Db::name('gift')->where('id',$giftUserParty['gift_id'])->value('is_big');
|
|
|
|
|
|
if ($is_big == 1) {
|
|
|
- $partyInfo = $giftUserParty->party;
|
|
|
$notice = new GatewayworkerTools();
|
|
|
- $notice->sendBigGiftInParty($giftUserParty->user->nickname,$giftUserParty->toUser->nickname,$partyInfo,$giftUserParty);
|
|
|
+ $notice->sendBigGiftInParty($sender,$receiver,$partyInfo,$giftUserParty);
|
|
|
}
|
|
|
}
|
|
|
}
|