|
|
@@ -4943,6 +4943,7 @@ class NewsService implements NewsServiceInterface
|
|
|
* */
|
|
|
public function addJobRecruiting(array $data): array
|
|
|
{
|
|
|
+ // var_dump('添加招聘进入news------data',$data);
|
|
|
// return Result::success($data);
|
|
|
$user = User::where('user.id', $data['user_id'])
|
|
|
->where('user.status', 1)
|
|
|
@@ -4969,16 +4970,17 @@ class NewsService implements NewsServiceInterface
|
|
|
if (empty($web)) {
|
|
|
return Result::error("网站不存在", 0);
|
|
|
}
|
|
|
+ // var_dump('添加招聘进入news---user---user',$user);
|
|
|
// return Result::success($user);
|
|
|
- $data['action_id'] = $data['user_id'];
|
|
|
- $data['user_type'] = $user['type_id'];
|
|
|
- $data['cat_arr_id'] = array_values(array_unique($data['cat_arr_id']));
|
|
|
- $data['city_arr_id'] = array_values(array_unique($data['city_arr_id']));
|
|
|
- $data['cat_arr_id'] = isset($data['cat_arr_id']) ? json_encode(array_map('intval', $data['cat_arr_id'])) : '';
|
|
|
- $data['city_arr_id'] = isset($data['city_arr_id']) ? json_encode(array_map('intval', $data['city_arr_id'])) : '';
|
|
|
+ $data['action_id'] = $data['user_id'] ?? null;
|
|
|
+ $data['user_type'] = $user['type_id'] ?? null;
|
|
|
+ $data['cat_arr_id'] = isset($data['cat_arr_id']) && !empty($data['cat_arr_id']) ? array_values(array_unique($data['cat_arr_id'])) : [];
|
|
|
+ $data['city_arr_id'] = isset($data['city_arr_id']) && !empty($data['city_arr_id']) ? array_values(array_unique($data['city_arr_id'])) : [];
|
|
|
+ $data['cat_arr_id'] = isset($data['cat_arr_id']) && $data['cat_arr_id'] != [] ? json_encode(array_map('intval', $data['cat_arr_id'])) : '[]';
|
|
|
+ $data['city_arr_id'] = isset($data['city_arr_id']) && !empty($data['city_arr_id']) ? json_encode(array_map('intval', $data['city_arr_id'])) : '[]';
|
|
|
// 公司地址 管理员必填
|
|
|
- $data['address_arr_id'] = array_values(array_unique($data['address_arr_id']));
|
|
|
- $data['address_arr_id'] = isset($data['address_arr_id']) ? json_encode(array_map('intval', $data['address_arr_id'])) : '';
|
|
|
+ $data['address_arr_id'] = isset($data['address_arr_id']) && !empty($data['address_arr_id']) ? array_values(array_unique($data['address_arr_id'])) : [];
|
|
|
+ $data['address_arr_id'] = isset($data['address_arr_id']) && $data['address_arr_id'] != [] ? json_encode(array_map('intval', $data['address_arr_id'])) : '[]';
|
|
|
// 管理员-企业相关信息
|
|
|
$company = [
|
|
|
// 'user_id' => $data['user_id']?? null,
|
|
|
@@ -4994,11 +4996,12 @@ class NewsService implements NewsServiceInterface
|
|
|
'address' => isset($data['address']) && $data['address'] !== '' ? $data['address'] : null,
|
|
|
'email' => isset($data['email']) && $data['email'] !== '' ? $data['email'] : null,
|
|
|
];
|
|
|
- //去掉相关企业信息
|
|
|
+ //去掉相关企业信息
|
|
|
$job = array_diff_key($data, array_flip(array_keys($company)));
|
|
|
+ // var_dump('添加招聘进入news---job---user',$job);
|
|
|
Db::beginTransaction();
|
|
|
try {
|
|
|
- // 先添加职位相关信息
|
|
|
+ // // 先添加职位相关信息
|
|
|
if ($user['type_id'] == 10000) {
|
|
|
$job['status'] = 1;
|
|
|
}
|
|
|
@@ -5009,34 +5012,28 @@ class NewsService implements NewsServiceInterface
|
|
|
$job['level'] = isset($data['level']) && $data['level'] !== '' ? $data['level'] : null;
|
|
|
$job['job_level'] = isset($data['job_level']) && $data['job_level'] !== '' ? $data['job_level'] : null;
|
|
|
$job['educational'] = isset($data['educational']) && $data['educational'] !== '' ? $data['educational'] : null;
|
|
|
- if ((isset($data['status']) && $data['status'] == 0) || !isset($data['status'])) {
|
|
|
- $this->sendMessage([
|
|
|
- 'talk_type' => 500,
|
|
|
- 'title' => $data['title'],
|
|
|
- 'content' => '提交了审核',
|
|
|
- 'messageType' => 10,
|
|
|
- ]);
|
|
|
- }
|
|
|
+
|
|
|
+ // return Result::success($job);
|
|
|
$jobId = JobRecruiting::insertGetId($job);
|
|
|
if (empty($jobId)) {
|
|
|
Db::rollBack();
|
|
|
return Result::error("添加失败");
|
|
|
}
|
|
|
+
|
|
|
// 添加公司信息
|
|
|
- $company['user_id'] = $data['user_id'] ?? null;
|
|
|
+ $company['user_id'] = isset($data['user_id']) && $data['user_id'] !== '' ? $data['user_id'] : null;
|
|
|
$company['job_id'] = $jobId;
|
|
|
- $company['user_type'] = $user['type_id'] ?? null;
|
|
|
- $company['website_id'] = $data['website_id'] ?? null;
|
|
|
+ $company['user_type'] = isset($user['type_id']) && $user['type_id'] !== '' ? $user['type_id'] : null;
|
|
|
+ $company['website_id'] = isset($data['website_id']) && $data['website_id'] !== '' ? $data['website_id'] : null;
|
|
|
if ($user['type_id'] == 10000) {
|
|
|
// 管理员添加企业信息
|
|
|
- // return Result::success($company);
|
|
|
$companyId = JobCompany::insertGetId($company);
|
|
|
if (empty($companyId)) {
|
|
|
Db::rollBack();
|
|
|
return Result::error("添加失败");
|
|
|
}
|
|
|
} else {
|
|
|
- // 企业会员添加企业信息
|
|
|
+ // 企业会员添加企业信息
|
|
|
$company['user_id'] = isset($data['user_id']) && $data['user_id'] !== '' ? $data['user_id'] : null;
|
|
|
$company['website_id'] = isset($data['website_id']) && $data['website_id'] !== '' ? $data['website_id'] : null;
|
|
|
$company['user_type'] = isset($data['user_type']) && $data['user_type'] !== '' ? $data['user_type'] : null;
|
|
|
@@ -5046,22 +5043,18 @@ class NewsService implements NewsServiceInterface
|
|
|
Db::rollBack();
|
|
|
return Result::error("添加失败");
|
|
|
}
|
|
|
- // return Result::success($company);
|
|
|
}
|
|
|
Db::commit();
|
|
|
- $companyId = JobCompany::insertGetId($company);
|
|
|
$result = [
|
|
|
'job_id' => $jobId,
|
|
|
'company_id' => $companyId,
|
|
|
];
|
|
|
- if (empty($result)) {
|
|
|
- return Result::error("添加失败", 0);
|
|
|
- }
|
|
|
return Result::success($result);
|
|
|
} catch (\Exception $e) {
|
|
|
Db::rollBack();
|
|
|
return Result::error($e->getMessage(), 0);
|
|
|
}
|
|
|
+ // return Result::success($result);
|
|
|
}
|
|
|
/*
|
|
|
* 获取招聘信息详情
|