feat: 新建前台百家乐历史走势页面与珠盘路,打通大厅与导航栏快捷入口

This commit is contained in:
pllx
2026-06-30 14:12:45 +08:00
parent 394e216b92
commit 524c8ed6f3
5 changed files with 289 additions and 2 deletions
@@ -235,4 +235,28 @@ class BaccaratController extends Controller
return response()->json(['history' => $rounds]);
}
/**
* 前台百家乐历史走势与开奖页面。
*/
public function historyPage(Request $request): \Illuminate\View\View
{
// 1. 各选项的历史分布统计
$summary = [
'total_rounds' => BaccaratRound::query()->where('status', 'settled')->count(),
'result_dist' => BaccaratRound::query()
->where('status', 'settled')
->select('result', \Illuminate\Support\Facades\DB::raw('count(*) as cnt'))
->groupBy('result')
->pluck('cnt', 'result'),
];
// 2. 分页拉取所有已结算的局次
$rounds = BaccaratRound::query()
->where('status', 'settled')
->orderByDesc('id')
->paginate(30);
return view('rooms.baccarat-history', compact('rounds', 'summary'));
}
}
+8
View File
@@ -91,6 +91,10 @@
class="text-indigo-200 hover:text-white font-bold flex items-center transition hidden sm:flex">
大厅
</a>
<a href="{{ route('baccarat.history-page') }}"
class="text-red-400 hover:text-red-300 font-bold flex items-center transition hidden sm:flex {{ request()->routeIs('baccarat.*') ? 'text-red-200 underline underline-offset-4' : '' }}">
🎲 百家乐
</a>
<a href="{{ route('invite.leaderboard') }}"
class="text-rose-400 hover:text-rose-300 font-bold flex items-center transition hidden sm:flex {{ request()->routeIs('invite.leaderboard') ? 'text-rose-200 underline underline-offset-4' : '' }}">
邀请排行
@@ -176,6 +180,10 @@
class="px-4 py-2.5 text-indigo-100 hover:bg-indigo-700 hover:text-white font-medium border-l-4 {{ request()->routeIs('rooms.index') ? 'border-indigo-400 bg-indigo-700/50' : 'border-transparent' }}">
大厅
</a>
<a href="{{ route('baccarat.history-page') }}"
class="px-4 py-2.5 text-red-300 hover:bg-indigo-700 hover:text-red-200 font-medium border-l-4 {{ request()->routeIs('baccarat.*') ? 'border-red-400 bg-indigo-700/50' : 'border-transparent' }}">
🎲 百家乐
</a>
<a href="{{ route('invite.leaderboard') }}"
class="px-4 py-2.5 text-rose-300 hover:bg-indigo-700 hover:text-rose-200 font-medium border-l-4 {{ request()->routeIs('invite.leaderboard') ? 'border-rose-400 bg-indigo-700/50' : 'border-transparent' }}">
邀请排行
@@ -0,0 +1,239 @@
@extends('layouts.app')
@section('title', '百家乐开奖走势 - 飘落流星')
@section('head')
<style>
/* 珠盘路横向滚动条美化 */
.custom-scrollbar::-webkit-scrollbar {
height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background-color: #4b5563;
border-radius: 9999px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background-color: #1f2937;
border-radius: 9999px;
}
</style>
@endsection
@section('content')
<div class="bg-gray-950 min-h-screen text-gray-100 py-10 px-4 sm:px-6 lg:px-8">
<div class="max-w-7xl mx-auto">
{{-- 顶部标题与返回 --}}
<div class="mb-8 flex flex-col md:flex-row md:items-center md:justify-between border-b border-gray-800 pb-6 gap-4">
<div>
<h2 class="text-3xl font-extrabold tracking-tight text-white flex items-center gap-3">
<span class="text-4xl">🎲</span> 百家乐开奖走势
</h2>
<p class="mt-2 text-sm text-gray-400">公开频段历史百家乐开奖记录、点数分布以及最新珠盘路大趋势。</p>
</div>
<a href="{{ route('rooms.index') }}"
class="inline-flex items-center gap-2 px-4 py-2 border border-gray-700 bg-gray-900 text-gray-300 rounded-xl text-sm font-semibold hover:bg-gray-800 hover:text-white transition shadow-sm self-start">
&larr; 返回大厅
</a>
</div>
{{-- 统计指标卡片组 --}}
<div class="grid grid-cols-2 md:grid-cols-5 gap-4 mb-8">
<div class="bg-gray-900/60 backdrop-blur-md rounded-2xl border border-gray-800 p-5 shadow-lg">
<div class="text-3xl font-extrabold text-indigo-400 font-mono">{{ number_format($summary['total_rounds']) }}</div>
<div class="mt-2 text-xs text-gray-400 font-bold uppercase tracking-wider">历史总局数</div>
</div>
@php
$dist = $summary['result_dist'];
$total = max(1, $summary['total_rounds']);
$bigPercent = round((($dist['big'] ?? 0) / $total) * 100, 1);
$smallPercent = round((($dist['small'] ?? 0) / $total) * 100, 1);
$triplePercent = round((($dist['triple'] ?? 0) / $total) * 100, 1);
$killPercent = round((($dist['kill'] ?? 0) / $total) * 100, 1);
@endphp
<div class="bg-gray-900/60 backdrop-blur-md rounded-2xl border border-red-900/30 p-5 shadow-lg">
<div class="text-3xl font-extrabold text-red-500 font-mono">{{ $bigPercent }}%</div>
<div class="mt-2 text-xs text-gray-400 font-bold flex items-center justify-between">
<span>开大比例</span>
<span class="text-red-400 font-mono">{{ $dist['big'] ?? 0 }} </span>
</div>
</div>
<div class="bg-gray-900/60 backdrop-blur-md rounded-2xl border border-blue-900/30 p-5 shadow-lg">
<div class="text-3xl font-extrabold text-blue-500 font-mono">{{ $smallPercent }}%</div>
<div class="mt-2 text-xs text-gray-400 font-bold flex items-center justify-between">
<span>开小比例</span>
<span class="text-blue-400 font-mono">{{ $dist['small'] ?? 0 }} </span>
</div>
</div>
<div class="bg-gray-900/60 backdrop-blur-md rounded-2xl border border-purple-900/30 p-5 shadow-lg">
<div class="text-3xl font-extrabold text-purple-500 font-mono">{{ $triplePercent }}%</div>
<div class="mt-2 text-xs text-gray-400 font-bold flex items-center justify-between">
<span>开豹比例</span>
<span class="text-purple-400 font-mono">{{ $dist['triple'] ?? 0 }} </span>
</div>
</div>
<div class="bg-gray-900/60 backdrop-blur-md rounded-2xl border border-gray-800 p-5 shadow-lg col-span-2 md:col-span-1">
<div class="text-3xl font-extrabold text-gray-400 font-mono">{{ $killPercent }}%</div>
<div class="mt-2 text-xs text-gray-400 font-bold flex items-center justify-between">
<span>开收割比例</span>
<span class="text-gray-300 font-mono">{{ $dist['kill'] ?? 0 }} </span>
</div>
</div>
</div>
{{-- 珠盘路大趋势走势图 --}}
<div class="bg-gray-900 rounded-2xl p-6 border border-gray-800 shadow-xl overflow-hidden mb-8">
<div class="flex items-center justify-between mb-4">
<h3 class="text-sm font-bold text-gray-400 flex items-center gap-2">
<span>📊 珠盘路走势板(最近 30 局)</span>
</h3>
<span class="text-[10px] bg-gray-800 text-gray-400 px-2 py-0.5 rounded-full font-mono">从左往右为历史开奖顺序</span>
</div>
<div class="flex space-x-2 overflow-x-auto pb-3 custom-scrollbar">
@forelse($rounds->take(30)->reverse() as $r)
<div class="flex flex-col items-center justify-center shrink-0 w-14 h-20 rounded-xl bg-gray-950/80 border border-gray-800/80 p-1.5 shadow-inner">
<span class="text-[9px] text-gray-600 font-mono font-medium">#{{ $r->id }}</span>
@php
$colorClass = match ($r->result) {
'big' => 'bg-gradient-to-br from-red-500 to-red-600 text-white shadow-red-500/20 border-red-400',
'small' => 'bg-gradient-to-br from-blue-500 to-blue-600 text-white shadow-blue-500/20 border-blue-400',
'triple' => 'bg-gradient-to-br from-purple-500 to-purple-600 text-white shadow-purple-500/20 border-purple-400',
default => 'bg-gradient-to-br from-gray-600 to-gray-700 text-gray-200 border-gray-500',
};
$label = match ($r->result) {
'big' => '大',
'small' => '小',
'triple' => '豹',
default => '割',
};
@endphp
<div class="my-1.5 w-7 h-7 rounded-full border-2 flex items-center justify-center text-xs font-black shadow-md {{ $colorClass }}">
{{ $label }}
</div>
<span class="text-[9px] text-gray-400 font-bold font-mono">{{ $r->total_points }} </span>
</div>
@empty
<div class="w-full py-6 text-center text-gray-600 text-xs">暂无走势数据</div>
@endforelse
</div>
</div>
{{-- 历史记录数据表 --}}
<div class="bg-gray-900 rounded-2xl border border-gray-800 shadow-xl overflow-hidden">
<div class="px-6 py-5 border-b border-gray-800 flex justify-between items-center bg-gray-900/50">
<h3 class="font-bold text-base text-white">百家乐局次历史记录</h3>
<span class="text-xs text-gray-500">仅展示已结算局次数据</span>
</div>
<div class="overflow-x-auto">
<table class="w-full text-left border-collapse">
<thead>
<tr class="border-b border-gray-800 text-xs text-gray-400 uppercase tracking-wider bg-gray-950/40">
<th class="px-6 py-4 font-bold">局号</th>
<th class="px-6 py-4 font-bold">结算时间</th>
<th class="px-6 py-4 font-bold text-center">骰子开出</th>
<th class="px-6 py-4 font-bold text-center">总点数</th>
<th class="px-6 py-4 font-bold text-center">开奖结果</th>
<th class="px-6 py-4 font-bold text-right">全场总押注</th>
<th class="px-6 py-4 font-bold text-right">全场派奖金币</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-800 text-sm">
@forelse ($rounds as $round)
<tr class="hover:bg-gray-800/20 transition-colors">
<td class="px-6 py-4 font-mono text-gray-400 font-medium">#{{ $round->id }}</td>
<td class="px-6 py-4 text-gray-400 text-xs">
{{ $round->settled_at ? $round->settled_at->format('m-d H:i') : '—' }}
</td>
<td class="px-6 py-4 text-center">
<div class="inline-flex gap-1.5 justify-center">
@for ($i = 1; $i <= 3; $i++)
@php $diceVal = $round->{'dice'.$i}; @endphp
@if ($diceVal)
<span class="w-7 h-7 inline-flex items-center justify-center bg-gray-800 border border-gray-700 text-white font-black rounded-lg shadow-inner text-xs font-mono">
{{ $diceVal }}
</span>
@else
<span class="text-gray-600"></span>
@endif
@endfor
</div>
</td>
<td class="px-6 py-4 text-center font-extrabold text-white font-mono text-base">
{{ $round->total_points ?? '—' }}
</td>
<td class="px-6 py-4 text-center">
@php
$resultStyles = [
'big' => 'bg-red-950/50 text-red-400 border-red-800/60',
'small' => 'bg-blue-950/50 text-blue-400 border-blue-800/60',
'triple' => 'bg-purple-950/50 text-purple-400 border-purple-800/60',
'kill' => 'bg-gray-900 text-gray-500 border-gray-800',
];
$labelText = match ($round->result) {
'big' => '大',
'small' => '小',
'triple' => '豹子',
'kill' => '收割',
default => $round->result ?? '—',
};
$borderStyle = $resultStyles[$round->result] ?? 'bg-gray-900 text-gray-500 border-gray-800';
@endphp
@if ($round->result)
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-black border {{ $borderStyle }}">
{{ $labelText }}
</span>
@else
<span class="text-gray-600">未结算</span>
@endif
</td>
<td class="px-6 py-4 text-right text-xs font-mono text-gray-400">
<div class="flex flex-col items-end">
<span class="font-bold text-gray-300">
{{ number_format(($round->total_bet_big ?? 0) + ($round->total_bet_small ?? 0) + ($round->total_bet_triple ?? 0)) }}
</span>
<span class="text-[9px] text-gray-500 mt-0.5">
:<span class="text-red-400">{{ number_format($round->total_bet_big ?? 0) }}</span> |
:<span class="text-blue-400">{{ number_format($round->total_bet_small ?? 0) }}</span> |
:<span class="text-purple-400">{{ number_format($round->total_bet_triple ?? 0) }}</span>
</span>
</div>
</td>
<td class="px-6 py-4 text-right font-mono font-extrabold text-amber-500 text-base">
{{ number_format($round->total_payout ?? 0) }}
</td>
</tr>
@empty
<tr>
<td colspan="7" class="px-6 py-12 text-center text-gray-500">
<p class="font-bold">暂无开奖记录</p>
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
{{-- 分页器美化 --}}
@if ($rounds->hasPages())
<div class="px-6 py-5 border-t border-gray-800 bg-gray-950/20">
{{-- Laravel 默认分页器兼容 --}}
<div class="baccarat-pagination-dark">
{{ $rounds->links() }}
</div>
</div>
@endif
</div>
</div>
</div>
@endsection
+17 -2
View File
@@ -60,9 +60,24 @@
<main class="max-w-7xl mx-auto py-10 px-4 sm:px-6 lg:px-8">
<div class="mb-6 flex justify-between items-end border-b pb-4">
<h2 class="text-xl font-bold text-gray-700">公开频段 (<span class="text-indigo-600">{{ $rooms->count() }}</span>)
<div class="mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between border-b pb-4 gap-4">
<h2 class="text-xl font-bold text-gray-700">
公开频段 (<span class="text-indigo-600">{{ $rooms->count() }}</span>)
</h2>
<div class="flex flex-wrap gap-2 text-xs">
<a href="{{ route('baccarat.history-page') }}"
class="inline-flex items-center gap-1.5 px-4 py-2 bg-gradient-to-r from-red-600 to-indigo-600 hover:from-red-700 hover:to-indigo-700 text-white rounded-xl font-bold shadow-md hover:shadow-lg transition transform hover:-translate-y-0.5">
🎲 百家乐开奖走势
</a>
<button @click="showCreateModal = true"
class="inline-flex items-center gap-1.5 px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-white rounded-xl font-bold shadow-md hover:shadow-lg transition transform hover:-translate-y-0.5 cursor-pointer">
新增私人频道
</button>
<button @click="showProfileModal = true"
class="inline-flex items-center gap-1.5 px-4 py-2 bg-gray-800 hover:bg-gray-900 text-white rounded-xl font-bold shadow-md hover:shadow-lg transition transform hover:-translate-y-0.5 cursor-pointer">
👤 个人设置
</button>
</div>
</div>
{{-- 房间瀑布流网格 --}}
+1
View File
@@ -170,6 +170,7 @@ Route::middleware(['chat.auth'])->group(function () {
Route::get('/current', [\App\Http\Controllers\BaccaratController::class, 'currentRound'])->name('current');
Route::post('/bet', [\App\Http\Controllers\BaccaratController::class, 'bet'])->name('bet');
Route::get('/history', [\App\Http\Controllers\BaccaratController::class, 'history'])->name('history');
Route::get('/history-page', [\App\Http\Controllers\BaccaratController::class, 'historyPage'])->name('history-page');
});
// ── 百家乐买单活动(前台)───────────────────────────────────────