admin: 订阅详情页补齐BMPA失败原因Top3与直达筛选链接
This commit is contained in:
@@ -133,6 +133,25 @@ class SiteSubscriptionController extends Controller
|
||||
];
|
||||
})->values()->all();
|
||||
|
||||
// BMPA 失败原因聚合(Top3):订阅维度快速判断“常见批量标记支付失败原因”
|
||||
$bmpaFailedReasonRows = (clone $baseOrdersQuery)
|
||||
->whereRaw("JSON_EXTRACT(meta, '$.batch_mark_paid_and_activate_error.message') IS NOT NULL")
|
||||
->selectRaw("JSON_EXTRACT(meta, '$.batch_mark_paid_and_activate_error.message') as reason, count(*) as cnt")
|
||||
->groupBy('reason')
|
||||
->orderByDesc('cnt')
|
||||
->limit(3)
|
||||
->get();
|
||||
|
||||
$bmpaFailedReasonStats = $bmpaFailedReasonRows->map(function ($row) {
|
||||
$reason = (string) ($row->reason ?? '');
|
||||
$reason = trim($reason, "\" ");
|
||||
|
||||
return [
|
||||
'reason' => $reason !== '' ? $reason : '(空)',
|
||||
'count' => (int) ($row->cnt ?? 0),
|
||||
];
|
||||
})->values()->all();
|
||||
|
||||
// 页面列表筛选:仅影响“关联平台订单”列表展示,不影响摘要统计
|
||||
$orderSyncStatus = trim((string) $request->query('order_sync_status', ''));
|
||||
|
||||
@@ -182,6 +201,7 @@ class SiteSubscriptionController extends Controller
|
||||
'platformOrders' => $platformOrders,
|
||||
'summaryStats' => $summaryStats,
|
||||
'failedReasonStats' => $failedReasonStats,
|
||||
'bmpaFailedReasonStats' => $bmpaFailedReasonStats,
|
||||
'statusLabels' => $this->statusLabels(),
|
||||
'expiryLabel' => $expiryLabel,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user