feat: 高考志愿与定价分销链路更新(管理端/API/小程序)

- 新增高考志愿核心服务、模型、控制器与迁移脚本

- 同步管理端定价/分销/设置与小程序入口、历史、测试选择和支付逻辑

- 补充相关开发文档

Made-with: Cursor
This commit is contained in:
Ghost
2026-04-25 16:19:08 +08:00
parent 513093a5e0
commit c4ac0f8a08
56 changed files with 6100 additions and 68 deletions

View File

@@ -172,6 +172,8 @@ class AppUser extends BaseController
$enterpriseName = $ent['name'] ?? ('企业' . $enterpriseId);
}
$coopMap = [];
$gaokaoMap = [];
$gaokaoReportMap = [];
if (!empty($ids)) {
// 测试统计严格按 test_results.enterpriseId 归属企业过滤
$trBase = Db::name('test_results')->where('userId', 'in', $ids);
@@ -313,6 +315,47 @@ class AppUser extends BaseController
$coopMap = [];
}
}
// 高考任务状态与最近报告摘要
try {
$gqRows = Db::name('gaokao_user_profile')
->whereIn('userId', $ids)
->where('tenantId', (int) $enterpriseId)
->field('id,userId,entryStatus,mbtiStatus,pdpStatus,discStatus,formStatus,analyzeStatus,lastAnalyzeAt,latestReportId,tagsJson')
->select()
->toArray();
$reportIds = [];
foreach ($gqRows as $gr) {
$uid = (int) ($gr['userId'] ?? 0);
if ($uid > 0) {
$gaokaoMap[$uid] = $gr;
if (!empty($gr['latestReportId'])) {
$reportIds[] = (int) $gr['latestReportId'];
}
}
}
$reportIds = array_values(array_unique(array_filter($reportIds)));
if ($reportIds) {
$rRows = Db::name('test_results')
->whereIn('id', $reportIds)
->where('testType', 'gaokao')
->field('id,resultData')
->select()
->toArray();
foreach ($rRows as $rr) {
$raw = $rr['resultData'] ?? '';
$rd = is_string($raw) ? (json_decode($raw, true) ?: []) : (is_array($raw) ? $raw : []);
$ov = (string) ($rd['overview'] ?? '');
if ($ov === '' && isset($rd['report']['overview'])) {
$ov = (string) $rd['report']['overview'];
}
$gaokaoReportMap[(int) $rr['id']] = $ov;
}
}
} catch (\Throwable $e) {
$gaokaoMap = [];
$gaokaoReportMap = [];
}
}
foreach ($list as &$row) {
@@ -358,6 +401,19 @@ class AppUser extends BaseController
$row['cooperationModeTitle'] = null;
$row['cooperationChosenAt'] = null;
}
$gq = $gaokaoMap[$id] ?? null;
$row['gaokaoEntryStatus'] = $gq ? (int) ($gq['entryStatus'] ?? 0) : 0;
$row['gaokaoAnalyzeStatus'] = $gq ? (int) ($gq['analyzeStatus'] ?? 0) : 0;
$row['gaokaoFormStatus'] = $gq ? (int) ($gq['formStatus'] ?? 0) : 0;
$row['gaokaoTaskStatus'] = [
'mbti' => $gq ? (int) ($gq['mbtiStatus'] ?? 0) : 0,
'pdp' => $gq ? (int) ($gq['pdpStatus'] ?? 0) : 0,
'disc' => $gq ? (int) ($gq['discStatus'] ?? 0) : 0,
];
$row['gaokaoLastAnalyzeAt'] = $gq ? (int) ($gq['lastAnalyzeAt'] ?? 0) : 0;
$rid = $gq ? (int) ($gq['latestReportId'] ?? 0) : 0;
$row['gaokaoOverview'] = $rid > 0 ? (string) ($gaokaoReportMap[$rid] ?? '') : '';
}
return paginate_response($list, $total, $page, $pageSize);
@@ -501,6 +557,28 @@ class AppUser extends BaseController
? ResumeUploadsAdminService::listForWechatUser((int) $id, (int) $enterpriseId)
: [];
// 高考结果信息
try {
$gq = Db::name('gaokao_user_profile')
->where('userId', (int) $id)
->where('tenantId', (int) $enterpriseId)
->find();
if ($gq) {
$data['gaokaoProfile'] = $gq;
$rid = (int) ($gq['latestReportId'] ?? 0);
if ($rid > 0) {
$data['gaokaoLatestReport'] = Db::name('test_results')
->where('id', $rid)
->where('testType', 'gaokao')
->find();
}
} else {
$data['gaokaoProfile'] = null;
}
} catch (\Throwable $e) {
$data['gaokaoProfile'] = null;
}
return success($data);
}