feat(admin-dashboard): clarify plan share top5 meta with total and coverage

This commit is contained in:
萝卜
2026-03-16 13:49:56 +08:00
parent 0f07fe7c8b
commit a9f1185f84
3 changed files with 61 additions and 4 deletions

View File

@@ -197,6 +197,14 @@ class DashboardController extends Controller
->get();
// 占比卡(最小可用):近 7 天按套餐统计平台订单数量 TopN
// 说明:
// - Top5 数据用于“对比/聚焦”(减少噪音)
// - total 用于计算“占比/覆盖率”,避免将 Top5 误当全量
$planOrderShareTotal = PlatformOrder::query()
->whereBetween('created_at', [$trendStart, $trendEnd])
->whereNotNull('plan_id')
->count();
$planOrderShare = PlatformOrder::query()
->selectRaw('plan_id, COUNT(*) as cnt')
->whereBetween('created_at', [$trendStart, $trendEnd])
@@ -243,6 +251,7 @@ class DashboardController extends Controller
'platformOrderTrend7d' => $platformOrderTrend7d,
'recentPlatformOrders' => $recentPlatformOrders,
'planOrderShare' => $planOrderShare,
'planOrderShareTotal' => (int) $planOrderShareTotal,
'planIdToName' => $planIdToName,
'merchantRevenueRank7d' => $merchantRevenueRank7d,
'merchantIdToName' => $merchantIdToName,