盲盒转盘bug修改
This commit is contained in:
@@ -181,7 +181,7 @@ class BlindBoxTurntableGift extends Model
|
||||
//需要的礼物数量
|
||||
$need_gift_num = $receive_num * $num;
|
||||
$last_periods_remaining = [];
|
||||
if ($total_remaining < $need_gift_num) {
|
||||
if ($total_remaining - $need_gift_num <= 0 ) {
|
||||
//上期剩余礼物
|
||||
$last_periods_remaining = $available_gifts;
|
||||
//加入缓存
|
||||
@@ -360,43 +360,6 @@ class BlindBoxTurntableGift extends Model
|
||||
}
|
||||
}
|
||||
|
||||
// 处理奖池重置操作
|
||||
// if ($should_reset_all_gifts) {
|
||||
// // 重置奖池中所有礼物数量
|
||||
// $this->reset_gift_pool($room_id, $gift_bag_id, $current_periods);
|
||||
// }
|
||||
|
||||
// 批量插入盲盒转盘结果记录
|
||||
foreach ($gift_user_counts as $user_gift) {
|
||||
$ret = db::name('vs_blind_box_turntable_results_log')->insert([
|
||||
'tid' => $box_turntable_log,
|
||||
'gift_user_id' => $user_gift['gift_user_id'],
|
||||
'gift_id' => $user_gift['gift_id'],
|
||||
'count' => $user_gift['count'],
|
||||
'gift_price' => $user_gift['gift_price'],
|
||||
'all_gift_price' => $user_gift['gift_price'] * $user_gift['count'],
|
||||
'createtime' => time(),
|
||||
'heart_id' => $heart_id
|
||||
]);
|
||||
if (!$ret) {
|
||||
db::rollback();
|
||||
return ['code' => 0, 'msg' => '添加盲盒转盘结果记录失败', 'data' => null];
|
||||
}
|
||||
|
||||
//给接收礼物的人送礼物
|
||||
$give_gift_ext['gift_id'] = $user_gift['gift_id'];
|
||||
$give_gift_ext['count'] = $user_gift['count'];
|
||||
$give_gift_ext['gift_price'] = $user_gift['gift_price'];
|
||||
$give_gift_ext['all_gift_price'] = $user_gift['gift_price'] * $user_gift['count'];
|
||||
$give_gift_ext['is_draw_gift'] = 1;
|
||||
$res = model('Room')->room_gift($user_id, $user_gift['gift_user_id'], $user_gift['gift_id'], $user_gift['count'], 1, $room_id, 0,$heart_id,$give_gift_ext);
|
||||
if (isset($res) && $res['code'] != 1) {
|
||||
db::rollback();
|
||||
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 扣除抽奖消耗的金币
|
||||
// 扣除用户金币并记录日志
|
||||
$wallet_update = model('GiveGift')->change_user_cion_or_earnings_log($user_id,$bag_gift_price,$room_id,1,10,'盲盒转盘抽奖消耗');
|
||||
@@ -417,6 +380,35 @@ class BlindBoxTurntableGift extends Model
|
||||
return V(0,$e->getMessage());
|
||||
}
|
||||
|
||||
// 批量插入盲盒转盘结果记录
|
||||
foreach ($gift_user_counts as $user_gift) {
|
||||
$ret = db::name('vs_blind_box_turntable_results_log')->insert([
|
||||
'tid' => $box_turntable_log,
|
||||
'gift_user_id' => $user_gift['gift_user_id'],
|
||||
'gift_id' => $user_gift['gift_id'],
|
||||
'count' => $user_gift['count'],
|
||||
'gift_price' => $user_gift['gift_price'],
|
||||
'all_gift_price' => $user_gift['gift_price'] * $user_gift['count'],
|
||||
'createtime' => time(),
|
||||
'heart_id' => $heart_id
|
||||
]);
|
||||
if (!$ret) {
|
||||
return ['code' => 0, 'msg' => '添加盲盒转盘结果记录失败', 'data' => null];
|
||||
}
|
||||
|
||||
//给接收礼物的人送礼物
|
||||
$give_gift_ext['gift_id'] = $user_gift['gift_id'];
|
||||
$give_gift_ext['count'] = $user_gift['count'];
|
||||
$give_gift_ext['gift_price'] = $user_gift['gift_price'];
|
||||
$give_gift_ext['all_gift_price'] = $user_gift['gift_price'] * $user_gift['count'];
|
||||
$give_gift_ext['is_draw_gift'] = 1;
|
||||
$res = model('Room')->room_gift($user_id, $user_gift['gift_user_id'], $user_gift['gift_id'], $user_gift['count'], 1, $room_id, 0,$heart_id,$give_gift_ext);
|
||||
if (isset($res) && $res['code'] != 1) {
|
||||
db::rollback();
|
||||
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
// 巡乐会
|
||||
$xlh = [];
|
||||
if(!empty($xlh_ext) && $xlh_ext['inlet_bag_id'] == $gift_bag_id){
|
||||
|
||||
Reference in New Issue
Block a user