From 0db14263fe693129d6a425e7e740a569db291e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Tue, 10 Mar 2026 12:23:37 +0000 Subject: [PATCH] feat(admin): platform orders list link to subscription show --- .../admin/platform_orders/index.blade.php | 8 +++- tests/Feature/AdminPlatformOrderTest.php | 40 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php index f327bb5..2097416 100644 --- a/resources/views/admin/platform_orders/index.blade.php +++ b/resources/views/admin/platform_orders/index.blade.php @@ -261,7 +261,13 @@ 未同步 @endif - {{ $order->siteSubscription?->subscription_no ?: '-' }} + + @if($order->siteSubscription) + {{ $order->siteSubscription->subscription_no }} + @else + - + @endif + {{ optional($order->siteSubscription?->ends_at)->format('Y-m-d H:i:s') ?: '-' }} {{ data_get($order->meta, 'subscription_activation.synced_at') ?: '-' }} diff --git a/tests/Feature/AdminPlatformOrderTest.php b/tests/Feature/AdminPlatformOrderTest.php index a9b79c1..9dd0605 100644 --- a/tests/Feature/AdminPlatformOrderTest.php +++ b/tests/Feature/AdminPlatformOrderTest.php @@ -174,6 +174,46 @@ class AdminPlatformOrderTest extends TestCase ->assertSee('模拟失败') ->assertSee('余额不足'); + // 订阅号列应可点击进入订阅详情(提升治理联动效率) + $sub = \App\Models\SiteSubscription::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'status' => 'activated', + 'source' => 'manual', + 'subscription_no' => 'SUB_LINK_0001', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'amount' => 10, + 'starts_at' => now()->subDay(), + 'ends_at' => now()->addMonth(), + 'activated_at' => now()->subDay(), + ]); + + PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'site_subscription_id' => $sub->id, + 'order_no' => 'PO_SUB_LINK_0001', + 'order_type' => 'renewal', + 'status' => 'activated', + 'payment_status' => 'paid', + 'plan_name' => '专业版(月付)', + 'billing_cycle' => 'monthly', + 'period_months' => 1, + 'quantity' => 1, + 'payable_amount' => 199, + 'paid_amount' => 199, + 'placed_at' => now()->subMinutes(2), + 'paid_at' => now()->subMinutes(1), + 'activated_at' => now(), + ]); + + $this->get('/admin/platform-orders?keyword=PO_SUB_LINK_0001') + ->assertOk() + ->assertSee('SUB_LINK_0001') + ->assertSee('/admin/site-subscriptions/' . $sub->id); + // 只看已同步:构造一条带有 subscription_activation 的订单 + 批量同步审计(用于列表展示) PlatformOrder::query()->where('order_no', 'PO202603100101')->update([ 'meta' => [