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"> 🏆 风云榜 +
📊 - 查看我的积分日志 → +

✨ 数据每 15分钟 + 自动刷新一次。努力提升自己,让全服铭记你的名字!

+
@@ -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');