diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index b3a6e66..26cd2a9 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -596,6 +596,73 @@
分母:平台订单总量 {{ $poTotalForOps }}(用于规模感,不作为经营口径)。
+ + @php + // 平台健康预警:原因型风险(点进去有明确动作:补回执/对账/核对退款)。 + $riskNoReceipt = (int) ($stats['platform_orders_paid_no_receipt'] ?? 0); + $riskReconcileMismatch = (int) ($stats['platform_orders_reconcile_mismatch'] ?? 0); + $riskRefundInconsistent = (int) ($stats['platform_orders_refund_inconsistent'] ?? 0); + + $pctRiskNoReceipt = $poTotalForOps > 0 ? min(100, max(0, round(($riskNoReceipt / $denOps) * 100, 1))) : 0; + $pctRiskReconcileMismatch = $poTotalForOps > 0 ? min(100, max(0, round(($riskReconcileMismatch / $denOps) * 100, 1))) : 0; + $pctRiskRefundInconsistent = $poTotalForOps > 0 ? min(100, max(0, round(($riskRefundInconsistent / $denOps) * 100, 1))) : 0; + + // 异常积压:点进去要做“治理修复/补关联/重试”。 + $exBmpaFailed = (int) ($stats['platform_orders_bmpa_failed'] ?? 0); + $exRenewalMissing = (int) ($stats['platform_orders_renewal_missing_subscription'] ?? 0); + $pctExBmpaFailed = $poTotalForOps > 0 ? min(100, max(0, round(($exBmpaFailed / $denOps) * 100, 1))) : 0; + $pctExRenewalMissing = $poTotalForOps > 0 ? min(100, max(0, round(($exRenewalMissing / $denOps) * 100, 1))) : 0; + @endphp + +
+
平台健康预警(Top3)
+
原因型风险:补回执 / 对账 / 核对退款。
+ + +
无回执
+
+ +
+
{{ $pctRiskNoReceipt }}%({{ $riskNoReceipt }})
+
+ + +
对账不一致
+
+ +
+
{{ $pctRiskReconcileMismatch }}%({{ $riskReconcileMismatch }})
+
+ + +
退款不一致
+
+ +
+
{{ $pctRiskRefundInconsistent }}%({{ $riskRefundInconsistent }})
+
+
+ +
+ 更多异常积压(少用) +
异常型治理:批量失败 / 续费缺订阅等。
+ + +
BMPA失败
+
+ +
+
{{ $pctExBmpaFailed }}%({{ $exBmpaFailed }})
+
+ + +
续费缺订阅
+
+ +
+
{{ $pctExRenewalMissing }}%({{ $exRenewalMissing }})
+
+
diff --git a/tests/Feature/AdminDashboardPlatformOpsOverviewExtraMiniBarsShouldRenderTest.php b/tests/Feature/AdminDashboardPlatformOpsOverviewExtraMiniBarsShouldRenderTest.php new file mode 100644 index 0000000..2fdf06b --- /dev/null +++ b/tests/Feature/AdminDashboardPlatformOpsOverviewExtraMiniBarsShouldRenderTest.php @@ -0,0 +1,40 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_dashboard_platform_ops_overview_should_render_extra_mini_bars(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin'); + $res->assertOk(); + + $html = (string) $res->getContent(); + + $this->assertStringContainsString('data-role="platform-ops-risk-bars"', $html); + $this->assertStringContainsString('data-role="ops-risk-no-receipt-bar"', $html); + $this->assertStringContainsString('data-role="ops-risk-reconcile-mismatch-bar"', $html); + $this->assertStringContainsString('data-role="ops-risk-refund-inconsistent-bar"', $html); + + $this->assertStringContainsString('data-role="platform-ops-exception-bars"', $html); + $this->assertStringContainsString('data-role="ops-exception-bmpa-failed-bar"', $html); + $this->assertStringContainsString('data-role="ops-exception-renewal-missing-bar"', $html); + } +}