feat: site subscription show add reconcile mismatch orders count link
This commit is contained in:
@@ -59,6 +59,9 @@ class SiteSubscriptionController extends Controller
|
||||
// 订阅维度:退款不一致订单数(与平台订单列表 refund_inconsistent 口径保持一致)
|
||||
$refundInconsistentOrders = 0;
|
||||
|
||||
// 订阅维度:对账不一致订单数(与平台订单列表 reconcile_mismatch 口径保持一致)
|
||||
$reconcileMismatchOrders = 0;
|
||||
|
||||
foreach ($metaOrders as $o) {
|
||||
$meta = $o->meta ?? [];
|
||||
|
||||
@@ -71,6 +74,13 @@ class SiteSubscriptionController extends Controller
|
||||
$noReceiptOrders++;
|
||||
}
|
||||
|
||||
// reconcile_mismatch 口径:支付回执总额 与订单 paid_amount 不一致(按分取整,差额>=0.01)
|
||||
$receiptCents = (int) round($receiptTotal * 100);
|
||||
$paidCents = (int) round(((float) ($o->paid_amount ?? 0)) * 100);
|
||||
if (abs($receiptCents - $paidCents) >= 1) {
|
||||
$reconcileMismatchOrders++;
|
||||
}
|
||||
|
||||
$refundTotal = (float) $o->refundTotal();
|
||||
|
||||
if ($refundTotal > 0) {
|
||||
@@ -94,6 +104,8 @@ class SiteSubscriptionController extends Controller
|
||||
'total_refunded_amount' => (float) $totalRefundedAmount,
|
||||
// 退款不一致订单(订阅维度)
|
||||
'refund_inconsistent_orders' => (int) $refundInconsistentOrders,
|
||||
// 对账不一致订单(订阅维度)
|
||||
'reconcile_mismatch_orders' => (int) $reconcileMismatchOrders,
|
||||
// 对账差额:回执总额 - 已付总额(订阅维度)
|
||||
'reconciliation_delta' => (float) ($totalReceiptAmount - (float) $metaOrders->sum('paid_amount')),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user