高考版优化
审核模式优化
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user