|
|
|
|
@ -289,11 +289,19 @@ class UserController extends BaseController
|
|
|
|
|
if (isset($all['course_name'])) {
|
|
|
|
|
$q->where('name', 'like', '%' . $all['course_name'] . '%');
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['courses_start_date'])) {
|
|
|
|
|
$q->where('start_date', '>=', $all['courses_start_date']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['courses_end_date'])) {
|
|
|
|
|
$q->where('end_date', '<=', $all['courses_end_date']);
|
|
|
|
|
// 课程日期:与统计一致,start_date 或 end_date 在区间内即计入(whereBetween 重叠逻辑)
|
|
|
|
|
if (!empty($all['courses_start_date']) && !empty($all['courses_end_date'])) {
|
|
|
|
|
$q->where(function ($query) use ($all) {
|
|
|
|
|
$query->whereBetween('start_date', [$all['courses_start_date'], $all['courses_end_date']])
|
|
|
|
|
->orWhereBetween('end_date', [$all['courses_start_date'], $all['courses_end_date']]);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
if (!empty($all['courses_start_date'])) {
|
|
|
|
|
$q->where('start_date', '>=', $all['courses_start_date']);
|
|
|
|
|
}
|
|
|
|
|
if (!empty($all['courses_end_date'])) {
|
|
|
|
|
$q->where('end_date', '<=', $all['courses_end_date']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['courses_ing']) && $all['courses_ing'] == 1) {
|
|
|
|
|
$q->where(function ($query) use ($all) {
|
|
|
|
|
@ -304,6 +312,12 @@ class UserController extends BaseController
|
|
|
|
|
if (isset($all['is_chart'])) {
|
|
|
|
|
$q->where('is_chart', $all['is_chart']);
|
|
|
|
|
}
|
|
|
|
|
// from=跟班学员 时与 ganbu_total 口径一致:仅统计 is_count_genban=1 的课程类型
|
|
|
|
|
if (!empty($all['from']) && strpos((string) $all['from'], '跟班学员') !== false) {
|
|
|
|
|
$q->whereHas('typeDetail', function ($q) {
|
|
|
|
|
$q->where('is_count_genban', 1);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
// 不通过的需要全部不通过
|
|
|
|
|
|