From b7471026ef3db1e2a23cb025675230519df4d401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sun, 15 Mar 2026 19:29:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E4=BB=AA=E8=A1=A8=E7=9B=98?= =?UTF-8?q?=E6=94=B6=E8=B4=B9=E5=B7=A5=E4=BD=9C=E5=8F=B0=E8=A1=A5=E9=BD=90?= =?UTF-8?q?=E7=BB=AD=E8=B4=B9=E7=BC=BA=E8=AE=A2=E9=98=85=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Admin/DashboardController.php | 4 +++ resources/views/admin/dashboard.blade.php | 1 + ...enewalMissingSubscriptionQuickLinkTest.php | 35 +++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 tests/Feature/AdminDashboardBillingWorkbenchShouldIncludeRenewalMissingSubscriptionQuickLinkTest.php diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index 87e9960..ff57a4f 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -51,6 +51,10 @@ class DashboardController extends Controller 'platform_orders_sync_failed' => PlatformOrder::query() ->whereRaw("JSON_EXTRACT(meta, '$.subscription_activation_error.message') IS NOT NULL") ->count(), + 'platform_orders_renewal_missing_subscription' => PlatformOrder::query() + ->where('order_type', 'renewal') + ->whereNull('site_subscription_id') + ->count(), // 站点治理 'active_merchants' => Merchant::query()->where('status', 'active')->count(), diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index de93281..798e274 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -103,6 +103,7 @@ 待生效({{ (int) ($stats['platform_orders_paid_pending'] ?? 0) }}) 可同步 同步失败({{ (int) ($stats['platform_orders_sync_failed'] ?? 0) }}) + 续费缺订阅({{ (int) ($stats['platform_orders_renewal_missing_subscription'] ?? 0) }}) diff --git a/tests/Feature/AdminDashboardBillingWorkbenchShouldIncludeRenewalMissingSubscriptionQuickLinkTest.php b/tests/Feature/AdminDashboardBillingWorkbenchShouldIncludeRenewalMissingSubscriptionQuickLinkTest.php new file mode 100644 index 0000000..1dd627d --- /dev/null +++ b/tests/Feature/AdminDashboardBillingWorkbenchShouldIncludeRenewalMissingSubscriptionQuickLinkTest.php @@ -0,0 +1,35 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_dashboard_billing_workbench_should_include_renewal_missing_subscription_quick_link(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin'); + $res->assertOk(); + + // 链接应携带 back 回到仪表盘,并且 & 不应被 escape + $res->assertSee('href="/admin/platform-orders?renewal_missing_subscription=1&back=%2Fadmin"', false); + $res->assertDontSee('&back=', false); + + $res->assertSee('续费缺订阅', false); + } +}