盲盒转盘错误修改

This commit is contained in:
2025-09-27 19:01:27 +08:00
parent 37020e8b53
commit feadb42002

View File

@@ -46,7 +46,7 @@ class BlindBoxTurntableGiftDraw extends Model
} }
// 2. 预加载必要数据 // 2. 预加载必要数据
$loadResult = $this->loadDrawData($gift_bag_id, $user_id, $room_id); $loadResult = $this->loadDrawData($gift_bag_id, $user_id, $room_id,$num,$gift_user_ids);
if ($loadResult['code'] !== 1) { if ($loadResult['code'] !== 1) {
return $loadResult; return $loadResult;
} }
@@ -147,7 +147,7 @@ class BlindBoxTurntableGiftDraw extends Model
/** /**
* 预加载必要数据 * 预加载必要数据
*/ */
private function loadDrawData($gift_bag_id, $user_id, $room_id) private function loadDrawData($gift_bag_id, $user_id, $room_id,$num,$gift_user_ids)
{ {
// 1. 合并查询盲盒配置和礼物信息 // 1. 合并查询盲盒配置和礼物信息
$bag_data = db::name("vs_gift_bag") $bag_data = db::name("vs_gift_bag")
@@ -183,6 +183,9 @@ class BlindBoxTurntableGiftDraw extends Model
if (!$user_waller) { if (!$user_waller) {
return ['code' => 0, 'msg' => '用户钱包不存在', 'data' => null]; return ['code' => 0, 'msg' => '用户钱包不存在', 'data' => null];
} }
if ($user_waller['coin'] < $bag_data['gift_price'] * $num * count(explode(',', $gift_user_ids))) {
return ['code' => 0, 'msg' => '用户金币不足', 'data' => null];
}
// 4. 获取巡乐会配置(使用缓存) // 4. 获取巡乐会配置(使用缓存)
$xlh_ext = $this->getCachedXlhConfig(); $xlh_ext = $this->getCachedXlhConfig();