|
|
|
|
@ -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",
|
|
|
|
|
@ -435,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();
|
|
|
|
|
@ -755,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('批量更新成功');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|