盲盒转盘 优化 提交
This commit is contained in:
@@ -72,7 +72,9 @@ class User extends adminApi
|
||||
if($v=='coin1'){
|
||||
$where['c.coin'] = ['>=',$input_data];
|
||||
}elseif($v=='coin2'){
|
||||
$where['c.coin'] = ['<=',$input_data];
|
||||
if($input_data){
|
||||
$where['c.coin'] = ['<=',$input_data];
|
||||
}
|
||||
}elseif($v=='createtime'){
|
||||
$where['a.createtime'] = ['>=',strtotime($input_data)];
|
||||
$where['a.createtime'] = ['<=',strtotime($input_data)];
|
||||
|
||||
@@ -40,7 +40,7 @@ class BlindBoxTurntable extends BaseCom
|
||||
$num = input('num',1);
|
||||
$heart_id = input('heart_id',0);
|
||||
$auction_id = input('auction_id',0);
|
||||
$reslut = model('BlindBoxTurntableGiftDrawWorld')->draw_gift($gift_bag_id, $user_id, $gift_user_ids,$num,$room_id,$heart_id,$auction_id);
|
||||
$reslut = model('BlindBoxTurntableGiftDrawWorldNew')->draw_gift($gift_bag_id, $user_id, $gift_user_ids,$num,$room_id,$heart_id,$auction_id);
|
||||
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
/*
|
||||
@@ -93,7 +93,7 @@ class BlindBoxTurntable extends BaseCom
|
||||
$user_id = $this->uid;
|
||||
$room_id = input('room_id',0);
|
||||
$num = input('num',1);
|
||||
$reslut = model('BlindBoxTurntableGiftDrawWorld')->xlh_draw_gift($user_id,$num,$room_id);
|
||||
$reslut = model('BlindBoxTurntableGiftDrawWorldNew')->xlh_draw_gift($user_id,$num,$room_id);
|
||||
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
1307
application/api/model/BlindBoxTurntableGiftDrawWorldNew.php
Normal file
1307
application/api/model/BlindBoxTurntableGiftDrawWorldNew.php
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user