This commit is contained in:
2025-12-21 17:28:11 +08:00
parent 92a2fb10cd
commit 95bb00e2cc

View File

@@ -34,7 +34,10 @@ class Lottery extends Model
}
$nums = $num * count($toarray);
$this->lottery($send_uid,$gift_info['gift_price'],$nums,$room_id,$gift_id);
$ress = $this->lottery($send_uid,$gift_info['gift_price'],$nums,$room_id,$gift_id);
if($ress['code'] == 0){
return ['code' => 0, 'msg' => $ress['msg'], 'data' => null];
}
//送礼 开启事务
Db::startTrans();
@@ -125,7 +128,7 @@ class Lottery extends Model
//抽奖
public function lottery($send_uid,$gift_price,$num,$room_id,$giftId)
{
// try {
try {
for($i=0;$i<$num;$i++){
$gift_gold = $gift_price;
$service = new LotteryService();
@@ -150,11 +153,11 @@ class Lottery extends Model
}
}
}
return V(1, '送礼成功');
// } catch (Exception $e) {
// Log::error('抽奖处理失败:' . $e->getMessage());
// return V(0, $e->getMessage());
// }
return ['code' => 1, 'msg' => '送礼成功', 'data' => null];
} catch (Exception $e) {
Log::error('抽奖处理失败:' . $e->getMessage());
return ['code' => 0, 'msg' => $e->getMessage(), 'data' => null];
}
}
}