feat(platform-orders): show bmpa success/failed summary and add bmpa_success_orders stat

This commit is contained in:
萝卜
2026-03-18 03:41:51 +08:00
parent 806d9fa180
commit 5ee3052280
3 changed files with 10 additions and 3 deletions

View File

@@ -436,6 +436,10 @@ class PlatformOrderController extends Controller
'bmpa_failed_orders' => (clone $baseQuery)
->whereRaw("JSON_EXTRACT(meta, '$.batch_mark_paid_and_activate_error.message') IS NOT NULL")
->count(),
'bmpa_success_orders' => (clone $baseQuery)
->whereRaw("JSON_EXTRACT(meta, '$.batch_mark_paid_and_activate.run_id') IS NOT NULL")
->whereRaw("JSON_EXTRACT(meta, '$.batch_mark_paid_and_activate_error.message') IS NULL")
->count(),
'unsynced_orders' => (clone $baseQuery)
->whereRaw("JSON_EXTRACT(meta, '$.subscription_activation.subscription_id') IS NULL")
->whereRaw("JSON_EXTRACT(meta, '$.subscription_activation_error.message') IS NULL")

View File

@@ -637,11 +637,13 @@
</div>
</div>
<div class="card">
<h3>BMPA 失败</h3>
<h3>BMPA 成功 / 失败</h3>
<div class="metric-number">
<a class="link" href="{!! $safeFullUrlWithQuery(['bmpa_success_only' => '1', 'page' => null]) !!}">{{ $summaryStats['bmpa_success_orders'] ?? 0 }}</a>
<span class="muted"> / </span>
<a class="link" href="{!! $safeFullUrlWithQuery(['bmpa_failed_only' => '1', 'page' => null]) !!}">{{ $summaryStats['bmpa_failed_orders'] ?? 0 }}</a>
</div>
<div class="muted muted-xs">批量标记支付并生效失败(meta 失败标记</div>
<div class="muted muted-xs">成功口径:存在 run_id 且无 error.message失败口径meta 失败标记</div>
</div>
<div class="card">
<h3>可同步订单</h3>

View File

@@ -64,7 +64,8 @@ class AdminPlatformOrderBmpaFailedSummaryCardTest extends TestCase
$res = $this->get('/admin/platform-orders');
$res->assertOk();
$res->assertSee('BMPA 失败');
$res->assertSee('BMPA 成功 / 失败');
$res->assertSee('/admin/platform-orders?bmpa_failed_only=1', false);
$res->assertSee('/admin/platform-orders?bmpa_success_only=1', false);
}
}