Dashboard: add BMPA failed to governance mini bars

This commit is contained in:
萝卜
2026-03-17 02:56:45 +08:00
parent db6fd9a9b7
commit f04680a498
3 changed files with 13 additions and 1 deletions

View File

@@ -275,12 +275,14 @@
@php
$poTotal = (int) ($stats['platform_orders'] ?? 0);
$poSyncFailed = (int) ($stats['platform_orders_sync_failed'] ?? 0);
$poBmpaFailed = (int) ($stats['platform_orders_bmpa_failed'] ?? 0);
$poNoReceipt = (int) ($stats['platform_orders_paid_no_receipt'] ?? 0);
$poRenewalMissing = (int) ($stats['platform_orders_renewal_missing_subscription'] ?? 0);
$poReconcileMismatch = (int) ($stats['platform_orders_reconcile_mismatch'] ?? 0);
$poRefundInconsistent = (int) ($stats['platform_orders_refund_inconsistent'] ?? 0);
$poSyncFailedPct = $poTotal > 0 ? min(100, max(0, round(($poSyncFailed / $poTotal) * 100, 1))) : 0;
$poBmpaFailedPct = $poTotal > 0 ? min(100, max(0, round(($poBmpaFailed / $poTotal) * 100, 1))) : 0;
$poNoReceiptPct = $poTotal > 0 ? min(100, max(0, round(($poNoReceipt / $poTotal) * 100, 1))) : 0;
$poRenewalMissingPct = $poTotal > 0 ? min(100, max(0, round(($poRenewalMissing / $poTotal) * 100, 1))) : 0;
$poReconcileMismatchPct = $poTotal > 0 ? min(100, max(0, round(($poReconcileMismatch / $poTotal) * 100, 1))) : 0;
@@ -336,6 +338,14 @@
<div class="adm-mini-bar-value">{{ $poSyncFailedPct }}%{{ $poSyncFailed }}</div>
</a>
<a class="adm-mini-bar-row adm-mini-bar-row-link mt-6" data-role="dashboard-po-bmpa-failed-row" href="{!! \App\Support\BackUrl::withBack('/admin/platform-orders?bmpa_failed_only=1', $selfWithoutBack) !!}" aria-label="进入BMPA失败订单集合">
<div class="adm-mini-bar-label">BMPA失败</div>
<div class="adm-mini-bar" data-role="dashboard-po-bmpa-failed-bar" title="{{ $poBmpaFailed }} / {{ $poTotal }}{{ $poBmpaFailedPct }}%">
<span class="adm-mini-bar-fill" style="width: {{ $poBmpaFailedPct }}%"></span>
</div>
<div class="adm-mini-bar-value">{{ $poBmpaFailedPct }}%{{ $poBmpaFailed }}</div>
</a>
<a class="adm-mini-bar-row adm-mini-bar-row-link mt-6" data-role="dashboard-po-no-receipt-row" href="{!! \App\Support\BackUrl::withBack('/admin/platform-orders?payment_status=paid&receipt_status=none', $selfWithoutBack) !!}" aria-label="进入无回执订单集合">
<div class="adm-mini-bar-label">无回执</div>
<div class="adm-mini-bar" data-role="dashboard-po-no-receipt-bar" title="{{ $poNoReceipt }} / {{ $poTotal }}{{ $poNoReceiptPct }}%">

View File

@@ -36,8 +36,9 @@ class AdminDashboardMiniBarRowsShouldLinkToGovernanceScopesTest extends TestCase
$this->assertStringContainsString('href="/admin/platform-orders?payment_status=paid&status=pending&sync_status=unsynced&back=%2Fadmin"', $html);
$this->assertStringContainsString('href="/admin/platform-orders?syncable_only=1&sync_status=unsynced&back=%2Fadmin"', $html);
// 治理:同步失败 / 无回执 / 续费缺订阅 / 对账不一致 / 退款不一致
// 治理:同步失败 / BMPA失败 / 无回执 / 续费缺订阅 / 对账不一致 / 退款不一致
$this->assertStringContainsString('href="/admin/platform-orders?sync_status=failed&back=%2Fadmin"', $html);
$this->assertStringContainsString('href="/admin/platform-orders?bmpa_failed_only=1&back=%2Fadmin"', $html);
$this->assertStringContainsString('href="/admin/platform-orders?payment_status=paid&receipt_status=none&back=%2Fadmin"', $html);
$this->assertStringContainsString('href="/admin/platform-orders?renewal_missing_subscription=1&back=%2Fadmin"', $html);
$this->assertStringContainsString('href="/admin/platform-orders?reconcile_mismatch=1&back=%2Fadmin"', $html);

View File

@@ -30,6 +30,7 @@ class AdminDashboardPlatformOrderGovernanceMiniBarsShouldRenderTest extends Test
$this->assertStringContainsString('data-role="dashboard-po-governance-bars"', $html);
$this->assertStringContainsString('data-role="dashboard-po-sync-failed-bar"', $html);
$this->assertStringContainsString('data-role="dashboard-po-bmpa-failed-bar"', $html);
$this->assertStringContainsString('data-role="dashboard-po-no-receipt-bar"', $html);
$this->assertStringContainsString('data-role="dashboard-po-renewal-missing-bar"', $html);
$this->assertStringContainsString('data-role="dashboard-po-reconcile-mismatch-bar"', $html);