|
|
|
|
@ -496,6 +496,8 @@ class OtherController extends CommonController
|
|
|
|
|
case 'course_signs_pass_unique':
|
|
|
|
|
// 审核通过人数去重明细 - 使用courseSignsTotalByUnique方法获取列表(与coursesHome保持一致)
|
|
|
|
|
$users = CourseSign::courseSignsTotalByUnique($start_date, $end_date, 1, $course_ids, true);
|
|
|
|
|
// 预加载 company 关系,避免 N+1 查询问题
|
|
|
|
|
$users->load('company');
|
|
|
|
|
foreach ($users as $user) {
|
|
|
|
|
// 获取该学员报名的课程列表 - 使用与getStudentList完全一致的逻辑
|
|
|
|
|
$userCourseSigns = CourseSign::where(function ($query) use ($course_ids) {
|
|
|
|
|
@ -522,12 +524,23 @@ class OtherController extends CommonController
|
|
|
|
|
->get();
|
|
|
|
|
$courseNames = $userCourseSigns->pluck('course.name')->filter()->unique()->implode("\n\r");
|
|
|
|
|
|
|
|
|
|
// 优先使用 company 关系的企业信息,如果不存在则使用 User 表的 company_name 字段
|
|
|
|
|
$companyName = $user->company && $user->company->company_name
|
|
|
|
|
? $user->company->company_name
|
|
|
|
|
: ($user->company_name ?? '');
|
|
|
|
|
$companyArea = $user->company && $user->company->company_area
|
|
|
|
|
? $user->company->company_area
|
|
|
|
|
: ($user->company_area ?? '');
|
|
|
|
|
$companyIndustry = $user->company && $user->company->company_industry
|
|
|
|
|
? $user->company->company_industry
|
|
|
|
|
: ($user->company_industry ?? '');
|
|
|
|
|
|
|
|
|
|
$data[] = [
|
|
|
|
|
'user_name' => $user->name ?? '',
|
|
|
|
|
'mobile' => $user->mobile ?? '',
|
|
|
|
|
'company_name' => $user->company->company_name ?? '',
|
|
|
|
|
'company_area' => $user->company->company_area ?? '',
|
|
|
|
|
'company_industry' => $user->company->company_industry ?? '',
|
|
|
|
|
'company_name' => $companyName,
|
|
|
|
|
'company_area' => $companyArea,
|
|
|
|
|
'company_industry' => $companyIndustry,
|
|
|
|
|
'course_names' => $courseNames,
|
|
|
|
|
'course_count' => $userCourseSigns->count(),
|
|
|
|
|
];
|
|
|
|
|
|