From 1514700b8712a51061687b3618748367238f6357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sun, 15 Mar 2026 19:27:00 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E4=BB=AA=E8=A1=A8=E7=9B=98=20KP?= =?UTF-8?q?I=20=E5=8D=A1=E5=8F=AF=E7=82=B9=E5=87=BB=E5=B9=B6=E6=90=BA?= =?UTF-8?q?=E5=B8=A6=20back=20=E5=9B=9E=E8=B7=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/admin/dashboard.blade.php | 17 ++++++--- ...dKpiCardsShouldLinkToListsWithBackTest.php | 36 +++++++++++++++++++ 2 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 tests/Feature/AdminDashboardKpiCardsShouldLinkToListsWithBackTest.php diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index 1e706d0..de93281 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -47,24 +47,33 @@
+ @php + $kpiLinks = [ + 'merchants' => \App\Support\BackUrl::withBack('/admin/merchants', $selfWithoutBack), + 'plans' => \App\Support\BackUrl::withBack('/admin/plans', $selfWithoutBack), + 'site_subscriptions' => \App\Support\BackUrl::withBack('/admin/site-subscriptions', $selfWithoutBack), + 'platform_orders' => \App\Support\BackUrl::withBack('/admin/platform-orders', $selfWithoutBack), + ]; + @endphp +
站点
-
{{ $stats['merchants'] }}
+
全站点数量(总台视角)
套餐
-
{{ (int) ($stats['plans'] ?? 0) }}
+
可售套餐目录
订阅
-
{{ (int) ($stats['site_subscriptions'] ?? 0) }}
+
站点订阅总量(收费主链)
平台订单
-
{{ (int) ($stats['platform_orders'] ?? 0) }}
+
平台收费订单总量
diff --git a/tests/Feature/AdminDashboardKpiCardsShouldLinkToListsWithBackTest.php b/tests/Feature/AdminDashboardKpiCardsShouldLinkToListsWithBackTest.php new file mode 100644 index 0000000..06abf42 --- /dev/null +++ b/tests/Feature/AdminDashboardKpiCardsShouldLinkToListsWithBackTest.php @@ -0,0 +1,36 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_dashboard_kpi_cards_should_link_to_lists_with_back(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin'); + $res->assertOk(); + + $res->assertSee('href="/admin/merchants?back=%2Fadmin"', false); + $res->assertSee('href="/admin/plans?back=%2Fadmin"', false); + $res->assertSee('href="/admin/site-subscriptions?back=%2Fadmin"', false); + $res->assertSee('href="/admin/platform-orders?back=%2Fadmin"', false); + + $res->assertDontSee('&back=', false); + } +}