巡乐会抽奖接口提交.-盲盒转盘期数修改

This commit is contained in:
2025-09-08 14:45:00 +08:00
parent 12f1a743f7
commit e0e5ff4d90
3 changed files with 23 additions and 9 deletions

View File

@@ -249,14 +249,19 @@ class BlindBox extends adminApi
}
$gift_bag_detail = db::name($this->table)->where(['gift_bag_id'=>$gift_bag_id])->select();
if(in_array($gift_bag_id,[10,11,12,13])){
$periods = 1;
if(!empty($room_id)){
$where['room_id'] = $room_id;
$room_pan_detail = db::name('vs_room_pan')->where(['gift_bag_id'=>$gift_bag_id,'room_id'=>$room_id])->order('id desc')->find();
if($room_pan_detail){
$periods = $room_pan_detail['periods'];
}
}
foreach ($gift_bag_detail as $k=>$v){
$where['gift_bag_detail_id'] = $v['id'];
$room_pan = db::name('vs_room_pan')->where($where)->select();
if(!empty($room_pan)){
$bag_data = db::name('vs_room_pan')->where($where)->update(['remaining_number'=>$v['quantity']]);
$bag_data = db::name('vs_room_pan')->where($where)->update(['remaining_number'=>$v['quantity'],'periods'=>$periods]);
}else{
if($room_id){
$bag_data = db::name('vs_room_pan')->insert([
@@ -264,6 +269,7 @@ class BlindBox extends adminApi
'gift_bag_id' => $gift_bag_id,
'gift_bag_detail_id' => $v['id'],
'remaining_number' => $v['quantity'],
'periods' => $periods,
'createtime' => time(),
]);
}else{
@@ -275,6 +281,7 @@ class BlindBox extends adminApi
'gift_bag_id' => $gift_bag_id,
'gift_bag_detail_id' => $v['id'],
'remaining_number' => $v['quantity'],
'periods' => $periods,
'createtime' => time(),
]);
}
@@ -569,6 +576,7 @@ class BlindBox extends adminApi
$count = db::name($this->table)->where($where)->count();
$lists_data = db::name($this->table)->where($where)->page($page, $page_limit)->order("id desc")->select();
$lists = [];
$periods =1;
foreach ($lists_data as $key => $value) {
$lists[$key]['id'] = $value['id'];
$lists[$key]['gift_id'] = $value['foreign_id'];
@@ -584,6 +592,7 @@ class BlindBox extends adminApi
$lists[$key]['is_world_show'] = $value['is_world_show'];
$lists[$key]['weight'] = $value['weight'];
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
$periods = $room_pan['periods']??1;
}
//统计
$total_data = [];
@@ -629,7 +638,7 @@ class BlindBox extends adminApi
'lists' => $lists,
'bag_list' => $bag_list,
'total_data' => [
'blind_box_turntable_periods' => $room['blind_box_turntable_periods']??'0', //当前期数
'blind_box_turntable_periods' => $periods, //当前期数
'remaining_number' => db::name('vs_room_pan')->where(['room_id'=>$room_id,'gift_bag_id'=>$gift_bag_id])->sum('remaining_number')??'0',
'total_count' => $total_count,
'total_price' => $total_price,