From f50272ffc9c904f9424cea6107b010a98a8fcf3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Tue, 17 Mar 2026 07:18:46 +0800 Subject: [PATCH] =?UTF-8?q?Dashboard=EF=BC=9A=E6=94=B6=E8=B4=B9=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E5=8F=B0=E5=BF=AB=E6=8D=B7=E5=85=A5=E5=8F=A3=E6=94=B6?= =?UTF-8?q?=E6=95=9B=E4=B8=BA=E6=B2=BB=E7=90=86=E5=AF=BC=E5=90=91=20+=20?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=AE=9A=E4=BD=8D=EF=BC=88=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E7=89=88=EF=BC=89=E6=96=AD=E8=A8=80=E6=8A=A4=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Admin/DashboardController.php | 2 + resources/views/admin/dashboard.blade.php | 28 ++++++----- ...ickLinksShouldBeGovernanceOrientedTest.php | 47 +++++++++++++++++++ ...ardPlatformOpsOverviewShouldRenderTest.php | 13 +++++ ...ardPlatformPositioningShouldRenderTest.php | 39 +++++++++++++++ 5 files changed, 118 insertions(+), 11 deletions(-) create mode 100644 tests/Feature/AdminDashboardBillingWorkbenchQuickLinksShouldBeGovernanceOrientedTest.php create mode 100644 tests/Feature/AdminDashboardPlatformPositioningShouldRenderTest.php diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index 7823c99..6f5e09c 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -354,6 +354,8 @@ class DashboardController extends Controller 'recentPlatformOrders' => $recentPlatformOrders, 'dashboardRangeFrom7d' => $dashboardRangeFrom7d, 'dashboardRangeTo7d' => $dashboardRangeTo7d, + // 注意:旧版的 platformPositioning 已弃用;当前仪表盘使用 platformOpsOverview 作为“平台定位(运营版)”的数据源。 + // 这里先移除 platformPositioning,避免遗留变量命名不一致导致 /admin 500,破坏 Dashboard 回归基线。 'planOrderShare' => $planOrderShare, 'planOrderShareTotal' => (int) $planOrderShareTotal, 'planIdToName' => $planIdToName, diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index 3c44760..f90ff2f 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -301,19 +301,25 @@
-
平台订单快捷筛选:
-
- 待支付({{ (int) ($stats['platform_orders_unpaid_pending'] ?? 0) }}) - 待生效({{ (int) ($stats['platform_orders_paid_pending'] ?? 0) }}) - 可同步({{ (int) ($stats['platform_orders_syncable'] ?? 0) }}) - 同步失败({{ (int) ($stats['platform_orders_sync_failed'] ?? 0) }}) - 续费缺订阅({{ (int) ($stats['platform_orders_renewal_missing_subscription'] ?? 0) }}) - BMPA失败({{ (int) ($stats['platform_orders_bmpa_failed'] ?? 0) }}) - 无回执({{ (int) ($stats['platform_orders_paid_no_receipt'] ?? 0) }}) - 对账不一致({{ (int) ($stats['platform_orders_reconcile_mismatch'] ?? 0) }}) - 退款不一致({{ (int) ($stats['platform_orders_refund_inconsistent'] ?? 0) }}) +
平台订单快捷筛选(只保留“点完能做事”的治理入口):
+ +
+ 高级筛选(少用,默认收起) + +
+ @php $poTotal = (int) ($stats['platform_orders'] ?? 0); $poSyncFailed = (int) ($stats['platform_orders_sync_failed'] ?? 0); diff --git a/tests/Feature/AdminDashboardBillingWorkbenchQuickLinksShouldBeGovernanceOrientedTest.php b/tests/Feature/AdminDashboardBillingWorkbenchQuickLinksShouldBeGovernanceOrientedTest.php new file mode 100644 index 0000000..fba7898 --- /dev/null +++ b/tests/Feature/AdminDashboardBillingWorkbenchQuickLinksShouldBeGovernanceOrientedTest.php @@ -0,0 +1,47 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_dashboard_billing_workbench_quick_links_should_be_governance_oriented(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin'); + $res->assertOk(); + + $html = (string) $res->getContent(); + + // 快捷区:只保留“点完能做事”的治理入口(<=7,当前为 6) + $this->assertStringContainsString('data-role="dashboard-po-quick-links"', $html); + $this->assertStringContainsString('待支付', $html); + $this->assertStringContainsString('可同步', $html); + $this->assertStringContainsString('同步失败', $html); + $this->assertStringContainsString('无回执', $html); + $this->assertStringContainsString('对账不一致', $html); + $this->assertStringContainsString('退款不一致', $html); + + // 高级筛选:默认收起(存在即可),承载“非高频动作入口” + $this->assertStringContainsString('data-role="dashboard-po-advanced-links"', $html); + $this->assertStringContainsString('高级筛选', $html); + $this->assertStringContainsString('待生效', $html); + $this->assertStringContainsString('续费缺订阅', $html); + $this->assertStringContainsString('BMPA失败', $html); + } +} diff --git a/tests/Feature/AdminDashboardPlatformOpsOverviewShouldRenderTest.php b/tests/Feature/AdminDashboardPlatformOpsOverviewShouldRenderTest.php index 65a170f..2b524a5 100644 --- a/tests/Feature/AdminDashboardPlatformOpsOverviewShouldRenderTest.php +++ b/tests/Feature/AdminDashboardPlatformOpsOverviewShouldRenderTest.php @@ -30,6 +30,19 @@ class AdminDashboardPlatformOpsOverviewShouldRenderTest extends TestCase $this->assertStringContainsString('data-role="dashboard-platform-ops-overview"', $html); $this->assertStringContainsString('平台定位(运营版)', $html); + + // 北极星指标 + $this->assertStringContainsString('近30天已收款', $html); + $this->assertStringContainsString('活跃付费站点', $html); + $this->assertStringContainsString('续费成功率(30天)', $html); + + // 漏斗(近7天) + $this->assertStringContainsString('收款漏斗(近7天)', $html); + $this->assertStringContainsString('待支付', $html); + $this->assertStringContainsString('已支付', $html); + $this->assertStringContainsString('已生效', $html); + + // 待处理治理 Top3 $this->assertStringContainsString('待处理治理(Top3)', $html); $this->assertStringContainsString('可BMPA', $html); $this->assertStringContainsString('可同步', $html); diff --git a/tests/Feature/AdminDashboardPlatformPositioningShouldRenderTest.php b/tests/Feature/AdminDashboardPlatformPositioningShouldRenderTest.php new file mode 100644 index 0000000..7a7d16e --- /dev/null +++ b/tests/Feature/AdminDashboardPlatformPositioningShouldRenderTest.php @@ -0,0 +1,39 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_platform_positioning_should_render_core_metrics_and_top3_governance_links(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin'); + $res->assertOk(); + + $html = (string) $res->getContent(); + + $this->assertStringContainsString('data-role="dashboard-platform-ops-overview"', $html); + $this->assertStringContainsString('平台定位(运营版)', $html); + $this->assertStringContainsString('近30天已收款', $html); + $this->assertStringContainsString('活跃付费站点', $html); + $this->assertStringContainsString('续费成功率(30天)', $html); + $this->assertStringContainsString('收款漏斗(近7天)', $html); + $this->assertStringContainsString('待处理治理(Top3)', $html); + } +}