From 289b79affed76764488fb2e5ec88188b28b7ca6b Mon Sep 17 00:00:00 2001 From: lkddi Date: Thu, 12 Mar 2026 08:52:33 +0800 Subject: [PATCH] =?UTF-8?q?feat(chat):=20=E5=A2=9E=E5=8A=A0=E4=BA=94?= =?UTF-8?q?=E5=AD=90=E6=A3=8B=E7=9A=84=E5=90=8E=E5=8F=B0=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=9F=A5=E9=98=85=E9=9D=A2=E6=9D=BF=E4=B8=8E?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/GameHistoryController.php | 31 +++++ .../views/admin/game-configs/index.blade.php | 29 +++- .../views/admin/game-history/gomoku.blade.php | 125 ++++++++++++++++++ routes/web.php | 2 + 4 files changed, 182 insertions(+), 5 deletions(-) create mode 100644 resources/views/admin/game-history/gomoku.blade.php diff --git a/app/Http/Controllers/Admin/GameHistoryController.php b/app/Http/Controllers/Admin/GameHistoryController.php index 74ee98d..a95502a 100644 --- a/app/Http/Controllers/Admin/GameHistoryController.php +++ b/app/Http/Controllers/Admin/GameHistoryController.php @@ -17,6 +17,7 @@ use App\Http\Controllers\Controller; use App\Models\BaccaratBet; use App\Models\BaccaratRound; use App\Models\FortuneLog; +use App\Models\GomokuGame; use App\Models\HorseBet; use App\Models\HorseRace; use App\Models\LotteryIssue; @@ -83,6 +84,14 @@ class GameHistoryController extends Controller 'today_issues' => LotteryIssue::query()->whereDate('created_at', today())->count(), ]; + // 五子棋 + $gomoku = [ + 'total_games' => GomokuGame::query()->count(), + 'pvp_count' => GomokuGame::query()->where('is_pvp', true)->count(), + 'pve_count' => GomokuGame::query()->where('is_pvp', false)->count(), + 'today_games' => GomokuGame::query()->whereDate('created_at', today())->count(), + ]; + return response()->json([ 'baccarat' => $baccarat, 'slot' => $slot, @@ -90,6 +99,7 @@ class GameHistoryController extends Controller 'mystery_box' => $mysteryBox, 'fortune' => $fortune, 'lottery' => $lottery, + 'gomoku' => $gomoku, ]); } @@ -281,4 +291,25 @@ class GameHistoryController extends Controller return view('admin.game-history.lottery-issue', compact('issue', 'tickets')); } + + /** + * 五子棋历史记录页面。 + */ + public function gomoku(Request $request): View + { + $summary = [ + 'total_games' => GomokuGame::query()->count(), + 'pvp_count' => GomokuGame::query()->where('is_pvp', true)->count(), + 'pve_count' => GomokuGame::query()->where('is_pvp', false)->count(), + 'completed' => GomokuGame::query()->where('status', 'finished')->count(), + 'today_games' => GomokuGame::query()->whereDate('created_at', today())->count(), + ]; + + $games = GomokuGame::query() + ->with(['playerBlack', 'playerWhite']) + ->latest() + ->paginate(30); + + return view('admin.game-history.gomoku', compact('games', 'summary')); + } } diff --git a/resources/views/admin/game-configs/index.blade.php b/resources/views/admin/game-configs/index.blade.php index b86c957..dc25361 100644 --- a/resources/views/admin/game-configs/index.blade.php +++ b/resources/views/admin/game-configs/index.blade.php @@ -65,6 +65,7 @@ 'horse_racing' => 'admin.game-history.horse', 'fortune_telling' => 'admin.game-history.fortune', 'lottery' => 'admin.game-history.lottery', + 'gomoku' => 'admin.game-history.gomoku', default => null, }; @endphp @@ -505,6 +506,24 @@ }, ], color: 'border-rose-200 bg-rose-50', + }, + { + icon: '♟️', + title: '五子棋', + items: [{ + label: '总对局', + value: data.gomoku.total_games.toLocaleString() + ' 局' + }, + { + label: '人机/对战', + value: data.gomoku.pve_count + ' / ' + data.gomoku.pvp_count + }, + { + label: '今日对局', + value: data.gomoku.today_games.toLocaleString() + }, + ], + color: 'border-blue-200 bg-blue-50', } ]; @@ -516,11 +535,11 @@
${card.items.map(item => ` -
- ${item.label} - ${item.value} -
- `).join('')} +
+ ${item.label} + ${item.value} +
+ `).join('')}
`).join(''); diff --git a/resources/views/admin/game-history/gomoku.blade.php b/resources/views/admin/game-history/gomoku.blade.php new file mode 100644 index 0000000..461d329 --- /dev/null +++ b/resources/views/admin/game-history/gomoku.blade.php @@ -0,0 +1,125 @@ +@extends('admin.layouts.app') + +@section('title', '五子棋对局记录') + +@section('content') +
+ + {{-- 页头 --}} +
+
+

♟️ 五子棋历史记录

+

查询全站所有的五子棋人机及 PvP 对局。

+
+ + ⚙️ 游戏配置 + +
+ + {{-- 统计卡片 --}} +
+
+
{{ number_format($summary['total_games']) }}
+
历史对局数
+
+
+
{{ number_format($summary['completed']) }}
+
正常完赛
+
+
+
{{ number_format($summary['pvp_count']) }}
+
PvP 人人对战数
+
+
+
{{ number_format($summary['today_games']) }}
+
今日新建对局
+
+
+ + {{-- 期数列表 --}} +
+ + + + + + + + + + + + + + @forelse ($games as $game) + + + + + + + + + + @empty + + + + @endforelse + +
赛事ID创建时间模式黑方 (发起)白方 (迎战)状态胜负
#{{ $game->id }} + {{ $game->created_at ? $game->created_at->format('m-d H:i') : '—' }} + + @if ($game->mode === 'pve') + 单机 + PvE(L{{ $game->ai_level }}) + @else + 在线 + PvP + @endif + + {{ $game->playerBlack?->username ?? '已注销/未知' }} + + @if ($game->mode === 'pve') + AI 机器人 + @else + {{ $game->playerWhite?->username ?? '已注销/未加入' }} + @endif + + @php + $s = match ($game->status) { + 'waiting' => ['label' => '等待中', 'bg' => 'bg-amber-100 text-amber-600'], + 'playing' => ['label' => '对弈中', 'bg' => 'bg-blue-100 text-blue-600'], + 'finished' => ['label' => '已结束', 'bg' => 'bg-emerald-100 text-emerald-700'], + default => ['label' => $game->status, 'bg' => 'bg-gray-100 text-gray-600'], + }; + @endphp + {{ $s['label'] }} + + @if ($game->status !== 'finished') + - + @else + @if ($game->winner === 1) + ⚫ + 黑胜 + @elseif($game->winner === 2) + ⚪ + 白胜 + @else + 平局撤销 + @endif + @endif +
暂无记录
+ + @if ($games->hasPages()) +
+ {{ $games->links() }} +
+ @endif +
+
+@endsection diff --git a/routes/web.php b/routes/web.php index 4e85924..2bf02e5 100644 --- a/routes/web.php +++ b/routes/web.php @@ -461,6 +461,8 @@ Route::middleware(['chat.auth', 'chat.has_position'])->prefix('admin')->name('ad // 彩票场次历史 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'); + // 五子棋历史 + Route::get('/gomoku', [\App\Http\Controllers\Admin\GameHistoryController::class, 'gomoku'])->name('gomoku'); }); // 📦 神秘箱子:管理员手动投放