feat(admin): 仪表盘收费工作台补齐续费缺订阅快捷入口

This commit is contained in:
萝卜
2026-03-15 19:29:26 +08:00
parent 1514700b87
commit b7471026ef
3 changed files with 40 additions and 0 deletions

View File

@@ -51,6 +51,10 @@ class DashboardController extends Controller
'platform_orders_sync_failed' => PlatformOrder::query()
->whereRaw("JSON_EXTRACT(meta, '$.subscription_activation_error.message') IS NOT NULL")
->count(),
'platform_orders_renewal_missing_subscription' => PlatformOrder::query()
->where('order_type', 'renewal')
->whereNull('site_subscription_id')
->count(),
// 站点治理
'active_merchants' => Merchant::query()->where('status', 'active')->count(),

View File

@@ -103,6 +103,7 @@
<a class="btn btn-secondary btn-sm" href="{!! $platformOrdersQuickLinks['paid_pending'] !!}">待生效({{ (int) ($stats['platform_orders_paid_pending'] ?? 0) }}</a>
<a class="btn btn-secondary btn-sm" href="{!! $platformOrdersQuickLinks['syncable_only'] !!}">可同步</a>
<a class="btn btn-secondary btn-sm" href="{!! $platformOrdersQuickLinks['sync_failed'] !!}">同步失败({{ (int) ($stats['platform_orders_sync_failed'] ?? 0) }}</a>
<a class="btn btn-secondary btn-sm" href="{!! \App\Support\BackUrl::withBack('/admin/platform-orders?renewal_missing_subscription=1', $selfWithoutBack) !!}">续费缺订阅({{ (int) ($stats['platform_orders_renewal_missing_subscription'] ?? 0) }}</a>
</div>
</div>

View File

@@ -0,0 +1,35 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminDashboardBillingWorkbenchShouldIncludeRenewalMissingSubscriptionQuickLinkTest 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_dashboard_billing_workbench_should_include_renewal_missing_subscription_quick_link(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin');
$res->assertOk();
// 链接应携带 back 回到仪表盘,并且 & 不应被 escape
$res->assertSee('href="/admin/platform-orders?renewal_missing_subscription=1&back=%2Fadmin"', false);
$res->assertDontSee('&amp;back=', false);
$res->assertSee('续费缺订阅', false);
}
}