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); + } +}