巡乐会抽奖接口提交.-调试

This commit is contained in:
2025-08-30 18:02:32 +08:00
parent 3e9be6c305
commit f28289669a

View File

@@ -476,9 +476,13 @@ class BlindBoxTurntableGift extends Model
//获取盲盒配置 //获取盲盒配置
$bag_data = db::name("vs_gift_bag")->field('id,name,ext,periods')->where('id',$gift_bag_id)->find(); $bag_data = db::name("vs_gift_bag")->field('id,name,ext,periods')->where('id',$gift_bag_id)->find();
$ext = json_decode($bag_data['ext'],true); $ext = json_decode($bag_data['ext'],true);
if(empty($bag_data)){
return ['code' => 0, 'msg' => '未找到该盲盒', 'data' => null];
}
$xlh_box_price = db::name('vs_gift')->where('gid',$ext['locking_condition']['selected_gift_id'])->value('gift_price')??0;
//判断是否有足够的金币 //判断是否有足够的金币
$user_waller = db::name('user_wallet')->where(['user_id'=>$user_id])->find(); $user_waller = db::name('user_wallet')->where(['user_id'=>$user_id])->find();
if ($user_waller['coin'] < $ext['xlh_box_price'] * $num) { if ($user_waller['coin'] < $xlh_box_price * $num) {
return ['code' => 0, 'msg' => '用户金币不足', 'data' => null]; return ['code' => 0, 'msg' => '用户金币不足', 'data' => null];
} }
$room = db::name('vs_room')->where(['id'=>$room_id])->find(); $room = db::name('vs_room')->where(['id'=>$room_id])->find();
@@ -557,7 +561,7 @@ class BlindBoxTurntableGift extends Model
} }
db::name('vs_room_pan_xlh')->where('id',$pan_xlh['id'])->update([ db::name('vs_room_pan_xlh')->where('id',$pan_xlh['id'])->update([
'user_id' => $user_id, 'user_id' => $user_id,
'pay_price' =>$ext['xlh_box_price'], 'pay_price' =>$xlh_box_price,
'locking_gift_id' =>$gift_bag_detail['foreign_id'], 'locking_gift_id' =>$gift_bag_detail['foreign_id'],
'num' => $pan_xlh_num, 'num' => $pan_xlh_num,
'end_time' => $end_time, 'end_time' => $end_time,
@@ -624,7 +628,7 @@ class BlindBoxTurntableGift extends Model
$data['room_id'] = $room_id; $data['room_id'] = $room_id;
$data['num'] = $value['count']; $data['num'] = $value['count'];
$data['gift_price'] = $value['gift_price']; $data['gift_price'] = $value['gift_price'];
$data['bag_price'] = $ext['xlh_box_price']; $data['bag_price'] = $xlh_box_price;
$data['createtime'] = time(); $data['createtime'] = time();
$result = db::name("vs_gift_bag_receive_log")->insert($data); $result = db::name("vs_gift_bag_receive_log")->insert($data);
if(!$result){ if(!$result){