From 46f1a7a2ff7480cc3bca860c14d482c8ccff8529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sun, 15 Mar 2026 08:01:35 +0000 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E8=AE=A2=E9=98=85=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E8=A1=A5=E9=BD=90=E7=BB=AD=E8=B4=B9=E7=BC=BA?= =?UTF-8?q?=E8=AE=A2=E9=98=85=E6=B2=BB=E7=90=86=E5=85=A5=E5=8F=A3=EF=BC=88?= =?UTF-8?q?=E5=90=8C=E7=AB=99=E7=82=B9/=E5=90=8C=E5=A5=97=E9=A4=90?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/site_subscriptions/show.blade.php | 1 + ...lMissingSubscriptionGovernanceLinkTest.php | 70 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 tests/Feature/AdminSiteSubscriptionShowRenewalMissingSubscriptionGovernanceLinkTest.php diff --git a/resources/views/admin/site_subscriptions/show.blade.php b/resources/views/admin/site_subscriptions/show.blade.php index fa06b78..3ec12e0 100644 --- a/resources/views/admin/site_subscriptions/show.blade.php +++ b/resources/views/admin/site_subscriptions/show.blade.php @@ -142,6 +142,7 @@
查看关联平台订单(按订阅ID精确过滤) 查看可同步订单 + 查看续费缺订阅订单(同站点/同套餐) @php $createRenewalOrderUrl = '/admin/platform-orders/create?' . \Illuminate\Support\Arr::query([ 'merchant_id' => $subscription->merchant_id, diff --git a/tests/Feature/AdminSiteSubscriptionShowRenewalMissingSubscriptionGovernanceLinkTest.php b/tests/Feature/AdminSiteSubscriptionShowRenewalMissingSubscriptionGovernanceLinkTest.php new file mode 100644 index 0000000..392c23c --- /dev/null +++ b/tests/Feature/AdminSiteSubscriptionShowRenewalMissingSubscriptionGovernanceLinkTest.php @@ -0,0 +1,70 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_show_should_render_renewal_missing_subscription_governance_link(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + + $plan = Plan::query()->create([ + 'code' => 'sub_show_rms_link_plan', + 'name' => '订阅详情 续费缺订阅治理入口测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $sub = SiteSubscription::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'status' => 'active', + 'source' => 'manual', + 'subscription_no' => 'SS_SHOW_RMS_LINK_0001', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'amount' => 10, + 'starts_at' => now(), + 'ends_at' => now()->addMonth(), + ]); + + $res = $this->get('/admin/site-subscriptions/' . $sub->id); + $res->assertOk(); + + $html = (string) $res->getContent(); + + $this->assertStringContainsString('查看续费缺订阅订单(同站点/同套餐)', $html); + $this->assertStringContainsString('/admin/platform-orders?', $html); + $this->assertStringContainsString('merchant_id=' . $merchant->id, $html); + $this->assertStringContainsString('plan_id=' . $plan->id, $html); + $this->assertStringContainsString('renewal_missing_subscription=1', $html); + + // back 应回到订阅详情自身 + $this->assertStringContainsString('back=' . urlencode('/admin/site-subscriptions/' . $sub->id), $html); + } +}