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 @@
${card.items.map(item => ` -
- ${item.label} - ${item.value} -
- `).join('')} +
+ ${item.label} + ${item.value} +
+ `).join('')}
`).join(''); diff --git a/resources/views/admin/game-history/lottery-issue.blade.php b/resources/views/admin/game-history/lottery-issue.blade.php new file mode 100644 index 0000000..addcdcd --- /dev/null +++ b/resources/views/admin/game-history/lottery-issue.blade.php @@ -0,0 +1,133 @@ +@extends('admin.layouts.app') + +@section('title', "双色球第 {$issue->issue_number} 期购买明细") + +@section('content') +
+ + {{-- 页头 --}} +
+
+

🎟️ 双色球 第 {{ $issue->issue_number }} 期购买明细

+

+ 开奖时间:{{ $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) }} + 金币 +

+
+ + ← 返回期号列表 + +
+ + {{-- 购买明细表 --}} +
+ + + + + + + + + + + + + + @forelse ($tickets as $ticket) + @php + $won = ($ticket->prize_amount ?? 0) > 0; + // 拆分红蓝球显示 + $selectedBalls = is_string($ticket->selected_balls) + ? json_decode($ticket->selected_balls, true) + : $ticket->selected_balls; + $selReds = $selectedBalls['red'] ?? []; + $selBlue = $selectedBalls['blue'] ?? null; + @endphp + + + + + + + + + + @empty + + + + @endforelse + +
玩家投注号码彩票类型花费奖金获得中奖等级下注时间
+ {{ $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') }} +
本期暂无人购买
+ + @if ($tickets->hasPages()) +
+ {{ $tickets->links() }} +
+ @endif +
+
+@endsection diff --git a/resources/views/admin/game-history/lottery.blade.php b/resources/views/admin/game-history/lottery.blade.php new file mode 100644 index 0000000..e49487a --- /dev/null +++ b/resources/views/admin/game-history/lottery.blade.php @@ -0,0 +1,122 @@ +@extends('admin.layouts.app') + +@section('title', '双色球彩票开奖记录') + +@section('content') +
+ + {{-- 页头 --}} +
+
+

🎟️ 双色球彩票历史记录

+

查询各期双色球的开奖结果及购买明细。

+
+ + ⚙️ 游戏配置 + +
+ + {{-- 统计卡片 --}} +
+
+
{{ number_format($summary['total_issues']) }}
+
历史总期数
+
+
+
{{ number_format($summary['drawn_count']) }}
+
已开奖期数
+
+
+
{{ number_format($summary['total_tickets']) }}
+
历史售出彩票
+
+
+
{{ number_format($summary['total_pool']) }}
+
历史开奖总奖池
+
+
+ + {{-- 期数列表 --}} +
+ + + + + + + + + + + + + + @forelse ($issues as $issue) + + + + + + + + + + @empty + + + + @endforelse + +
期号开奖时间状态开奖号码售出票数期奖池操作
第 {{ $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) }} + + + 购买明细 + +
暂无记录
+ + @if ($issues->hasPages()) +
+ {{ $issues->links() }} +
+ @endif +
+
+@endsection diff --git a/routes/web.php b/routes/web.php index 7d2a4ab..4e85924 100644 --- a/routes/web.php +++ b/routes/web.php @@ -458,6 +458,9 @@ Route::middleware(['chat.auth', 'chat.has_position'])->prefix('admin')->name('ad Route::get('/mystery-box', [\App\Http\Controllers\Admin\GameHistoryController::class, 'mysteryBox'])->name('mystery-box'); // 神秘占卜历史 Route::get('/fortune', [\App\Http\Controllers\Admin\GameHistoryController::class, 'fortune'])->name('fortune'); + // 彩票场次历史 + Route::get('/lottery', [\App\Http\Controllers\Admin\GameHistoryController::class, 'lottery'])->name('lottery'); + Route::get('/lottery/{issue}', [\App\Http\Controllers\Admin\GameHistoryController::class, 'lotteryIssue'])->name('lottery.issue'); }); // 📦 神秘箱子:管理员手动投放