From c6a879276301fb956a6aefc97be57763a0c19fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Fri, 13 Mar 2026 20:49:05 +0000 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=AE=A2=E5=8D=95=E5=AF=B9?= =?UTF-8?q?=E8=B4=A6=E6=98=8E=E7=BB=86=E5=AF=BC=E5=87=BA=EF=BC=9A=E8=A1=A5?= =?UTF-8?q?=E5=85=85=20type=20=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Admin/PlatformOrderController.php | 4 +++- tests/Feature/AdminPlatformOrderExportLedgerTest.php | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Admin/PlatformOrderController.php b/app/Http/Controllers/Admin/PlatformOrderController.php index 1b3dc58..1eef921 100644 --- a/app/Http/Controllers/Admin/PlatformOrderController.php +++ b/app/Http/Controllers/Admin/PlatformOrderController.php @@ -440,11 +440,12 @@ class PlatformOrderController extends Controller fputcsv($out, []); // 明细表头 - fputcsv($out, ['record_type', 'channel', 'amount', 'biz_time', 'created_at', 'admin_id', 'note']); + fputcsv($out, ['record_type', 'receipt_type', 'channel', 'amount', 'biz_time', 'created_at', 'admin_id', 'note']); foreach ($paymentReceipts as $r) { fputcsv($out, [ 'payment', + (string) (data_get($r, 'type') ?? ''), (string) (data_get($r, 'channel') ?? ''), (string) (data_get($r, 'amount') ?? ''), (string) (data_get($r, 'paid_at') ?? ''), @@ -457,6 +458,7 @@ class PlatformOrderController extends Controller foreach ($refundReceipts as $r) { fputcsv($out, [ 'refund', + (string) (data_get($r, 'type') ?? ''), (string) (data_get($r, 'channel') ?? ''), (string) (data_get($r, 'amount') ?? ''), (string) (data_get($r, 'refunded_at') ?? ''), diff --git a/tests/Feature/AdminPlatformOrderExportLedgerTest.php b/tests/Feature/AdminPlatformOrderExportLedgerTest.php index f01c738..d8ed7d9 100644 --- a/tests/Feature/AdminPlatformOrderExportLedgerTest.php +++ b/tests/Feature/AdminPlatformOrderExportLedgerTest.php @@ -87,11 +87,11 @@ class AdminPlatformOrderExportLedgerTest extends TestCase $this->assertStringStartsWith("\xEF\xBB\xBF", $content); // 核心表头 - $this->assertStringContainsString('record_type,channel,amount,biz_time,created_at,admin_id,note', $content); + $this->assertStringContainsString('record_type,receipt_type,channel,amount,biz_time,created_at,admin_id,note', $content); - // 至少包含一条 payment 与一条 refund 行 - $this->assertStringContainsString('payment,offline,10', $content); - $this->assertStringContainsString('refund,offline,1', $content); + // 至少包含一条 payment 与一条 refund 行(包含 type 字段) + $this->assertStringContainsString('payment,bank_transfer,offline,10', $content); + $this->assertStringContainsString('refund,refund,offline,1', $content); } public function test_show_page_should_render_export_ledger_link(): void