|
|
|
|
@ -571,16 +571,18 @@ class OtherController extends CommonController
|
|
|
|
|
|
|
|
|
|
foreach ($companies as $company) {
|
|
|
|
|
// 获取该公司在时间范围内的学员报名记录
|
|
|
|
|
$courseSigns = CourseSign::whereHas('user', function ($query) use ($company) {
|
|
|
|
|
$query->where('company_id', $company->id);
|
|
|
|
|
})->whereDate('created_at', '>=', $start_date)
|
|
|
|
|
->whereDate('created_at', '<=', $end_date)
|
|
|
|
|
->whereNotIn('status', [4, 5])
|
|
|
|
|
->where(function ($query) use ($course_ids) {
|
|
|
|
|
if ($course_ids->isNotEmpty()) {
|
|
|
|
|
$query->whereIn('course_id', $course_ids);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
$courseSigns = CourseSign::where(function ($query) use ($course_ids) {
|
|
|
|
|
$query->where('status', 1);
|
|
|
|
|
if (isset($course_ids)) {
|
|
|
|
|
$query->whereIn('course_id', $course_ids);
|
|
|
|
|
}
|
|
|
|
|
})->whereHas('course', function ($query) use ($start_date, $end_date) {
|
|
|
|
|
// 开始结束日期的筛选。or查询
|
|
|
|
|
if ($start_date && $end_date) {
|
|
|
|
|
$query->whereBetween('start_date', [$start_date, $end_date])
|
|
|
|
|
->orWhereBetween('end_date', [$start_date, $end_date]);
|
|
|
|
|
}
|
|
|
|
|
})->whereNotIn('status', [4, 5, 6])
|
|
|
|
|
->with(['user', 'course.typeDetail'])
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
|