diff --git a/app/Http/Controllers/Admin/GameHistoryController.php b/app/Http/Controllers/Admin/GameHistoryController.php index 0b1af7b..74f4683 100644 --- a/app/Http/Controllers/Admin/GameHistoryController.php +++ b/app/Http/Controllers/Admin/GameHistoryController.php @@ -19,6 +19,8 @@ use App\Models\BaccaratRound; use App\Models\FortuneLog; use App\Models\HorseBet; use App\Models\HorseRace; +use App\Models\LotteryIssue; +use App\Models\LotteryTicket; use App\Models\MysteryBox; use App\Models\SlotMachineLog; use Illuminate\Http\JsonResponse; @@ -73,12 +75,21 @@ class GameHistoryController extends Controller 'today_times' => FortuneLog::query()->whereDate('created_at', today())->count(), ]; + // 彩票 + $lottery = [ + 'total_issues' => LotteryIssue::query()->count(), + 'total_bets' => LotteryTicket::query()->count(), + 'total_pool' => LotteryIssue::query()->where('status', 'drawn')->sum('prize_pool'), + 'today_issues' => LotteryIssue::query()->whereDate('created_at', today())->count(), + ]; + return response()->json([ 'baccarat' => $baccarat, 'slot' => $slot, 'horse' => $horse, 'mystery_box' => $mysteryBox, 'fortune' => $fortune, + 'lottery' => $lottery, ]); } @@ -241,4 +252,33 @@ class GameHistoryController extends Controller return view('admin.game-history.fortune', compact('logs', 'summary')); } + + /** + * 双色球彩票历史记录页面(期号列表,支持分页)。 + */ + public function lottery(Request $request): View + { + $summary = [ + 'total_issues' => LotteryIssue::query()->count(), + 'total_tickets' => LotteryTicket::query()->count(), + 'total_pool' => (int) LotteryIssue::query()->sum('prize_pool'), + 'drawn_count' => LotteryIssue::query()->where('status', 'drawn')->count(), + ]; + + $issues = LotteryIssue::query() + ->latest() + ->paginate(20); + + return view('admin.game-history.lottery', compact('issues', 'summary')); + } + + /** + * 双色球单期购买明细与中奖详情。 + */ + public function lotteryIssue(LotteryIssue $issue): View + { + $tickets = $issue->tickets()->with('user')->latest()->paginate(30); + + return view('admin.game-history.lottery-issue', compact('issue', 'tickets')); + } } diff --git a/resources/views/admin/game-configs/index.blade.php b/resources/views/admin/game-configs/index.blade.php index 2fb1fbc..b86c957 100644 --- a/resources/views/admin/game-configs/index.blade.php +++ b/resources/views/admin/game-configs/index.blade.php @@ -64,6 +64,7 @@ 'mystery_box' => 'admin.game-history.mystery-box', 'horse_racing' => 'admin.game-history.horse', 'fortune_telling' => 'admin.game-history.fortune', + 'lottery' => 'admin.game-history.lottery', default => null, }; @endphp @@ -477,16 +478,34 @@ value: data.fortune.total_times.toLocaleString() + ' 次' }, { - label: '上上签', - value: data.fortune.jackpot_count.toLocaleString() + label: '吉签/凶签', + value: data.fortune.jackpot_count + ' / ' + data.fortune.curse_count }, { - label: '今日次数', + label: '今日占卜', value: data.fortune.today_times.toLocaleString() }, ], - color: 'border-indigo-200 bg-indigo-50', + color: 'border-fuchsia-200 bg-fuchsia-50', }, + { + icon: '🎟️', + title: '双色球彩票', + items: [{ + label: '总期数', + value: data.lottery.total_issues.toLocaleString() + ' 期' + }, + { + label: '历史彩票', + value: data.lottery.total_bets.toLocaleString() + ' 张' + }, + { + label: '累计奖池', + value: data.lottery.total_pool.toLocaleString() + ' 金' + }, + ], + color: 'border-rose-200 bg-rose-50', + } ]; grid.innerHTML = cards.map(card => ` @@ -497,11 +516,11 @@
+ 开奖时间:{{ $issue->draw_time?->format('Y-m-d H:i:s') ?? '未开奖' }} + @if ($issue->status === 'drawn') + · 开奖号码: + + @php + $balls = is_string($issue->winning_balls) + ? json_decode($issue->winning_balls, true) + : $issue->winning_balls; + $reds = $balls['red'] ?? []; + $blue = $balls['blue'] ?? null; + @endphp + @foreach ($reds as $r) + {{ $r }} + @endforeach + @if ($blue) + {{ $blue }} + @endif + + @endif + · 奖池:{{ number_format($issue->prize_pool ?? 0) }} + 金币 +
+| 玩家 | +投注号码 | +彩票类型 | +花费 | +奖金获得 | +中奖等级 | +下注时间 | +
|---|---|---|---|---|---|---|
| + {{ $ticket->user?->username ?? '已注销' }} + | +
+
+ @foreach ($selReds as $r)
+ {{ $r }}
+ @endforeach
+ @if ($selBlue)
+ {{ $selBlue }}
+ @endif
+
+ |
+ + @if ($ticket->is_quick_pick) + 随机机选 + @else + 自选号码 + @endif + | ++ {{ number_format($ticket->cost_amount) }} + | ++ {{ $won ? '+' . number_format($ticket->prize_amount) : '0' }} + | ++ @if ($issue->status === 'drawn') + @if ($won) + + 🎉 {{ $ticket->prize_level }}等奖 + + @else + 未中奖 + @endif + @else + 等待开奖 + @endif + | ++ {{ $ticket->created_at->format('H:i:s') }} + | +
| 本期暂无人购买 | +||||||
查询各期双色球的开奖结果及购买明细。
+| 期号 | +开奖时间 | +状态 | +开奖号码 | +售出票数 | +期奖池 | +操作 | +
|---|---|---|---|---|---|---|
| 第 {{ $issue->issue_number }} 期 + | ++ {{ $issue->draw_time ? $issue->draw_time->format('m-d H:i') : '—' }} + | ++ @if ($issue->status === 'drawn') + 已开奖 + @else + 销售中 + @endif + | +
+ @if ($issue->winning_balls)
+ @php
+ $balls = is_string($issue->winning_balls)
+ ? json_decode($issue->winning_balls, true)
+ : $issue->winning_balls;
+ $reds = $balls['red'] ?? [];
+ $blue = $balls['blue'] ?? null;
+ @endphp
+
+ @foreach ($reds as $r)
+ {{ $r }}
+ @endforeach
+ @if ($blue)
+ {{ $blue }}
+ @endif
+
+ @else
+ 等待开奖
+ @endif
+ |
+ + {{ number_format($issue->tickets_count) }} + | ++ {{ number_format($issue->prize_pool) }} + | ++ + 购买明细 + + | +
| 暂无记录 | +||||||