From dc7b7b395cac7d560df7453970d0b5a457f3923c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sun, 15 Mar 2026 19:34:32 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E4=BB=AA=E8=A1=A8=E7=9B=98?= =?UTF-8?q?=E8=A1=A5=E9=BD=90=E8=AE=A2=E9=98=85=E5=88=B0=E6=9C=9F=E6=B2=BB?= =?UTF-8?q?=E7=90=86=E5=85=A5=E5=8F=A3=EF=BC=887=E5=A4=A9=E5=86=85?= =?UTF-8?q?=E5=88=B0=E6=9C=9F/=E5=B7=B2=E8=BF=87=E6=9C=9F=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Admin/DashboardController.php | 9 +++++ resources/views/admin/dashboard.blade.php | 12 +++++-- ...iptionExpiryQuickLinksShouldRenderTest.php | 34 +++++++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 tests/Feature/AdminDashboardSubscriptionExpiryQuickLinksShouldRenderTest.php diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index ff57a4f..ec3a919 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -38,6 +38,15 @@ class DashboardController extends Controller // 收费中心(平台侧) 'plans' => Plan::count(), 'site_subscriptions' => SiteSubscription::count(), + 'site_subscriptions_expired' => SiteSubscription::query() + ->whereNotNull('ends_at') + ->where('ends_at', '<', now()) + ->count(), + 'site_subscriptions_expiring_7d' => SiteSubscription::query() + ->whereNotNull('ends_at') + ->where('ends_at', '>=', now()) + ->where('ends_at', '<', now()->addDays(7)) + ->count(), 'platform_orders' => PlatformOrder::count(), 'platform_orders_unpaid_pending' => PlatformOrder::query() ->where('payment_status', 'unpaid') diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index 798e274..81be3cb 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -97,7 +97,7 @@
聚焦收费闭环的日常治理入口:订单 → 订阅 → 套餐。
-
快捷筛选:
+
平台订单快捷筛选:
-
说明:这里先落“入口与布局骨架”,后续会把 KPI/趋势/排行 接入真实聚合指标。
+
+
订阅到期治理:
+ +
+ +
说明:这里先把收费主链的高频治理入口收敛到仪表盘;后续再补趋势/排行的真实聚合。
diff --git a/tests/Feature/AdminDashboardSubscriptionExpiryQuickLinksShouldRenderTest.php b/tests/Feature/AdminDashboardSubscriptionExpiryQuickLinksShouldRenderTest.php new file mode 100644 index 0000000..d3219af --- /dev/null +++ b/tests/Feature/AdminDashboardSubscriptionExpiryQuickLinksShouldRenderTest.php @@ -0,0 +1,34 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_dashboard_subscription_expiry_quick_links_should_render(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin'); + $res->assertOk(); + + $res->assertSee('订阅到期治理'); + $res->assertSee('href="/admin/site-subscriptions?expiry=expiring_7d&back=%2Fadmin"', false); + $res->assertSee('href="/admin/site-subscriptions?expiry=expired&back=%2Fadmin"', false); + $res->assertDontSee('&back=', false); + } +}