盲盒转盘 优化 提交
This commit is contained in:
@@ -539,7 +539,6 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
|
||||
// 4. 批量插入礼包发放记录
|
||||
$this->batchInsertGiftBagReceiveLog($user_id, $boxTurntableLog, $bag_data, $room_id, $precomputedResults);
|
||||
|
||||
// 5. 发送礼物
|
||||
$result = $this->sendGiftsToRecipients($precomputedResults, $room_id,$user_id,$heart_id,$auction_id);
|
||||
if (isset($result['code']) && $result['code'] !== 1) {
|
||||
@@ -582,16 +581,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);
|
||||
}
|
||||
// $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) {
|
||||
@@ -783,6 +782,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
return ['code' => 1, 'msg' => '发送礼物成功', 'data' => null];
|
||||
}
|
||||
|
||||
@@ -1266,6 +1266,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
'createtime' => time()
|
||||
]);
|
||||
$is_zhong_jiang = 1;
|
||||
unset($main_prize_updates);
|
||||
}else{
|
||||
$is_zhong_jiang = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user