feat(platform-orders): 列表/导出退款统计优先读 refund_summary(含测试)
This commit is contained in:
@@ -682,8 +682,9 @@ class PlatformOrderController extends Controller
|
||||
$latestReceipt = $receiptCount > 0 ? end($receipts) : null;
|
||||
|
||||
$refunds = (array) (data_get($order->meta, 'refund_receipts', []) ?? []);
|
||||
$refundCount = count($refunds);
|
||||
$latestRefund = $refundCount > 0 ? end($refunds) : null;
|
||||
$refundSummaryCount = data_get($order->meta, 'refund_summary.count');
|
||||
$refundCount = $refundSummaryCount !== null ? (int) $refundSummaryCount : count($refunds);
|
||||
$latestRefund = count($refunds) > 0 ? end($refunds) : null;
|
||||
|
||||
$row = [
|
||||
$order->id,
|
||||
@@ -715,7 +716,12 @@ class PlatformOrderController extends Controller
|
||||
(string) (data_get($latestRefund, 'refunded_at') ?? ''),
|
||||
(float) (data_get($latestRefund, 'amount') ?? 0),
|
||||
(string) (data_get($latestRefund, 'channel') ?? ''),
|
||||
(function () use ($refunds) {
|
||||
(function () use ($order, $refunds) {
|
||||
$summaryTotal = data_get($order->meta, 'refund_summary.total_amount');
|
||||
if ($summaryTotal !== null) {
|
||||
return (float) $summaryTotal;
|
||||
}
|
||||
|
||||
$total = 0.0;
|
||||
foreach ($refunds as $r) {
|
||||
$total += (float) (data_get($r, 'amount') ?? 0);
|
||||
|
||||
Reference in New Issue
Block a user