|
|
|
|
@ -79,21 +79,20 @@ class CourseSign extends SoftDeletesModel
|
|
|
|
|
*/
|
|
|
|
|
public static function getStudentList($start_date = null, $end_date = null, $status = null, $course_ids = null)
|
|
|
|
|
{
|
|
|
|
|
$baseQuery = CourseSign::with('user', 'course')
|
|
|
|
|
->where(function ($query) use ($course_ids, $status) {
|
|
|
|
|
if ($status) {
|
|
|
|
|
$query->where('status', $status);
|
|
|
|
|
}
|
|
|
|
|
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]);
|
|
|
|
|
$baseQuery = CourseSign::where(function ($query) use ($course_ids, $status) {
|
|
|
|
|
if ($status) {
|
|
|
|
|
$query->where('status', $status);
|
|
|
|
|
}
|
|
|
|
|
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]);
|
|
|
|
|
return $baseQuery;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|