高考版优化

审核模式优化
This commit is contained in:
Ghost
2026-04-29 18:01:26 +08:00
parent 59419c4ce9
commit a411bf7b21
134 changed files with 19898 additions and 3371 deletions

View File

@@ -149,11 +149,31 @@ class Dashboard extends BaseController
$distributionPdp = $this->aggregateTestLabels($enterpriseId, 'pdp', 12);
$faceSubtypeHints = $this->aggregateFaceSubtypeHints($enterpriseId, 8);
// 与本企业财务/订单列表一致:已支付订单实收累计(分)
$paidStatuses = ['paid', 'completed'];
$incomeProductTypes = ['face', 'mbti', 'sbti', 'disc', 'pdp', 'ai_deep_report'];
$incomeQuery = Db::name('orders')
->whereIn('status', $paidStatuses)
->whereIn('productType', $incomeProductTypes);
if ($enterpriseId) {
$incomeQuery->where('enterpriseId', $enterpriseId);
}
$totalRevenueFen = (int) ($incomeQuery->sum('amount') ?? 0);
// 企业余额侧累计扣款概览「AI/算力消耗」卡片与财务管理口径对齐
$consumeQuery = Db::name('finance_records')->where('type', 'consume');
if ($enterpriseId) {
$consumeQuery->where('enterpriseId', $enterpriseId);
}
$aiCostFen = (int) ($consumeQuery->sum('amount') ?? 0);
return success([
'totalUsers' => $totalUsers,
'testsCompleted' => $testsCompleted,
'activeToday' => $activeToday,
'pendingReviews' => $pendingReviews,
'totalRevenue' => $totalRevenueFen,
'aiCost' => $aiCostFen,
'testTrends' => $trendData,
'topTestUsers' => $topTestUsers,
'testCatalog' => $testCatalog,