From 61cfc2091cc9f0e2cbaf42b0ad55abdb88f9039c Mon Sep 17 00:00:00 2001 From: lkddi Date: Sun, 26 Apr 2026 17:54:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=A7=AF=E5=88=86=E6=B5=81?= =?UTF-8?q?=E6=B0=B4=E7=AD=9B=E9=80=89=E4=B8=8E=E7=94=A8=E6=88=B7=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/CurrencyLogController.php | 17 ++- .../Admin/CurrencyStatsController.php | 19 +-- .../Controllers/LeaderboardController.php | 15 +- app/Services/UserCurrencyService.php | 85 +++++++++-- .../views/admin/currency-logs/index.blade.php | 68 +++++++-- resources/views/admin/users/index.blade.php | 138 ++++++++++-------- resources/views/leaderboard/my-logs.blade.php | 54 ++++++- .../AdminCurrencyLogControllerTest.php | 64 ++++++++ .../AdminCurrencyStatsControllerTest.php | 86 +++++++++++ .../Feature/Feature/AdminUserManagerTest.php | 18 +++ tests/Feature/LeaderboardControllerTest.php | 100 ++++++++++++- 11 files changed, 555 insertions(+), 109 deletions(-) create mode 100644 tests/Feature/Feature/AdminCurrencyLogControllerTest.php create mode 100644 tests/Feature/Feature/AdminCurrencyStatsControllerTest.php diff --git a/app/Http/Controllers/Admin/CurrencyLogController.php b/app/Http/Controllers/Admin/CurrencyLogController.php index 68f3422..2564305 100644 --- a/app/Http/Controllers/Admin/CurrencyLogController.php +++ b/app/Http/Controllers/Admin/CurrencyLogController.php @@ -17,6 +17,9 @@ use App\Models\UserCurrencyLog; use Illuminate\Http\Request; use Illuminate\View\View; +/** + * 类功能:提供后台全局金币/积分流水查询与多条件筛选。 + */ class CurrencyLogController extends Controller { /** @@ -26,6 +29,12 @@ class CurrencyLogController extends Controller public function index(Request $request): View { $query = UserCurrencyLog::query()->with('user'); + $allSources = CurrencySource::cases(); + $allowedSources = collect($allSources)->map(fn (CurrencySource $source) => $source->value)->all(); + $selectedSources = collect($request->array('sources')) + ->filter(fn (string $source) => in_array($source, $allowedSources, true)) + ->values() + ->all(); // 查询条件过滤 if ($request->filled('username')) { @@ -36,8 +45,8 @@ class CurrencyLogController extends Controller $query->where('currency', $request->input('currency')); } - if ($request->filled('source')) { - $query->where('source', $request->input('source')); + if ($selectedSources !== []) { + $query->whereIn('source', $selectedSources); } if ($request->filled('remark')) { @@ -63,8 +72,6 @@ class CurrencyLogController extends Controller // 默认按时间倒序 $logs = $query->latest('id')->paginate(50)->withQueryString(); - $allSources = CurrencySource::cases(); - - return view('admin.currency-logs.index', compact('logs', 'allSources')); + return view('admin.currency-logs.index', compact('logs', 'allSources', 'selectedSources')); } } diff --git a/app/Http/Controllers/Admin/CurrencyStatsController.php b/app/Http/Controllers/Admin/CurrencyStatsController.php index e0ce4fb..4c0bbba 100644 --- a/app/Http/Controllers/Admin/CurrencyStatsController.php +++ b/app/Http/Controllers/Admin/CurrencyStatsController.php @@ -14,11 +14,13 @@ namespace App\Http\Controllers\Admin; use App\Enums\CurrencySource; use App\Http\Controllers\Controller; -use App\Models\UserCurrencyLog; use App\Services\UserCurrencyService; use Illuminate\Http\Request; use Illuminate\View\View; +/** + * 类功能:展示后台积分流水统计与指定日期净流通数据。 + */ class CurrencyStatsController extends Controller { /** @@ -45,20 +47,7 @@ class CurrencyStatsController extends Controller ); // 今日净流通量(正向增加 - 负向消耗),可判断通货膨胀 - $netFlow = []; - foreach (['exp', 'gold', 'charm'] as $currency) { - $totalIn = UserCurrencyLog::whereDate('created_at', $date) - ->where('currency', $currency)->where('amount', '>', 0) - ->sum('amount'); - $totalOut = UserCurrencyLog::whereDate('created_at', $date) - ->where('currency', $currency)->where('amount', '<', 0) - ->sum('amount'); - $netFlow[$currency] = [ - 'in' => $totalIn, - 'out' => abs($totalOut), - 'net' => $totalIn + $totalOut, // 净增量 - ]; - } + $netFlow = $this->currencyService->netFlowStats($date); // 所有已知来源(供视图展示缺失来源的空行) $allSources = CurrencySource::cases(); diff --git a/app/Http/Controllers/LeaderboardController.php b/app/Http/Controllers/LeaderboardController.php index a57368f..295dbd1 100644 --- a/app/Http/Controllers/LeaderboardController.php +++ b/app/Http/Controllers/LeaderboardController.php @@ -12,11 +12,15 @@ namespace App\Http\Controllers; +use App\Enums\CurrencySource; use App\Models\User; use App\Services\UserCurrencyService; use Illuminate\Support\Facades\Cache; use Illuminate\View\View; +/** + * 类功能:展示全站排行榜、今日排行榜与用户个人积分流水记录。 + */ class LeaderboardController extends Controller { /** @@ -133,8 +137,15 @@ class LeaderboardController extends Controller $user = auth()->user(); $currency = request('currency'); $days = (int) request('days', 7); - $logs = $this->currencyService->userLogs($user->id, $currency ?: null, $days); + $direction = in_array(request('direction'), ['income', 'expense'], true) ? request('direction') : null; + $sourceOptions = CurrencySource::cases(); + $allowedSources = collect($sourceOptions)->map(fn (CurrencySource $source) => $source->value)->all(); + $selectedSources = collect(request()->array('sources')) + ->filter(fn (string $source) => in_array($source, $allowedSources, true)) + ->values() + ->all(); + $logs = $this->currencyService->userLogs($user->id, $currency ?: null, $days, $direction, $selectedSources); - return view('leaderboard.my-logs', compact('logs', 'user', 'currency', 'days')); + return view('leaderboard.my-logs', compact('logs', 'user', 'currency', 'days', 'direction', 'sourceOptions', 'selectedSources')); } } diff --git a/app/Services/UserCurrencyService.php b/app/Services/UserCurrencyService.php index deaf665..b0c49dd 100644 --- a/app/Services/UserCurrencyService.php +++ b/app/Services/UserCurrencyService.php @@ -16,7 +16,9 @@ namespace App\Services; use App\Enums\CurrencySource; use App\Models\User; use App\Models\UserCurrencyLog; +use Carbon\CarbonImmutable; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\DB; /** @@ -165,15 +167,75 @@ class UserCurrencyService */ public function activityStats(?string $date = null): Collection { - $date = $date ?? today()->toDateString(); + [$date, $rangeStart, $rangeEnd] = $this->statsDateBounds($date); - return UserCurrencyLog::query() - ->whereDate('created_at', $date) - ->selectRaw('source, currency, SUM(amount) as total_amount, COUNT(DISTINCT user_id) as participant_count') - ->groupBy('source', 'currency') - ->orderBy('currency') - ->orderByRaw('ABS(SUM(amount)) DESC') - ->get(); + return Cache::remember("currency_stats:activity:{$date}", 300, function () use ($rangeStart, $rangeEnd) { + return UserCurrencyLog::query() + ->where('created_at', '>=', $rangeStart) + ->where('created_at', '<', $rangeEnd) + ->selectRaw('source, currency, SUM(amount) as total_amount, COUNT(DISTINCT user_id) as participant_count') + ->groupBy('source', 'currency') + ->orderBy('currency') + ->orderByRaw('ABS(SUM(amount)) DESC') + ->get(); + }); + } + + /** + * 查询某日三种货币的净流通量(流入、流出、净增)。 + * + * @param string|null $date 日期字符串如 '2026-02-28',默认今日 + * @return array + */ + public function netFlowStats(?string $date = null): array + { + [$date, $rangeStart, $rangeEnd] = $this->statsDateBounds($date); + + $rows = Cache::remember("currency_stats:net_flow:{$date}", 300, function () use ($rangeStart, $rangeEnd) { + return UserCurrencyLog::query() + ->where('created_at', '>=', $rangeStart) + ->where('created_at', '<', $rangeEnd) + ->selectRaw(' + currency, + SUM(CASE WHEN amount > 0 THEN amount ELSE 0 END) as total_in, + ABS(SUM(CASE WHEN amount < 0 THEN amount ELSE 0 END)) as total_out, + SUM(amount) as net_total + ') + ->groupBy('currency') + ->get() + ->keyBy('currency'); + }); + + $netFlow = []; + + foreach (['exp', 'gold', 'charm'] as $currency) { + $row = $rows->get($currency); + + $netFlow[$currency] = [ + 'in' => (int) ($row->total_in ?? 0), + 'out' => (int) ($row->total_out ?? 0), + 'net' => (int) ($row->net_total ?? 0), + ]; + } + + return $netFlow; + } + + /** + * 解析统计查询的日期边界,统一复用缓存 key 与时间范围。 + * + * @param string|null $date 日期字符串如 '2026-02-28' + * @return array{0:string, 1:CarbonImmutable, 2:CarbonImmutable} + */ + private function statsDateBounds(?string $date = null): array + { + $statsDate = CarbonImmutable::parse($date ?? today()->toDateString())->startOfDay(); + + return [ + $statsDate->toDateString(), + $statsDate, + $statsDate->addDay(), + ]; } /** @@ -220,12 +282,17 @@ class UserCurrencyService * @param int $userId 用户 ID * @param string|null $currency 为 null 时返回所有货币类型 * @param int $days 查询最近多少天 + * @param string|null $direction income=收入 / expense=支出 / null=全部 + * @param array $sources 来源 source 值列表,为空时不过滤 */ - public function userLogs(int $userId, ?string $currency = null, int $days = 7): Collection + public function userLogs(int $userId, ?string $currency = null, int $days = 7, ?string $direction = null, array $sources = []): Collection { return UserCurrencyLog::query() ->where('user_id', $userId) ->when($currency, fn ($q) => $q->where('currency', $currency)) + ->when($direction === 'income', fn ($q) => $q->where('amount', '>', 0)) + ->when($direction === 'expense', fn ($q) => $q->where('amount', '<', 0)) + ->when($sources !== [], fn ($q) => $q->whereIn('source', $sources)) ->where('created_at', '>=', now()->subDays($days)) ->orderByDesc('created_at') ->limit(200) diff --git a/resources/views/admin/currency-logs/index.blade.php b/resources/views/admin/currency-logs/index.blade.php index 2b32db3..10a5d4d 100644 --- a/resources/views/admin/currency-logs/index.blade.php +++ b/resources/views/admin/currency-logs/index.blade.php @@ -3,6 +3,10 @@ @section('title', '金币/积分流水查询') @section('content') + @php + $selectedSourceCount = count($selectedSources ?? []); + @endphp +
@@ -39,17 +43,37 @@
-
- - +
+ +
+ + {{ $selectedSourceCount > 0 ? '已选 '.$selectedSourceCount.' 项' : '全部来源' }} + + + + + +
+
+ @foreach ($allSources as $src) + + @endforeach +
+ +
+ 清空来源 + 勾选后点查询生效 +
+
+
@@ -176,4 +200,26 @@
@endif + + @endsection diff --git a/resources/views/admin/users/index.blade.php b/resources/views/admin/users/index.blade.php index a6215e1..c8d81bb 100644 --- a/resources/views/admin/users/index.blade.php +++ b/resources/views/admin/users/index.blade.php @@ -3,16 +3,31 @@ @section('title', '用户检索与管理') @section('content') + @php + $filterLabelClass = 'block mb-1 text-xs font-semibold uppercase tracking-wider text-gray-500'; + $filterInputClass = 'px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:ring-indigo-500 focus:border-indigo-500 text-sm'; + $tableHeadClass = 'p-4 text-xs font-semibold uppercase tracking-wider text-gray-500'; + $primaryTextClass = 'text-sm font-semibold text-gray-800'; + $secondaryTextClass = 'text-xs text-gray-400'; + $numericTextClass = 'text-sm font-mono'; + $statusBadgeClass = 'inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-semibold border'; + $actionButtonClass = 'rounded-lg px-3 py-1.5 text-xs font-semibold transition cursor-pointer'; + $modalLabelClass = 'mb-1 block text-xs font-semibold uppercase tracking-wider text-gray-500'; + $modalInputClass = 'w-full rounded-md border border-gray-300 p-2 text-sm text-gray-700 shadow-sm focus:border-indigo-500 focus:ring-indigo-500'; + @endphp
-
- - +
+ +
+ + +
+ class="bg-indigo-600 text-white px-4 py-2 rounded-lg font-semibold shadow-sm transition hover:bg-indigo-700">搜索 重置 + class="px-4 py-2 bg-white border border-gray-300 rounded-lg text-sm font-semibold text-gray-700 hover:bg-gray-50 transition">重置
@@ -36,59 +51,58 @@ @endphp - - + - - - + + - - + - - - - + - - + @foreach ($users as $user) - + - - - - - diff --git a/tests/Feature/Feature/AdminCurrencyLogControllerTest.php b/tests/Feature/Feature/AdminCurrencyLogControllerTest.php new file mode 100644 index 0000000..65196f1 --- /dev/null +++ b/tests/Feature/Feature/AdminCurrencyLogControllerTest.php @@ -0,0 +1,64 @@ + 'superlevel'], ['body' => '100']); + $admin = User::factory()->create(['user_level' => 100]); + + foreach ([CurrencySource::AUTO_SAVE, CurrencySource::SIGN_IN, CurrencySource::ADMIN_ADJUST] as $index => $source) { + UserCurrencyLog::query()->create([ + 'user_id' => $admin->id, + 'username' => $admin->username, + 'currency' => 'gold', + 'amount' => 10 + $index, + 'balance_after' => 100 + $index, + 'source' => $source->value, + 'remark' => $source->label(), + 'created_at' => now()->subMinutes($index), + ]); + } + + $response = $this->actingAs($admin)->get(route('admin.currency-logs.index', [ + 'sources' => [ + CurrencySource::AUTO_SAVE->value, + CurrencySource::SIGN_IN->value, + ], + ])); + + $response->assertOk(); + $response->assertViewIs('admin.currency-logs.index'); + $response->assertViewHas('selectedSources', [ + CurrencySource::AUTO_SAVE->value, + CurrencySource::SIGN_IN->value, + ]); + $this->assertSame( + [CurrencySource::AUTO_SAVE->value, CurrencySource::SIGN_IN->value], + $response->viewData('logs')->getCollection()->pluck('source')->sort()->values()->all() + ); + } +} diff --git a/tests/Feature/Feature/AdminCurrencyStatsControllerTest.php b/tests/Feature/Feature/AdminCurrencyStatsControllerTest.php new file mode 100644 index 0000000..4afa063 --- /dev/null +++ b/tests/Feature/Feature/AdminCurrencyStatsControllerTest.php @@ -0,0 +1,86 @@ + 'superlevel'], ['body' => '100']); + + $admin = User::factory()->create(['user_level' => 100]); + $date = '2026-04-26'; + + UserCurrencyLog::query()->create([ + 'user_id' => $admin->id, + 'username' => $admin->username, + 'currency' => 'gold', + 'amount' => 120, + 'balance_after' => 120, + 'source' => CurrencySource::SIGN_IN->value, + 'remark' => '签到奖励', + 'created_at' => "{$date} 10:00:00", + ]); + + UserCurrencyLog::query()->create([ + 'user_id' => $admin->id, + 'username' => $admin->username, + 'currency' => 'gold', + 'amount' => -20, + 'balance_after' => 100, + 'source' => CurrencySource::FISHING_COST->value, + 'remark' => '钓鱼消耗', + 'created_at' => "{$date} 11:00:00", + ]); + + UserCurrencyLog::query()->create([ + 'user_id' => $admin->id, + 'username' => $admin->username, + 'currency' => 'exp', + 'amount' => 80, + 'balance_after' => 80, + 'source' => CurrencySource::AUTO_SAVE->value, + 'remark' => '自动存点', + 'created_at' => "{$date} 12:00:00", + ]); + + $response = $this->actingAs($admin)->get(route('admin.currency-stats.index', ['date' => $date])); + + $response->assertOk(); + $response->assertViewIs('admin.currency-stats.index'); + $response->assertViewHas('date', $date); + $response->assertViewHas('netFlow', [ + 'exp' => ['in' => 80, 'out' => 0, 'net' => 80], + 'gold' => ['in' => 120, 'out' => 20, 'net' => 100], + 'charm' => ['in' => 0, 'out' => 0, 'net' => 0], + ]); + + $statsByType = $response->viewData('statsByType'); + + $this->assertSame(120, (int) $statsByType['gold'][CurrencySource::SIGN_IN->value]->total_amount); + $this->assertSame(80, (int) $statsByType['exp'][CurrencySource::AUTO_SAVE->value]->total_amount); + } +} diff --git a/tests/Feature/Feature/AdminUserManagerTest.php b/tests/Feature/Feature/AdminUserManagerTest.php index 5cb6c4d..68897c3 100644 --- a/tests/Feature/Feature/AdminUserManagerTest.php +++ b/tests/Feature/Feature/AdminUserManagerTest.php @@ -23,6 +23,24 @@ class AdminUserManagerTest extends TestCase { use RefreshDatabase; + /** + * 方法功能:验证后台用户管理页可以正常打开并展示核心文案。 + */ + public function test_site_owner_can_view_user_manager_page(): void + { + $siteOwner = $this->createSiteOwner(); + User::factory()->create([ + 'username' => 'viewer-target', + ]); + + $response = $this->actingAs($siteOwner)->get(route('admin.users.index')); + + $response->assertOk(); + $response->assertSee('用户检索与管理'); + $response->assertSee('注册名'); + $response->assertSee('管理操作'); + } + /** * 方法功能:验证站长可以在用户编辑页直接任命职务。 */ diff --git a/tests/Feature/LeaderboardControllerTest.php b/tests/Feature/LeaderboardControllerTest.php index 69eb075..0b5583a 100644 --- a/tests/Feature/LeaderboardControllerTest.php +++ b/tests/Feature/LeaderboardControllerTest.php @@ -2,16 +2,24 @@ namespace Tests\Feature; +use App\Enums\CurrencySource; use App\Models\Sysparam; use App\Models\User; +use App\Models\UserCurrencyLog; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\TestCase; +/** + * 功能说明:验证排行榜与个人积分流水页面的访问和筛选行为。 + */ class LeaderboardControllerTest extends TestCase { use RefreshDatabase; - public function test_can_view_leaderboard_index() + /** + * 验证用户可以访问排行榜首页并看到过滤后的榜单数据。 + */ + public function test_can_view_leaderboard_index(): void { $user = User::factory()->create(['exp_num' => 10, 'jjb' => 100, 'meili' => 5]); @@ -51,7 +59,10 @@ class LeaderboardControllerTest extends TestCase $this->assertEquals(50, $topCharm->first()->meili); } - public function test_can_view_today_leaderboard() + /** + * 验证用户可以访问今日排行榜页面。 + */ + public function test_can_view_today_leaderboard(): void { $user = User::factory()->create(); @@ -61,7 +72,10 @@ class LeaderboardControllerTest extends TestCase $response->assertViewIs('leaderboard.today'); } - public function test_can_view_my_currency_logs() + /** + * 验证用户可以访问自己的积分流水页面。 + */ + public function test_can_view_my_currency_logs(): void { $user = User::factory()->create(); @@ -70,4 +84,84 @@ class LeaderboardControllerTest extends TestCase $response->assertStatus(200); $response->assertViewIs('leaderboard.my-logs'); } + + /** + * 验证个人积分流水可以按收入和支出 tab 分开筛选。 + */ + public function test_can_filter_my_currency_logs_by_direction(): void + { + $user = User::factory()->create(); + + UserCurrencyLog::query()->create([ + 'user_id' => $user->id, + 'username' => $user->username, + 'currency' => 'gold', + 'amount' => 100, + 'balance_after' => 100, + 'source' => 'admin_adjust', + 'remark' => '测试收入', + 'created_at' => now(), + ]); + + UserCurrencyLog::query()->create([ + 'user_id' => $user->id, + 'username' => $user->username, + 'currency' => 'gold', + 'amount' => -30, + 'balance_after' => 70, + 'source' => 'admin_adjust', + 'remark' => '测试支出', + 'created_at' => now(), + ]); + + $incomeResponse = $this->actingAs($user)->get(route('currency.my-logs', ['direction' => 'income'])); + + $incomeResponse->assertStatus(200); + $this->assertSame([100], $incomeResponse->viewData('logs')->pluck('amount')->all()); + $this->assertSame('income', $incomeResponse->viewData('direction')); + + $expenseResponse = $this->actingAs($user)->get(route('currency.my-logs', ['direction' => 'expense'])); + + $expenseResponse->assertStatus(200); + $this->assertSame([-30], $expenseResponse->viewData('logs')->pluck('amount')->all()); + $this->assertSame('expense', $expenseResponse->viewData('direction')); + } + + /** + * 验证个人积分流水可以按多个来源叠加筛选。 + */ + public function test_can_filter_my_currency_logs_by_multiple_sources(): void + { + $user = User::factory()->create(); + + foreach ([CurrencySource::AUTO_SAVE, CurrencySource::SIGN_IN, CurrencySource::ADMIN_ADJUST] as $index => $source) { + UserCurrencyLog::query()->create([ + 'user_id' => $user->id, + 'username' => $user->username, + 'currency' => 'gold', + 'amount' => 10 + $index, + 'balance_after' => 100 + $index, + 'source' => $source->value, + 'remark' => $source->label(), + 'created_at' => now()->subMinutes($index), + ]); + } + + $response = $this->actingAs($user)->get(route('currency.my-logs', [ + 'sources' => [ + CurrencySource::AUTO_SAVE->value, + CurrencySource::SIGN_IN->value, + ], + ])); + + $response->assertStatus(200); + $this->assertSame( + [CurrencySource::AUTO_SAVE->value, CurrencySource::SIGN_IN->value], + $response->viewData('logs')->pluck('source')->sort()->values()->all() + ); + $this->assertSame( + [CurrencySource::AUTO_SAVE->value, CurrencySource::SIGN_IN->value], + $response->viewData('selectedSources') + ); + } }
- +
+ ID{{ $arrow('id') }} 注册名性别 - + 注册名性别 + 等级{{ $arrow('user_level') }} 职务 - + 职务 + 经验{{ $arrow('exp_num') }} - + + 金币{{ $arrow('jjb') }} - + + 魅力{{ $arrow('meili') }} 注册时间 - + 注册时间 + 微信绑定{{ $arrow('wxid') }} - + + 在线{{ $arrow('online') }} 管理操作管理操作
{{ $user->id }}{{ $user->id }}
- {{ $user->username }} + {{ $user->username }} @if ($user->isVip()) {{ $user->vipIcon() }} @@ -105,32 +119,32 @@
@if ($user->activePosition) @php $pos = $user->activePosition->position; @endphp -
{{ $pos->department->name }}
-
+
{{ $pos->department->name }}
+
{{ $pos->icon }} {{ $pos->name }}
@else @endif
+ {{ number_format($user->exp_num ?? 0) }} + {{ number_format($user->jjb ?? 0) }} + {{ number_format($user->meili ?? 0) }} {{ $user->created_at->format('y-m-d') }} + {{ $user->created_at->format('y-m-d') }} @if(!empty($user->wxid)) - + 已绑定 @else - + 未绑定 @endif @@ -138,8 +152,8 @@ @php $isOnline = $onlineUsernames->contains($user->username); @endphp + class="{{ $statusBadgeClass }} + {{ $isOnline ? 'bg-green-100 text-green-700 border-green-200' : 'bg-gray-100 text-gray-400 border-gray-200' }}"> {{ $isOnline ? '在线' : '离线' }} @@ -187,7 +201,7 @@ @if ($users->hasPages()) -
+
{{ $users->links() }}
@endif @@ -199,7 +213,7 @@ class="bg-white rounded-xl shadow-2xl w-full max-w-lg transform transition-all" x-transition>
-

编辑用户: +

编辑用户:

@@ -209,7 +223,7 @@
@@ -218,28 +232,28 @@
{{-- 经验 --}}
- + + class="{{ $modalInputClass }}">
{{-- 金币 --}}
- + + class="{{ $modalInputClass }}">
{{-- 魅力 --}}
- + + class="{{ $modalInputClass }}">
{{-- 性别 --}}
- +
@@ -255,17 +269,17 @@ {{-- 签名 --}}
- + + class="{{ $modalInputClass }}">
{{-- 任命职务 --}}
- + + class="{{ $modalInputClass }}"> @foreach ($vipLevels as $vl)
- + + class="{{ $modalInputClass }}">
{{-- 密码 --}}
+ class="mb-1 block border-l-4 border-red-500 bg-red-50 p-2 pl-2 text-xs font-semibold uppercase tracking-wider text-red-600">强制重置密码 + (留空不修改)
diff --git a/resources/views/leaderboard/my-logs.blade.php b/resources/views/leaderboard/my-logs.blade.php index f664844..2f9dfa4 100644 --- a/resources/views/leaderboard/my-logs.blade.php +++ b/resources/views/leaderboard/my-logs.blade.php @@ -1,6 +1,6 @@ {{-- 文件功能:用户个人积分流水日志页面 - 用户可筛选查看自己的经验、金币、魅力变动历史,按日期倒序排列 + 用户可筛选查看自己的经验、金币、魅力收入和支出变动历史,按日期倒序排列 @extends layouts.app --}} @@ -13,11 +13,25 @@ @section('content')
+ @php + $selectedSourceCount = count($selectedSources ?? []); + @endphp {{-- 筛选栏 --}}
筛选: + {{-- 收支方向 --}} +
+ @foreach(['' => '全部', 'income' => '收入', 'expense' => '支出'] as $val => $label) + + {{ $label }} + + @endforeach +
+ {{-- 货币类型 --}}
@foreach(['' => '全部', 'exp' => '⚡ 经验', 'gold' => '💰 金币', 'charm' => '🌸 魅力'] as $val => $label) @@ -29,6 +43,41 @@ @endforeach
+ {{-- 来源筛选 --}} + + + + + +
+ + 来源:{{ $selectedSourceCount > 0 ? '已选 '.$selectedSourceCount.' 项' : '全部' }} ▾ + + +
+
+ @foreach($sourceOptions as $sourceOption) + + @endforeach +
+ +
+ 清空来源 + +
+
+
+ + {{-- 日期范围 --}}
@foreach([7 => '7 天', 14 => '14 天', 30 => '30 天'] as $d => $label) @@ -87,7 +136,8 @@
{{ number_format($log->balance_after) }} + {{ $log->remark ?: '—' }}