chore(seed): enrich plan share demo data for dashboard top5

This commit is contained in:
萝卜
2026-03-16 22:12:45 +08:00
parent 5e73e03ac2
commit 07fb547e0e
2 changed files with 181 additions and 14 deletions

View File

@@ -41,20 +41,24 @@ class AdminDashboardPlanOrderShareTop5ShouldLinkToPlatformOrdersListByPlanTest e
'published_at' => now(),
]);
PlatformOrder::query()->create([
'merchant_id' => $merchant->id,
'plan_id' => $plan->id,
'site_subscription_id' => null,
'created_by_admin_id' => $platformAdminId ?: null,
'order_no' => 'PO_DASH_SHARE_LINK_0001',
'order_type' => 'new_purchase',
'status' => 'pending',
'payment_status' => 'paid',
'payable_amount' => 10,
'paid_amount' => 10,
'placed_at' => now(),
'meta' => [],
]);
// 说明InitialDemoSeeder 会补齐较多“套餐占比”演示数据;为了确保本用例构造的套餐进入 Top5
// 这里需要造足够多的同套餐订单(按“订单数”口径统计)。
for ($i = 1; $i <= 30; $i++) {
PlatformOrder::query()->create([
'merchant_id' => $merchant->id,
'plan_id' => $plan->id,
'site_subscription_id' => null,
'created_by_admin_id' => $platformAdminId ?: null,
'order_no' => 'PO_DASH_SHARE_LINK_' . str_pad((string) $i, 4, '0', STR_PAD_LEFT),
'order_type' => 'new_purchase',
'status' => 'pending',
'payment_status' => 'paid',
'payable_amount' => 10,
'paid_amount' => 10,
'placed_at' => now(),
'meta' => [],
]);
}
$res = $this->get('/admin');
$res->assertOk();