|
|
|
|
@ -1178,26 +1178,8 @@ class OtherController extends CommonController
|
|
|
|
|
$users->load('company');
|
|
|
|
|
foreach ($users as $user) {
|
|
|
|
|
// 获取该学员的课程报名记录
|
|
|
|
|
// 注意:查询逻辑需要与 companyJoin 方法中使用的 getStudentList 保持一致
|
|
|
|
|
// getStudentList 中 status 参数为 null(不限制状态),只排除状态 4, 5, 6
|
|
|
|
|
$userCourseSigns = CourseSign::where(function ($query) use ($course_ids) {
|
|
|
|
|
// 不限制 status,与 getStudentList 保持一致
|
|
|
|
|
// course_ids筛选
|
|
|
|
|
if ($course_ids && $course_ids->isNotEmpty()) {
|
|
|
|
|
$query->whereIn('course_id', $course_ids);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
->whereHas('course', function ($query) use ($start_date, $end_date) {
|
|
|
|
|
$query->where('is_chart', 1);
|
|
|
|
|
// 开始结束日期的筛选。or查询
|
|
|
|
|
if ($start_date && $end_date) {
|
|
|
|
|
$query->where(function ($q) use ($start_date, $end_date) {
|
|
|
|
|
$q->whereBetween('start_date', [$start_date, $end_date])
|
|
|
|
|
->orWhereBetween('end_date', [$start_date, $end_date]);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
->whereNotIn('status', [4, 5, 6])
|
|
|
|
|
// 使用与 companyJoin 方法完全相同的 getStudentList 逻辑,确保数据一致
|
|
|
|
|
$userCourseSigns = CourseSign::getStudentList($start_date, $end_date, null, $course_ids)
|
|
|
|
|
->where('user_id', $user->id)
|
|
|
|
|
->with(['course.typeDetail'])
|
|
|
|
|
->get();
|
|
|
|
|
|