|
|
|
|
@ -161,7 +161,7 @@ class UserController extends BaseController
|
|
|
|
|
* @OA\Parameter(name="name", in="query", @OA\Schema(type="string"), required=false, description="名字"),
|
|
|
|
|
* @OA\Parameter(name="company_name", in="query", @OA\Schema(type="string"), required=false, description="公司名字"),
|
|
|
|
|
* @OA\Parameter(name="company_position", in="query", @OA\Schema(type="string"), required=false, description="职务"),
|
|
|
|
|
* @OA\Parameter(name="company_area", in="query", @OA\Schema(type="string"), required=false, description="所属区域"),
|
|
|
|
|
* @OA\Parameter(name="company_area", in="query", @OA\Schema(type="string"), required=false, description="所在区域,多个英文逗号分隔,like 匹配关联 company 的 company_area(or 关系)"),
|
|
|
|
|
* @OA\Parameter(name="company_type", in="query", @OA\Schema(type="string"), required=false, description="企业性质"),
|
|
|
|
|
* @OA\Parameter(name="company_industry", in="query", @OA\Schema(type="string"), required=false, description="所属行业"),
|
|
|
|
|
* @OA\Parameter(name="courses_start_date", in="query", @OA\Schema(type="string"), required=false, description="课程开始时间"),
|
|
|
|
|
@ -191,6 +191,7 @@ class UserController extends BaseController
|
|
|
|
|
* @OA\Parameter(name="company_tag", in="query", @OA\Schema(type="string"), required=false, description="企业标签"),
|
|
|
|
|
* @OA\Parameter(name="talent_tags", in="query", @OA\Schema(type="string"), required=false, description="人才标签,多个英文逗号分隔"),
|
|
|
|
|
* @OA\Parameter(name="address", in="query", @OA\Schema(type="string"), required=false, description="公司地址,模糊匹配关联 company 的 company_address 或 company_city"),
|
|
|
|
|
* @OA\Parameter(name="is_rencai", in="query", @OA\Schema(type="string"), required=false, description="是否人才,1=是时筛选;满足任一条即为人才:报名过人才培训课程(typeDetail.name=人才培训) 或 user.type/talent_tags 含「人才」"),
|
|
|
|
|
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
@ -366,9 +367,18 @@ class UserController extends BaseController
|
|
|
|
|
if (isset($all['company_position'])) {
|
|
|
|
|
$query->where('company_position', $all['company_position']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['company_area'])) {
|
|
|
|
|
$company_area = explode(',', $all['company_area']);
|
|
|
|
|
$query->whereIn('company_area', $company_area);
|
|
|
|
|
// 所在区域:like 匹配关联 company 的 company_area,多个英文逗号分隔为 or
|
|
|
|
|
if (isset($all['company_area']) && $all['company_area'] !== '') {
|
|
|
|
|
$company_area = array_filter(array_map('trim', explode(',', $all['company_area'])));
|
|
|
|
|
if (!empty($company_area)) {
|
|
|
|
|
$query->whereHas('company', function ($c) use ($company_area) {
|
|
|
|
|
$c->where(function ($q) use ($company_area) {
|
|
|
|
|
foreach ($company_area as $v) {
|
|
|
|
|
$q->orWhere('company_area', 'like', '%' . $v . '%');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 公司地址:模糊匹配关联 company 的 company_address 或 company_city
|
|
|
|
|
if (isset($all['address']) && $all['address'] !== '') {
|
|
|
|
|
@ -426,6 +436,18 @@ class UserController extends BaseController
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// 是否人才(与 CourseSign::rencai 条件一致):1=是时筛选。任一条即视为人才:报名过人才培训课程 或 type/talent_tags 含「人才」
|
|
|
|
|
if (isset($all['is_rencai']) && (int) $all['is_rencai'] === 1) {
|
|
|
|
|
$query->where(function ($q) {
|
|
|
|
|
$q->whereHas('courseSigns', function ($cs) {
|
|
|
|
|
$cs->where('status', 1)->whereHas('course', function ($c) {
|
|
|
|
|
$c->whereHas('typeDetail', function ($t) {
|
|
|
|
|
$t->where('name', '人才培训');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
})->orWhere('type', 'like', '%人才%')->orWhere('talent_tags', 'like', '%人才%');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})->orderBy($all['sort_name'] ?? 'id', $all['sort_type'] ?? 'desc');
|
|
|
|
|
if (isset($all['is_export']) && !empty($all['is_export'])) {
|
|
|
|
|
$list = $list->limit(5000)->get()->toArray();
|
|
|
|
|
@ -746,13 +768,23 @@ class UserController extends BaseController
|
|
|
|
|
if ($validator->fails()) {
|
|
|
|
|
return $this->fail([StarterResponseCode::START_ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
|
|
|
|
|
}
|
|
|
|
|
$idsArray = explode(',', $all['ids']);
|
|
|
|
|
$data = [];
|
|
|
|
|
$idsArray = array_filter(array_map('trim', explode(',', $all['ids'])));
|
|
|
|
|
if (empty($idsArray)) {
|
|
|
|
|
return $this->fail([StarterResponseCode::START_ERROR_PARAMETER, '编号不能为空']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['is_schoolmate'])) {
|
|
|
|
|
$data['is_schoolmate'] = $all['is_schoolmate'];
|
|
|
|
|
$data['schoolmate_time'] = ($all['is_schoolmate'] == 1) ? now() : null;
|
|
|
|
|
if ($all['is_schoolmate'] == 1) {
|
|
|
|
|
// 仅当 非校友→校友 时写入 schoolmate_time;已是校友的不更新,避免覆盖
|
|
|
|
|
$this->model->whereIn('id', $idsArray)
|
|
|
|
|
->whereRaw('COALESCE(is_schoolmate, 0) != 1')
|
|
|
|
|
->update(['is_schoolmate' => 1, 'schoolmate_time' => now()]);
|
|
|
|
|
} else {
|
|
|
|
|
$this->model->whereIn('id', $idsArray)->update([
|
|
|
|
|
'is_schoolmate' => $all['is_schoolmate'],
|
|
|
|
|
'schoolmate_time' => null,
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$this->model->whereIn('id', $idsArray)->update($data);
|
|
|
|
|
return $this->success('批量更新成功');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|