diff --git a/application/api/model/GiveGift.php b/application/api/model/GiveGift.php index 109921fd..2a24f836 100644 --- a/application/api/model/GiveGift.php +++ b/application/api/model/GiveGift.php @@ -920,8 +920,8 @@ class GiveGift extends Model // 1.系统调节 2.充值 3.提现 4.金币转增(送出) 5.每日任务奖励 6.充值返利 7.购买装扮 // 8.礼盒奖励 9.房间补贴 10.购买礼物 11.收礼增加收益 12.工会补贴 13.转赠金币(接收) 14.收益兑换 // 15.首充 16.天降好礼充值 17.退出工会扣款 18.房主收益 19.主持人收益 20.抢头条 21.公会长收益,22.提现驳回或提现失败返还,23.财富等级奖励金币领取,24.删除关系扣金币, - //50-签约,51-签约失败退回,52-首次被签约收入,54-叛徒补偿,55-徒弟收礼返佣,56-续约 - if(in_array($change_type,[1,2,3,4,5,6,7,8,12,13,14,15,16,17,20,56])){ + //50-签约,51-签约失败退回,52-首次被签约收入,54-叛徒补偿,55-徒弟收礼返佣,56-续约,57-签到,58-爆币 + if(in_array($change_type,[1,2,3,4,5,6,7,8,12,13,14,15,16,17,20,57])){ $room_ids = 0; }else{ $room_ids = $room_id; @@ -945,7 +945,7 @@ class GiveGift extends Model //根据类型判断是操作金币还是钻石得增加或减少 if($money_type == 1){//1金币 //增加用户金币类型 - $in_types = [2,5,6,8,13,14,15,16,51]; + $in_types = [2,5,6,8,13,14,15,16,51,58]; //减少用户金币类型 $out_types = [4,7,10,17,20,50,56]; if(in_array($change_type,$in_types)){ diff --git a/application/api/model/Lottery.php b/application/api/model/Lottery.php index b5c77af1..466cbcfe 100644 --- a/application/api/model/Lottery.php +++ b/application/api/model/Lottery.php @@ -33,8 +33,14 @@ class Lottery extends Model return ['code' => 0, 'msg' => '用户金币不足', 'data' => null]; } + //获取送礼用户昵称 + $FromUserInfo = db::name('user')->where('id',$send_uid)->field('id as user_id,nickname,avatar,sex')->find(); + $FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($send_uid);//财富图标 + $FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($send_uid);//魅力图标 + $FromUserInfo['chat_bubble'] = model('Decorate')->user_decorate_detail($send_uid,9);//聊天气泡 + $nums = $num * count($toarray); - $ress = $this->lottery($send_uid,$gift_info['gift_price'],$nums,$room_id,$gift_id); + $ress = $this->lottery($send_uid,$gift_info['gift_price'],$nums,$room_id,$gift_id,$FromUserInfo); if($ress['code'] == 0){ return ['code' => 0, 'msg' => $ress['msg'], 'data' => null]; } @@ -54,12 +60,6 @@ class Lottery extends Model return ['code' => 0, 'msg' => '用户等级更新失败', 'data' => null]; } - //获取送礼用户昵称 - $FromUserInfo = db::name('user')->where('id',$send_uid)->field('id as user_id,nickname,avatar,sex')->find(); - $FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($send_uid);//财富图标 - $FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($send_uid);//魅力图标 - $FromUserInfo['chat_bubble'] = model('Decorate')->user_decorate_detail($send_uid,9);//聊天气泡 - //送给一人礼物的总价格(扣除用户的数额) $gift_price = $gift_info['gift_price'] * $num; @@ -126,7 +126,7 @@ class Lottery extends Model //抽奖 - public function lottery($send_uid,$gift_price,$num,$room_id,$giftId) + public function lottery($send_uid,$gift_price,$num,$room_id,$giftId,$fromUserInfo=null) { try { for($i=0;$i<$num;$i++){ @@ -140,15 +140,29 @@ class Lottery extends Model //不做处理 } else {//开奖 // 大奖 - if ($result['is_big_prize'] == 1) { - $tet['text'] = '爆币大奖'; + if ($result['is_big_prize'] == 1) {//$result['big_prize_amount'],//中奖金额 + $wallet_update = model('api/GiveGift')->change_user_cion_or_earnings_log($send_uid,$result['big_prize_amount'],$room_id,1,58,'用户幸运币爆大币'); + if(!$wallet_update){ + return ['code' => 0, 'msg' => '流水记录失败', 'data' => null]; + } + $beilv = floor($result['big_prize_amount'] / $gift_price); + $tet['text'] = '恭喜用户'.$fromUserInfo['nickname'].'在幸运币活动中获得幸运币'.$beilv.'倍'; $tet['type'] = 1; + $tet['beilv'] = $beilv; $tet['play_image'] = 'https://cos.xscmmidi.site/admin/4676520chepiao_17613610239812.mp4'; - } else { // 小奖 - $tet['text'] = '爆币小奖'; + } else { // 小奖 $result['small_prize_amount'],//中奖金额 + $wallet_update = model('api/GiveGift')->change_user_cion_or_earnings_log($send_uid,$result['small_prize_amount'],$room_id,1,58,'用户幸运币爆小币'); + if(!$wallet_update){ + return ['code' => 0, 'msg' => '流水记录失败', 'data' => null]; + } + + $beilv = floor($result['small_prize_amount'] / $gift_price); + $tet['text'] = '恭喜用户'.$fromUserInfo['nickname'].'在幸运币活动中获得幸运币'.$beilv.'倍'; $tet['type'] = 2; + $tet['beilv'] = $beilv; $tet['play_image'] = 'https://cos.xscmmidi.site/admin/4652maomaojingling_17613603758950.mp4'; } + $tet['FromUserInfo'] = $fromUserInfo; $tet['user_id'] = $send_uid; model('api/Chat')->sendMsg(1100,$room_id,$tet); } diff --git a/application/common/model/UserWallet.php b/application/common/model/UserWallet.php index 6d49f043..142c4816 100644 --- a/application/common/model/UserWallet.php +++ b/application/common/model/UserWallet.php @@ -108,6 +108,8 @@ class UserWallet extends Model const RENEWAL = 56; //每日签到 const DAILY_SIGN = 57; + //爆币 + const BOMB_COIN = 58; @@ -192,7 +194,8 @@ class UserWallet extends Model self::BELIEVER_COMPENSATION => '解约补偿', self::SIGN_BE_SIGNED_INCOME => '被签约者收礼返佣给上级', self::RENEWAL => '续约', - self::DAILY_SIGN => '每日签到' + self::DAILY_SIGN => '每日签到', + self::BOMB_COIN => '参与幸运币活动获得', ]; if($type){