Files
chatroom/resources/views/admin/game-history/horse.blade.php
T
lkddi b62a9f6240 功能:后台游戏历史记录查询中心 + 游戏管理页实时统计
- 新增 GameHistoryController,提供各游戏历史记录查询接口
  - 百家乐:局次列表 + 单局下注明细(含结果分布统计)
  - 老虎机:转动记录含图案分布,支持结果类型/玩家名筛选
  - 赛马:场次列表 + 单场下注明细(含马匹信息展示)
  - 神秘箱子:投放/领取历史,支持箱子类型/领取状态筛选
  - 神秘占卜:签文等级分布统计 + 历史记录,支持等级/玩家名筛选
- 新增 /admin/game-history/ 路由组(stats + 各游戏历史 + 单局详情共9条路由)
- 游戏管理页(/admin/game-configs)优化:
  - 每个游戏卡片新增「📋 历史记录」直达按钮
  - 新增「📊 加载实时统计」按钮,AJAX 异步拉取并展示各游戏汇总卡片
- 更新 GAMES_TODO.md,标记通用待办已完成
2026-03-03 23:40:31 +08:00

114 lines
6.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@extends('admin.layouts.app')
@section('title', '赛马竞猜历史记录')
@section('content')
<div class="space-y-6">
{{-- 页头 --}}
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6 flex justify-between items-center">
<div>
<h2 class="text-lg font-bold text-gray-800">🐎 赛马竞猜历史记录</h2>
<p class="text-xs text-gray-500 mt-1">查询所有已完成的赛马场次及下注明细。</p>
</div>
<a href="{{ route('admin.game-configs.index') }}"
class="px-4 py-2 bg-gray-100 text-gray-700 rounded-lg text-sm font-bold hover:bg-gray-200 transition">
⚙️ 游戏配置
</a>
</div>
{{-- 统计卡片 --}}
<div class="grid grid-cols-2 md:grid-cols-3 gap-4">
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-5">
<div class="text-2xl font-bold text-indigo-600">{{ number_format($summary['total_races']) }}</div>
<div class="text-xs text-gray-500 mt-1">历史总场次</div>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-5">
<div class="text-2xl font-bold text-amber-600">{{ number_format($summary['total_bets']) }}</div>
<div class="text-xs text-gray-500 mt-1">历史总下注笔</div>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-5">
<div class="text-2xl font-bold text-emerald-600">{{ number_format($summary['total_pool']) }}</div>
<div class="text-xs text-gray-500 mt-1">累计注池金币</div>
</div>
</div>
{{-- 场次列表 --}}
<div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
<table class="w-full text-sm">
<thead class="bg-gray-50 border-b border-gray-100">
<tr>
<th class="px-4 py-3 text-left text-xs font-bold text-gray-500 uppercase">场次ID</th>
<th class="px-4 py-3 text-left text-xs font-bold text-gray-500 uppercase">结算时间</th>
<th class="px-4 py-3 text-center text-xs font-bold text-gray-500 uppercase">参赛马匹</th>
<th class="px-4 py-3 text-center text-xs font-bold text-gray-500 uppercase">胜者</th>
<th class="px-4 py-3 text-center text-xs font-bold text-gray-500 uppercase">状态</th>
<th class="px-4 py-3 text-right text-xs font-bold text-gray-500 uppercase">下注总笔</th>
<th class="px-4 py-3 text-right text-xs font-bold text-gray-500 uppercase">注池总额</th>
<th class="px-4 py-3 text-right text-xs font-bold text-gray-500 uppercase">操作</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-50">
@forelse ($races as $race)
@php
$horses = $race->horses ?? [];
$winner = collect($horses)->firstWhere('id', $race->winner_horse_id);
$statusLabel = match ($race->status) {
'betting' => ['label' => '押注中', 'color' => 'bg-blue-100 text-blue-700'],
'running' => ['label' => '比赛中', 'color' => 'bg-amber-100 text-amber-700'],
'settled' => ['label' => '已结算', 'color' => 'bg-emerald-100 text-emerald-700'],
'canceled' => ['label' => '已取消', 'color' => 'bg-red-100 text-red-600'],
default => ['label' => $race->status, 'color' => 'bg-gray-100 text-gray-500'],
};
@endphp
<tr class="hover:bg-gray-50 transition">
<td class="px-4 py-3 text-gray-400 text-xs font-mono">#{{ $race->id }}</td>
<td class="px-4 py-3 text-xs text-gray-600">
{{ $race->settled_at ? $race->settled_at->format('m-d H:i') : '—' }}
</td>
<td class="px-4 py-3 text-center text-sm">
{{ collect($horses)->pluck('emoji')->implode('') ?: '—' }}
<span class="text-xs text-gray-400">{{ count($horses) }} 匹)</span>
</td>
<td class="px-4 py-3 text-center font-bold text-indigo-700">
@if ($winner)
{{ $winner['emoji'] ?? '' }} {{ $winner['name'] ?? '' }}
@else
<span class="text-gray-400"></span>
@endif
</td>
<td class="px-4 py-3 text-center">
<span class="px-2 py-0.5 rounded-full text-xs font-bold {{ $statusLabel['color'] }}">
{{ $statusLabel['label'] }}
</span>
</td>
<td class="px-4 py-3 text-right font-mono text-xs text-indigo-600 font-bold">
{{ number_format($race->total_bets ?? 0) }}
</td>
<td class="px-4 py-3 text-right font-mono text-xs text-amber-600 font-bold">
{{ number_format($race->total_pool ?? 0) }}
</td>
<td class="px-4 py-3 text-right">
<a href="{{ route('admin.game-history.horse.race', $race->id) }}"
class="px-3 py-1 bg-indigo-50 text-indigo-700 rounded text-xs font-bold hover:bg-indigo-100 transition">
下注明细
</a>
</td>
</tr>
@empty
<tr>
<td colspan="8" class="px-4 py-10 text-center text-gray-400 text-sm">暂无记录</td>
</tr>
@endforelse
</tbody>
</table>
@if ($races->hasPages())
<div class="px-4 py-3 border-t border-gray-100">
{{ $races->links() }}
</div>
@endif
</div>
</div>
@endsection