feat(admin): 套餐列表补齐续费缺订阅治理入口

This commit is contained in:
萝卜
2026-03-15 08:07:07 +00:00
parent 46f1a7a2ff
commit f3afa2b305
2 changed files with 58 additions and 0 deletions

View File

@@ -260,9 +260,16 @@
'order_type' => 'new_purchase',
]), $selfWithoutBack);
@endphp
@php
$renewalMissingSubscriptionUrl = $makePlatformOrderUrl([
'plan_id' => $plan->id,
'renewal_missing_subscription' => '1',
]);
@endphp
<div class="actions gap-10">
<a href="{!! $editPlanUrl !!}" class="btn btn-secondary btn-sm">编辑</a>
<a href="{!! $createOrderUrl !!}" class="btn btn-sm">创建订单</a>
<a href="{!! $renewalMissingSubscriptionUrl !!}" class="btn btn-secondary btn-sm">续费缺订阅</a>
</div>
<form method="post" action="/admin/plans/{{ $plan->id }}/set-status" class="mt-6 actions gap-10">

View File

@@ -0,0 +1,51 @@
<?php
namespace Tests\Feature;
use App\Models\Plan;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlanIndexRenewalMissingSubscriptionGovernanceLinkTest extends TestCase
{
use RefreshDatabase;
protected function loginAsPlatformAdmin(): void
{
$this->seed();
$this->post('/admin/login', [
'email' => 'platform.admin@demo.local',
'password' => 'Platform@123456',
])->assertRedirect('/admin');
}
public function test_plan_index_should_render_renewal_missing_subscription_governance_link(): void
{
$this->loginAsPlatformAdmin();
$plan = Plan::query()->create([
'code' => 'plan_index_rms_link_plan',
'name' => '套餐页续费缺订阅治理入口测试套餐',
'billing_cycle' => 'monthly',
'price' => 10,
'list_price' => 10,
'status' => 'active',
'sort' => 10,
'published_at' => now(),
]);
$res = $this->get('/admin/plans');
$res->assertOk();
$html = (string) $res->getContent();
// 操作区应出现“续费缺订阅”入口
$this->assertStringContainsString('续费缺订阅', $html);
// 链接应带 plan_id + renewal_missing_subscription=1并携带 back 回套餐页
$this->assertStringContainsString('/admin/platform-orders?plan_id=' . $plan->id, $html);
$this->assertStringContainsString('renewal_missing_subscription=1', $html);
$this->assertStringContainsString('back=' . urlencode('/admin/plans'), $html);
}
}