diff --git a/app/Http/Controllers/Admin/PlatformOrderController.php b/app/Http/Controllers/Admin/PlatformOrderController.php index 654b9e0..3c9f5db 100644 --- a/app/Http/Controllers/Admin/PlatformOrderController.php +++ b/app/Http/Controllers/Admin/PlatformOrderController.php @@ -436,9 +436,10 @@ class PlatformOrderController extends Controller // UTF-8 BOM,避免 Excel 打开中文乱码 fwrite($out, "\xEF\xBB\xBF"); - // 订单摘要(基础两行) + // 订单摘要(基础三行) fputcsv($out, ['order_id', (string) $order->id]); fputcsv($out, ['order_no', (string) $order->order_no]); + fputcsv($out, ['exported_at', now()->format('Y-m-d H:i:s')]); // 可选:导出更多订单快照字段(便于财务/对账留档,不必另截图) if ($includeOrderSnapshot) { diff --git a/tests/Feature/AdminPlatformOrderExportLedgerTest.php b/tests/Feature/AdminPlatformOrderExportLedgerTest.php index 80bb5df..01a3c26 100644 --- a/tests/Feature/AdminPlatformOrderExportLedgerTest.php +++ b/tests/Feature/AdminPlatformOrderExportLedgerTest.php @@ -92,6 +92,10 @@ class AdminPlatformOrderExportLedgerTest extends TestCase $this->assertStringStartsWith("\xEF\xBB\xBF", $content); $this->assertStringStartsWith("\xEF\xBB\xBF", $content2); + // exported_at 摘要行 + $this->assertStringContainsString('exported_at,', $content); + $this->assertStringContainsString('exported_at,', $content2); + // 核心表头 $this->assertStringContainsString('record_type,receipt_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', $content2);