diff --git a/application/api/model/BlindBoxTurntableGift.php b/application/api/model/BlindBoxTurntableGift.php index 62c8358..c478e9e 100644 --- a/application/api/model/BlindBoxTurntableGift.php +++ b/application/api/model/BlindBoxTurntableGift.php @@ -476,13 +476,9 @@ class BlindBoxTurntableGift extends Model //获取盲盒配置 $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); - 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(); - if ($user_waller['coin'] < $xlh_box_price * $num) { + if ($user_waller['coin'] < $ext['xlh_box_price'] * $num) { return ['code' => 0, 'msg' => '用户金币不足', 'data' => null]; } $room = db::name('vs_room')->where(['id'=>$room_id])->find(); @@ -561,7 +557,7 @@ class BlindBoxTurntableGift extends Model } db::name('vs_room_pan_xlh')->where('id',$pan_xlh['id'])->update([ 'user_id' => $user_id, - 'pay_price' =>$xlh_box_price, + 'pay_price' =>$ext['xlh_box_price'], 'locking_gift_id' =>$gift_bag_detail['foreign_id'], 'num' => $pan_xlh_num, 'end_time' => $end_time, @@ -628,7 +624,7 @@ class BlindBoxTurntableGift extends Model $data['room_id'] = $room_id; $data['num'] = $value['count']; $data['gift_price'] = $value['gift_price']; - $data['bag_price'] = $xlh_box_price; + $data['bag_price'] = $ext['xlh_box_price']; $data['createtime'] = time(); $result = db::name("vs_gift_bag_receive_log")->insert($data); if(!$result){