|
|
|
@ -436,11 +436,61 @@ class UserController extends BaseController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 是否人才(与 CourseSign::rencai 条件一致):1=是时筛选。任一条即视为人才:报名过人才培训课程 或 type/talent_tags 含「人才」
|
|
|
|
// 是否人才(与 CourseSign::rencai 口径一致):1=是时筛选。任一条即视为人才:报名过人才培训课程 或 type/talent_tags 含「人才」。
|
|
|
|
|
|
|
|
// 人才培训:仅在本次查询的课程与时间范围内(courses_start/end、is_chart 等)认定,与 cover_rencai_total 一致。
|
|
|
|
if (isset($all['is_rencai']) && (int) $all['is_rencai'] === 1) {
|
|
|
|
if (isset($all['is_rencai']) && (int) $all['is_rencai'] === 1) {
|
|
|
|
$query->where(function ($q) {
|
|
|
|
$query->where(function ($q) use ($all) {
|
|
|
|
$q->whereHas('courseSigns', function ($cs) {
|
|
|
|
$q->whereHas('courseSigns', function ($cs) use ($all) {
|
|
|
|
$cs->where('status', 1)->whereHas('course', function ($c) {
|
|
|
|
$cs->where('status', 1);
|
|
|
|
|
|
|
|
if (isset($all['course_id'])) {
|
|
|
|
|
|
|
|
$cs->where('course_id', $all['course_id']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($all['sign_start_date']) && isset($all['sign_end_date'])) {
|
|
|
|
|
|
|
|
$cs->whereBetween('created_at', [$all['sign_start_date'], $all['sign_end_date']]);
|
|
|
|
|
|
|
|
} elseif (isset($all['sign_start_date'])) {
|
|
|
|
|
|
|
|
$cs->where('created_at', '>=', $all['sign_start_date']);
|
|
|
|
|
|
|
|
} elseif (isset($all['sign_end_date'])) {
|
|
|
|
|
|
|
|
$cs->where('created_at', '<=', $all['sign_end_date']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$cs->whereHas('course', function ($c) use ($all) {
|
|
|
|
|
|
|
|
if (isset($all['year'])) {
|
|
|
|
|
|
|
|
$c->where('year', $all['year']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($all['is_fee'])) {
|
|
|
|
|
|
|
|
$c->where('is_fee', $all['is_fee']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($all['course_type'])) {
|
|
|
|
|
|
|
|
$c->where('type', $all['course_type']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($all['course_name'])) {
|
|
|
|
|
|
|
|
$c->where('name', 'like', '%' . $all['course_name'] . '%');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($all['courses_start_date']) && !empty($all['courses_end_date'])) {
|
|
|
|
|
|
|
|
$c->where(function ($q2) use ($all) {
|
|
|
|
|
|
|
|
$q2->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'])) {
|
|
|
|
|
|
|
|
$c->where('start_date', '>=', $all['courses_start_date']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($all['courses_end_date'])) {
|
|
|
|
|
|
|
|
$c->where('end_date', '<=', $all['courses_end_date']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($all['courses_ing']) && $all['courses_ing'] == 1) {
|
|
|
|
|
|
|
|
$c->where(function ($q2) {
|
|
|
|
|
|
|
|
$q2->where('start_date', '<=', date('Y-m-d'))->where('end_date', '>=', date('Y-m-d'));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($all['is_chart'])) {
|
|
|
|
|
|
|
|
$c->where('is_chart', $all['is_chart']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($all['from']) && strpos((string) $all['from'], '跟班学员') !== false) {
|
|
|
|
|
|
|
|
$c->whereHas('typeDetail', function ($t) {
|
|
|
|
|
|
|
|
$t->where('is_count_genban', 1);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
$c->whereHas('typeDetail', function ($t) {
|
|
|
|
$c->whereHas('typeDetail', function ($t) {
|
|
|
|
$t->where('name', '人才培训');
|
|
|
|
$t->where('name', '人才培训');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|