Ver código fonte

被送礼物者得钱

lizhen_gitee 1 ano atrás
pai
commit
e40e78b78c
1 arquivos alterados com 24 adições e 18 exclusões
  1. 24 18
      application/api/controller/Party.php

+ 24 - 18
application/api/controller/Party.php

@@ -1528,6 +1528,7 @@ class Party extends Common
         $userCount = count($user_id_arr);
         $userauthid = $this->auth->id;
         $soundCoinRate = config("site.giftCoin"); // 声币兑换比例
+        $money_to_jewel = config('site.money_to_jewel') ?: 10; //余额兑换钻石
         $userModel = new \app\common\model\User();
 
         $backGiftId = 0;
@@ -1699,24 +1700,29 @@ class Party extends Common
                 $data["createtime"] = time();
                 $res5 = $giftuserpartyModel->allowField(true)->save($data);
 
-                // 添加赠送用户声币余额
-               /* $where = [];
-                $where["id"] = $user_id;
-                $res3 = $userModel->where($where)->setInc("sound_coin", $getValue);
-                $getValue == 0 && $res3 = true;*/
-                // 添加赠送用户声币流水记录soundCoin
-                // xxx送你
-                //$res4 = $usersoundcoinlogModel->addUserSoundcoinLog($user_id, $getValue, "+", $touserInfo["sound_coin"], "{$this->auth->nickname}送你{$giftInfo['name']}x{$number}", 1, $giftuserpartyModel->id);
-
-                /*if ($partyInfo && $guilderValue > 0) {
-                    // 增加房主抽成
-                    $where = [];
-                    $where["id"] = $partyInfo->user_id;
-                    $userModel->where($where)->setInc("sound_coin", $guilderValue);
-                    // 添加赠送用户声币流水记录soundCoin
-                    // xxx送礼物给xxx,房间礼物抽成
-                    $usersoundcoinlogModel->addUserSoundcoinLog($partyInfo->user_id, $guilderValue, "+", $touserInfo["sound_coin"], "{$this->auth->nickname}送礼物{$giftInfo['name']}x{$number}给{$touserInfo['nickname']},房间礼物抽成", 4, $giftuserpartyModel->id);
-                }*/
+                // 添加赠送用户余额
+                if($getValue > 0){
+                    $getMoney = bcdiv($getValue,$money_to_jewel,2);
+                    if($getMoney > 0){
+                        $rs_wallet = model('wallet')->lockChangeAccountRemain($user_id,$getMoney,'+',0,"{$this->auth->nickname}送你{$giftInfo['name']}x{$number}",101,'money');
+                        if($rs_wallet['status'] == false){
+                            $this->error($rs_wallet['msg']);
+                            Db::rollback();
+                        }
+                    }
+                }
+
+                // 增加房主抽成
+                if ($partyInfo && $guilderValue > 0) {
+                    $guilderMoney = bcdiv($guilderValue,$money_to_jewel,2);
+                    if($guilderMoney > 0){
+                        $rs_wallet = model('wallet')->lockChangeAccountRemain($partyInfo->user_id,$guilderMoney,'+',0,"{$this->auth->nickname}送礼物{$giftInfo['name']}x{$number}给{$touserInfo['nickname']},房间礼物抽成",102,'money');
+                        if($rs_wallet['status'] == false){
+                            $this->error($rs_wallet['msg']);
+                            Db::rollback();
+                        }
+                    }
+                }
 
                 //总消费增加
                 if($is_back != 1){