feat: 支持开奖重开与风险池原子扣减,完善投注部分成功流程
This commit is contained in:
@@ -34,6 +34,7 @@ final class TicketDrawMyMatchController extends Controller
|
||||
'hit_numbers_4d' => [],
|
||||
'total_win_minor' => 0,
|
||||
'total_jackpot_win_minor' => 0,
|
||||
'winning_ticket_count' => 0,
|
||||
'has_bets' => false,
|
||||
]);
|
||||
}
|
||||
@@ -45,6 +46,7 @@ final class TicketDrawMyMatchController extends Controller
|
||||
'hit_numbers_4d' => [],
|
||||
'total_win_minor' => 0,
|
||||
'total_jackpot_win_minor' => 0,
|
||||
'winning_ticket_count' => 0,
|
||||
'has_bets' => false,
|
||||
]);
|
||||
}
|
||||
@@ -63,11 +65,20 @@ final class TicketDrawMyMatchController extends Controller
|
||||
->pluck('id');
|
||||
|
||||
$hasBets = $itemIds->isNotEmpty();
|
||||
$winningItemIds = TicketItem::query()
|
||||
->where('draw_id', $draw->id)
|
||||
->where('player_id', $player->id)
|
||||
->where('status', 'settled_win')
|
||||
->where(function ($q): void {
|
||||
$q->where('win_amount', '>', 0)
|
||||
->orWhere('jackpot_win_amount', '>', 0);
|
||||
})
|
||||
->pluck('id');
|
||||
|
||||
$hits = [];
|
||||
if ($hasBets) {
|
||||
if ($winningItemIds->isNotEmpty()) {
|
||||
$hits = TicketCombination::query()
|
||||
->whereIn('ticket_item_id', $itemIds)
|
||||
->whereIn('ticket_item_id', $winningItemIds)
|
||||
->pluck('number_4d')
|
||||
->map(fn ($n) => self::norm4d((string) $n))
|
||||
->filter(fn (string $n) => isset($board[$n]))
|
||||
@@ -88,6 +99,7 @@ final class TicketDrawMyMatchController extends Controller
|
||||
'hit_numbers_4d' => $hits,
|
||||
'total_win_minor' => (int) ($sums->sum_win ?? 0),
|
||||
'total_jackpot_win_minor' => (int) ($sums->sum_jackpot ?? 0),
|
||||
'winning_ticket_count' => $winningItemIds->count(),
|
||||
'has_bets' => $hasBets,
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user