From 7643740eda3ff501e5d82b2754ea2cc3e5efe8bc Mon Sep 17 00:00:00 2001 From: lkddi Date: Sat, 28 Feb 2026 13:50:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=9A=E4=BB=8A=E6=97=A5?= =?UTF-8?q?=E9=A3=8E=E4=BA=91=E6=A6=9C=E7=8B=AC=E7=AB=8B=E9=A1=B5=20/leade?= =?UTF-8?q?rboard/today=EF=BC=8C=E5=AF=BC=E8=88=AA=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E3=80=8C=E4=BB=8A=E6=97=A5=E6=A6=9C=E3=80=8D=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/LeaderboardController.php | 23 ++- resources/views/layouts/app.blade.php | 4 + resources/views/leaderboard/index.blade.php | 90 +---------- resources/views/leaderboard/today.blade.php | 147 ++++++++++++++++++ routes/web.php | 2 + 5 files changed, 183 insertions(+), 83 deletions(-) create mode 100644 resources/views/leaderboard/today.blade.php diff --git a/app/Http/Controllers/LeaderboardController.php b/app/Http/Controllers/LeaderboardController.php index 207cda4..5d8f4ff 100644 --- a/app/Http/Controllers/LeaderboardController.php +++ b/app/Http/Controllers/LeaderboardController.php @@ -100,10 +100,31 @@ class LeaderboardController extends Controller return view('leaderboard.index', compact( 'topLevels', 'topExp', 'topWealth', 'topCharm', - 'todayExp', 'todayGold', 'todayCharm', )); } + /** + * 今日风云榜独立页(经验/金币/魅力今日排行) + */ + public function todayIndex(): View + { + $todayTtl = 60 * 5; + $today = today()->toDateString(); + $topN = (int) \App\Models\Sysparam::getValue('leaderboard_limit', '20'); + + $todayExp = Cache::remember("leaderboard:today_exp:{$today}", $todayTtl, + fn () => $this->currencyService->todayLeaderboard('exp', $topN, $today) + ); + $todayGold = Cache::remember("leaderboard:today_gold:{$today}", $todayTtl, + fn () => $this->currencyService->todayLeaderboard('gold', $topN, $today) + ); + $todayCharm = Cache::remember("leaderboard:today_charm:{$today}", $todayTtl, + fn () => $this->currencyService->todayLeaderboard('charm', $topN, $today) + ); + + return view('leaderboard.today', compact('todayExp', 'todayGold', 'todayCharm')); + } + /** * 用户个人流水日志页(查询自己的经验/金币/魅力操作历史) */ diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index f9accc7..890d29f 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -75,6 +75,10 @@ class="text-yellow-400 hover:text-yellow-300 font-bold flex items-center transition hidden sm:flex"> 🏆 风云榜 +
@@ -107,83 +111,5 @@ - - {{-- ═══ 今日榜(每5分钟更新,来自流水记录表)═══ --}} -

- 📅 今日排行榜 - (今日获得量排名,5分钟更新) -

- -
- - {{-- 今日经验榜 --}} -
-
-

⚡ 今日修为榜

- 今日Exp -
-
- @if ($todayExp->isEmpty()) -

今日暂无记录

- @else - @foreach ($todayExp as $i => $row) -
- {{ $i + 1 }} - {{ $row->username }} - +{{ number_format($row->total) }} -
- @endforeach - @endif -
-
- - {{-- 今日金币榜 --}} -
-
-

💰 今日财富榜

- 今日Coin -
-
- @if ($todayGold->isEmpty()) -

今日暂无记录

- @else - @foreach ($todayGold as $i => $row) -
- {{ $i + 1 }} - {{ $row->username }} - +{{ number_format($row->total) }} -
- @endforeach - @endif -
-
- - {{-- 今日魅力榜 --}} -
-
-

🌸 今日魅力榜

- 今日Charm -
-
- @if ($todayCharm->isEmpty()) -

