admin: subscription show bmpa summary add success/failed links

This commit is contained in:
萝卜
2026-03-18 04:41:15 +08:00
parent 59910e05aa
commit 8fcf880a92
3 changed files with 17 additions and 6 deletions

View File

@@ -94,11 +94,18 @@ class SiteSubscriptionController extends Controller
}
}
// 订阅维度BMPA批量标记支付并生效失败订单数(与平台订单列表 bmpa_failed_only 口径一致)
// 订阅维度BMPA批量标记支付并生效成功/失败订单数
// - 失败口径与平台订单列表 bmpa_failed_only 一致error.message 存在
// - 成功口径与 bmpa_success_only 一致:存在 run_id 且 error.message 为空
$bmpaFailedOrders = (clone $baseOrdersQuery)
->whereRaw("JSON_EXTRACT(meta, '$.batch_mark_paid_and_activate_error.message') IS NOT NULL")
->count();
$bmpaSuccessOrders = (clone $baseOrdersQuery)
->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();
$summaryStats = $summaryStats + [
'receipt_orders' => $receiptOrders,
'no_receipt_orders' => $noReceiptOrders,
@@ -110,7 +117,8 @@ class SiteSubscriptionController extends Controller
'refund_inconsistent_orders' => (int) $refundInconsistentOrders,
// 对账不一致订单(订阅维度)
'reconcile_mismatch_orders' => (int) $reconcileMismatchOrders,
// BMPA 失败订单(订阅维度)
// BMPA 成功/失败订单(订阅维度)
'bmpa_success_orders' => (int) $bmpaSuccessOrders,
'bmpa_failed_orders' => (int) $bmpaFailedOrders,
// 对账差额:回执总额 - 已付总额(订阅维度)
'reconciliation_delta' => (float) ($totalReceiptAmount - (float) $metaOrders->sum('paid_amount')),