From eed863e54fe113feffe7e5ad3315482970f87256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Wed, 11 Mar 2026 05:45:59 +0000 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E8=AE=A1=E8=AE=B0=E5=BD=95=EF=BC=9A?= =?UTF-8?q?=E5=BF=AB=E7=85=A7=E5=88=97=E6=94=AF=E6=8C=81=E9=99=8D=E7=BA=A7?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=20filters/subscription=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/platform_orders/show.blade.php | 19 ++++- ...rmOrderAuditSnapshotFallbackRenderTest.php | 77 +++++++++++++++++++ 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/AdminPlatformOrderAuditSnapshotFallbackRenderTest.php diff --git a/resources/views/admin/platform_orders/show.blade.php b/resources/views/admin/platform_orders/show.blade.php index 2efdda4..e8c8d78 100644 --- a/resources/views/admin/platform_orders/show.blade.php +++ b/resources/views/admin/platform_orders/show.blade.php @@ -452,7 +452,24 @@ @if($snapPaid !== null || $snapRefund !== null) paid=¥{{ number_format((float) ($snapPaid ?? 0), 2) }};refund=¥{{ number_format((float) ($snapRefund ?? 0), 2) }} @else - - + @php + $subId = data_get($item, 'subscription_id'); + $filtersText = (string) (data_get($item, 'filters') ?? ''); + $filtersText = $filtersText !== '' ? mb_substr($filtersText, 0, 80) : ''; + @endphp + @if($subId || $filtersText !== '') + @if($subId) + subscription_id={{ $subId }} + @endif + @if($subId && $filtersText !== '') + ; + @endif + @if($filtersText !== '') + filters={{ $filtersText }} + @endif + @else + - + @endif @endif {{ data_get($item, 'note') ?: '' }} diff --git a/tests/Feature/AdminPlatformOrderAuditSnapshotFallbackRenderTest.php b/tests/Feature/AdminPlatformOrderAuditSnapshotFallbackRenderTest.php new file mode 100644 index 0000000..1a03972 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderAuditSnapshotFallbackRenderTest.php @@ -0,0 +1,77 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_show_page_can_render_audit_snapshot_fallback_fields(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'audit_snapshot_fallback_plan_01', + 'name' => '审计快照降级展示测试', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $order = PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_AUDIT_SNAPSHOT_FALLBACK_0001', + 'order_type' => 'new_purchase', + 'status' => 'activated', + 'payment_status' => 'paid', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'quantity' => 1, + 'payable_amount' => 10, + 'paid_amount' => 10, + 'placed_at' => now(), + 'paid_at' => now(), + 'activated_at' => now(), + 'meta' => [ + 'audit' => [ + [ + 'action' => 'batch_activate_subscription', + 'scope' => 'filtered', + 'at' => now()->toDateTimeString(), + 'admin_id' => 1, + 'subscription_id' => 123, + 'filters' => 'syncable_only=1&refund_inconsistent=1', + 'note' => '测试用审计记录', + ], + ], + ], + ]); + + $this->get('/admin/platform-orders/' . $order->id) + ->assertOk() + ->assertSee('subscription_id=123') + ->assertSee('filters=syncable_only=1'); + } +}