今日暂无记录

- @else - @foreach ($todayCharm as $i => $row) -
- {{ $i + 1 }} - {{ $row->username }} - +{{ number_format($row->total) }} -
- @endforeach - @endif -
-
- -
- - @endsection diff --git a/resources/views/leaderboard/today.blade.php b/resources/views/leaderboard/today.blade.php new file mode 100644 index 0000000..7d80c7b --- /dev/null +++ b/resources/views/leaderboard/today.blade.php @@ -0,0 +1,147 @@ +{{-- + 文件功能:今日风云榜页面(独立页) + 展示今日经验成长榜、今日金币获得榜、今日魅力增长榜 + 数据来自 user_currency_logs 流水表,5分钟缓存刷新 + 风格与累计风云榜一致 + + @extends layouts.app +--}} +@extends('layouts.app') + +@section('title', '今日风云榜 - 飘落流星') + +@section('nav-icon', '📅') +@section('nav-title', '今日风云榜') + +@section('content') + {{-- 说明条 --}} +
+
+

🌅 今日榜每 5分钟 + 自动刷新,统计今日所有正向积分获得量,凌晨清零重启。

+ +
+
+ + {{-- 主内容区 --}} +
+
+ +
+ + {{-- 今日经验榜 --}} +
+
+

今日修为榜

+ 今日Exp +
+
+ @if ($todayExp->isEmpty()) +
+ 😴 +

今日暂无记录

+
+ @else + @foreach ($todayExp as $i => $row) +
+ @if ($i === 0) + 🥇 + @elseif ($i === 1) + 🥈 + @elseif ($i === 2) + 🥉 + @else + {{ $i + 1 }} + @endif + {{ $row->username }} + +{{ number_format($row->total) }} +
+ @endforeach + @endif +
+
+ + {{-- 今日金币榜 --}} +
+
+

💰 今日财富榜

+ 今日Coin +
+
+ @if ($todayGold->isEmpty()) +
+ 😴 +

今日暂无记录

+
+ @else + @foreach ($todayGold as $i => $row) +
+ @if ($i === 0) + 🥇 + @elseif ($i === 1) + 🥈 + @elseif ($i === 2) + 🥉 + @else + {{ $i + 1 }} + @endif + {{ $row->username }} + +{{ number_format($row->total) }} +
+ @endforeach + @endif +
+
+ + {{-- 今日魅力榜 --}} +
+
+

🌸 今日魅力榜

+ 今日Charm +
+
+ @if ($todayCharm->isEmpty()) +
+ 😴 +

今日暂无记录

+
+ @else + @foreach ($todayCharm as $i => $row) +
+ @if ($i === 0) + 🥇 + @elseif ($i === 1) + 🥈 + @elseif ($i === 2) + 🥉 + @else + {{ $i + 1 }} + @endif + {{ $row->username }} + +{{ number_format($row->total) }} +
+ @endforeach + @endif +
+
+ +
+ +

凌晨 00:00 自动重置 · 数据每 5 分钟刷新

+
+
+@endsection diff --git a/routes/web.php b/routes/web.php index 1bdae9e..e8773a8 100644 --- a/routes/web.php +++ b/routes/web.php @@ -40,6 +40,8 @@ Route::middleware(['chat.auth'])->group(function () { // ---- 第九阶段:外围矩阵 - 风云排行榜 ---- Route::get('/leaderboard', [\App\Http\Controllers\LeaderboardController::class, 'index'])->name('leaderboard.index'); + // 今日风云榜(独立页,经验/金币/魅力今日排行) + Route::get('/leaderboard/today', [\App\Http\Controllers\LeaderboardController::class, 'todayIndex'])->name('leaderboard.today'); // 用户个人积分流水日志(查询自己的经验/金币/魅力历史) Route::get('/my/currency-logs', [\App\Http\Controllers\LeaderboardController::class, 'myLogs'])->name('currency.my-logs');