巡乐会抽奖接口提交.-bug修改

This commit is contained in:
2025-09-09 11:14:52 +08:00
parent 5a6a6adc45
commit 1d20d608e1
2 changed files with 41 additions and 19 deletions

View File

@@ -79,24 +79,26 @@ class GiveGift extends Model
}
//金币购买送礼 1金币购买 2送背包礼物
if ($type == 1) {
//送给所有人的总价格
$all_gift_price = $gift_info['gift_price'] * $num * count($toarray);
//判断是否有足够的金币
$user_waller = db::name('user_wallet')->where(['user_id'=>$uid])->find();
if ($user_waller['coin'] < $all_gift_price) {
return ['code' => 0, 'msg' => '用户金币不足', 'data' => null];
}
//扣除用户金币并记录日志
$wallet_update = $this -> change_user_cion_or_earnings_log($uid,$all_gift_price,$from_id,1,10,'用户金币购买礼物');
if(!$wallet_update){
Db::rollback();
return ['code' => 0, 'msg' => '扣除用户金币失败', 'data' => null];
}
//用户财富等级更新
$user_level = model('Level')->user_level_data_update($uid,$all_gift_price,1,$roomId);
if(!$user_level){
Db::rollback();
return ['code' => 0, 'msg' => '用户等级更新失败', 'data' => null];
if(!isset($ext['is_draw_gift']) || $ext['is_draw_gift'] != 1){// 非盲盒转盘
//送给所有人的总价格
$all_gift_price = $gift_info['gift_price'] * $num * count($toarray);
//判断是否有足够的金币
$user_waller = db::name('user_wallet')->where(['user_id'=>$uid])->find();
if ($user_waller['coin'] < $all_gift_price) {
return ['code' => 0, 'msg' => '用户金币不足', 'data' => null];
}
//扣除用户金币并记录日志
$wallet_update = $this -> change_user_cion_or_earnings_log($uid,$all_gift_price,$from_id,1,10,'用户金币购买礼物');
if(!$wallet_update){
Db::rollback();
return ['code' => 0, 'msg' => '扣除用户金币失败', 'data' => null];
}
//用户财富等级更新
$user_level = model('Level')->user_level_data_update($uid,$all_gift_price,1,$roomId);
if(!$user_level){
Db::rollback();
return ['code' => 0, 'msg' => '用户等级更新失败', 'data' => null];
}
}
}else{
//背包礼物是否充足