From 788ee944d8ff4ddfd113fb8e03d59408cee75a57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Wed, 11 Mar 2026 09:27:36 +0000 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=AE=A2=E5=8D=95=EF=BC=9A?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=A4=B1=E8=B4=A5=E5=8E=9F=E5=9B=A0TOP5?= =?UTF-8?q?=E8=A1=A5=E9=BD=90=E5=8F=AF=E5=90=8C=E6=AD=A5=E9=87=8D=E8=AF=95?= =?UTF-8?q?=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/platform_orders/index.blade.php | 2 + ...OrderSyncFailedReasonTop5RetryLinkTest.php | 79 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 tests/Feature/AdminPlatformOrderSyncFailedReasonTop5RetryLinkTest.php diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php index da10a50..c8514fc 100644 --- a/resources/views/admin/platform_orders/index.blade.php +++ b/resources/views/admin/platform_orders/index.blade.php @@ -243,6 +243,8 @@
{{ $reason }} ({{ $item['count'] }}) + + 切到可同步重试
@endforeach diff --git a/tests/Feature/AdminPlatformOrderSyncFailedReasonTop5RetryLinkTest.php b/tests/Feature/AdminPlatformOrderSyncFailedReasonTop5RetryLinkTest.php new file mode 100644 index 0000000..68c5780 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderSyncFailedReasonTop5RetryLinkTest.php @@ -0,0 +1,79 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_sync_failed_reason_top5_shows_retry_link_to_syncable_only_scope(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'sync_failed_reason_retry_link_test', + 'name' => '同步失败原因重试链接测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + // 构造一条失败原因数据,触发 TOP5 + PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_SYNC_FAILED_REASON_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' => [ + 'subscription_activation_error' => [ + 'message' => '模拟失败原因TOP5', + 'at' => now()->toDateTimeString(), + 'admin_id' => 1, + ], + ], + ]); + + $page = $this->get('/admin/platform-orders'); + $page->assertOk(); + + // 失败原因链接存在 + $page->assertSee('sync_status=failed', false); + $page->assertSee('sync_error_keyword=', false); + + // “切到可同步重试”链接存在:应包含 syncable_only=1,并不应包含 sync_status=failed + $page->assertSee('切到可同步重试'); + $page->assertSee('syncable_only=1', false); + $page->assertDontSee('sync_status=failed&syncable_only=1', false); + } +}