盲盒转盘优化-调试-加日志监控

This commit is contained in:
2025-10-25 18:14:36 +08:00
parent 1bd790071c
commit 60e2cde5e7

View File

@@ -582,6 +582,16 @@ class BlindBoxTurntableGiftDrawWorld extends Model
// 批量更新
foreach ($inventoryUpdates as $giftId => $count) {
$giftBagDetail = Db::name("vs_gift_bag_detail")
->where('id', $giftId)
->find();
if (!$giftBagDetail) {
throw new \Exception("礼物详情不存在ID: " . $giftId);
}
// 检查库存是否足够
if ($giftBagDetail['remaining_number'] < $count) {
throw new \Exception("礼物库存不足ID: " . $giftId);
}
$ret = db::name("vs_gift_bag_detail")->where('id',$giftId)
->setDec('remaining_number', $count);
if (!$ret) {