|
@@ -1323,6 +1323,42 @@ class NewsService implements NewsServiceInterface
|
|
|
return $good;
|
|
|
});
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 获取商城首页-根据栏目id
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ * */
|
|
|
+ function getWebsiteCatidshop(array $data): array
|
|
|
+ {
|
|
|
+ $input['catid'] = $data['catid'];
|
|
|
+ $input['website_id'] = $data['website_id'];
|
|
|
+ $data = json_decode($input['catid'] ?? '', true) ?? [];
|
|
|
+ $result = array_map(function ($item) use ($input) {
|
|
|
+ if (isset($item['catid']) && $item['catid'] != 'undefined' && $item['catid']!= "") {
|
|
|
+ list($catid, $goodStart,$goodNum) = explode(',', $item['catid']);
|
|
|
+ $category = WebsiteCategory::where('category_id', $catid)->where('website_id', $input['website_id'])->first(['type']);
|
|
|
+ // 类型:1资讯(默认)2商品3书刊音像4招聘5求职类型:1资讯(默认)2商品3书刊音像4招聘5求职6招工招聘
|
|
|
+ if(empty($category) || $category->type != 2){
|
|
|
+ return Result::error("暂无此栏目",0);
|
|
|
+ }else{
|
|
|
+ $website['website_id'] = $input['website_id'];
|
|
|
+ $goods = Good::where('good.status', 2)
|
|
|
+ ->where('good.website_id', $website['website_id'])
|
|
|
+ ->whereRaw("JSON_CONTAINS(good.cat_arr_id, '". intval($catid). "') = 1")
|
|
|
+ ->select('good.id', 'good.name', 'good.imgurl', 'good.description', 'good.updated_at',
|
|
|
+ 'good.catid','good.type_id','good.price','good.com','good.level','good.unit')
|
|
|
+ ->orderBy('updated_at','desc')
|
|
|
+ ->offset($goodStart)
|
|
|
+ ->limit($goodNum);
|
|
|
+ $all_goods = $goods->get();
|
|
|
+ $all_goods = $this->processGoods($all_goods, $website);
|
|
|
+ }
|
|
|
+
|
|
|
+ return $all_goods ?? [];
|
|
|
+ }
|
|
|
+ }, $data);
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
/**
|
|
|
* 获取商品模块
|
|
|
* @param array $data
|
|
@@ -1642,27 +1678,29 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
}
|
|
|
// 取行业
|
|
|
- if(!empty($job->hy_id) || !empty($job->industry) || !empty($job->company_hy_id)){
|
|
|
+ if(!empty($job->hy_id) || !empty($job->industry) || !empty($job->company_hy_id || !empty($job->job_industry))){
|
|
|
$hy_name = JobIndustry::when($job, function ($query) use ($job) {
|
|
|
if(!empty($job->industry)){
|
|
|
$query->where('hyid', $job->industry);
|
|
|
}else if(!empty($job->hy_id)){
|
|
|
$query->where('hyid', $job->hy_id);
|
|
|
- }else{
|
|
|
+ }else if(!empty($job->company_hy_id)){
|
|
|
$query->where('hyid', $job->company_hy_id);
|
|
|
+ } else{
|
|
|
+ $query->where('hyid', $job->job_industry);
|
|
|
}
|
|
|
})->first(['hyname']);
|
|
|
$job->hy_name = $hy_name->hyname?? '';
|
|
|
}
|
|
|
- // 取职位
|
|
|
- if((isset($job->zw_id) && !empty($job->zw_id)) || (isset($job->job) && !empty($job->job))){
|
|
|
- $zwid = $job->job?? $job->zw_id;
|
|
|
+ // 取职位类别
|
|
|
+ if((isset($job->zw_id) && !empty($job->zw_id)) || (isset($job->job) && !empty($job->job)) || (isset($job->job_typename) && !empty($job->job_typename))){
|
|
|
+ $zwid = $job->job ?? $job->zw_id ?? $job->job_typename;
|
|
|
$zw_name = JobPosition::where('zwid', $zwid)->first(['zwname']);
|
|
|
$job->zw_name = $zw_name->zwname?? '';
|
|
|
}
|
|
|
// 取具体职位
|
|
|
- if((isset($job->jtzw_id) &&!empty($job->jtzw_id)) || (isset($job->job_name_get) && !empty($job->job_name_get))){
|
|
|
- $jtzwid = $job->job_name_get ?? $job->jtzw_id;
|
|
|
+ if((isset($job->jtzw_id) &&!empty($job->jtzw_id)) || (isset($job->job_name_get) && !empty($job->job_name_get)) || (isset($job->job_name) && !empty($job->job_name))){
|
|
|
+ $jtzwid = $job->job_name_get ?? $job->jtzw_id ?? $job->job_name;
|
|
|
$jtzw_name = JobPosition::where('zwid', $jtzwid)->first(['zwname']);
|
|
|
$job->jtzw_name = $jtzw_name->zwname?? '';
|
|
|
}
|
|
@@ -1672,8 +1710,9 @@ class NewsService implements NewsServiceInterface
|
|
|
$job->experience_name = $experience->ename?? '';
|
|
|
}
|
|
|
// 取学历
|
|
|
- if(isset($job->educational) &&!empty($job->educational)){
|
|
|
- $education = JobEnum::where('egroup','education')->where('evalue',$job->educational)->first(['ename']);
|
|
|
+ if(isset($job->educational) &&!empty($job->educational) || isset($job->school_education) && !empty($job->school_education)) {
|
|
|
+ $education = $job->educational ?? $job->school_education;
|
|
|
+ $education = JobEnum::where('egroup','education')->where('evalue',$education)->first(['ename']);
|
|
|
$job->education_name = $education->ename?? '';
|
|
|
}
|
|
|
// 语言
|
|
@@ -2259,7 +2298,7 @@ class NewsService implements NewsServiceInterface
|
|
|
->where('website_id', $data['website_id'])
|
|
|
->select('*');
|
|
|
$job = $query->where('job_recruiting.id', $data['id'])->get();
|
|
|
- $company = JobCompany::where('job_id', $data['id'])->select('id','business_name','company_hy_id','company_size','company_nature','address_arr_id','address')->get();
|
|
|
+ $company = JobCompany::where('job_id', $data['id'])->select('id','business_name','company_hy_id','company_size','company_nature','address_arr_id','address','job_company.email')->get();
|
|
|
if(!empty($company)){
|
|
|
$result['company'] = $this->processJob($company, $webid);
|
|
|
}
|
|
@@ -2275,12 +2314,14 @@ class NewsService implements NewsServiceInterface
|
|
|
$result['other_job'] = $this->processJob($other_job, $webid);
|
|
|
}
|
|
|
}else{
|
|
|
+ // 简历相关信息
|
|
|
$job = JobHunting::where('job_hunting.status', 2)
|
|
|
->where('job_hunting.website_id', $data['website_id'])
|
|
|
->where('job_hunting.id', $data['id'])
|
|
|
->leftJoin('user', 'user.id', '=', 'job_hunting.user_id')
|
|
|
->select('job_hunting.*','user_name')
|
|
|
->get();
|
|
|
+
|
|
|
$resume = JobRemuse::where('hunt_id',$data['id'])->get();
|
|
|
if(!empty($resume->toArray())){
|
|
|
$result['resume'] = 1;
|
|
@@ -2291,8 +2332,76 @@ class NewsService implements NewsServiceInterface
|
|
|
if(empty($job->toArray())){
|
|
|
return Result::error("id参数错误", 0);
|
|
|
}
|
|
|
+ if(!empty($job[0]['job_experience'])){
|
|
|
+ $job_experience = json_decode($job[0]['job_experience'], true) ?? [];
|
|
|
+ if(!empty($job_experience)){
|
|
|
+ // $hy = [];
|
|
|
+ foreach($job_experience as $key => $value){
|
|
|
+ // $id = $value['id'];
|
|
|
+ $hy[$key] = $value['job_industry'];
|
|
|
+ $zw_id[$key] = $value['job_typename'];
|
|
|
+ $jtzw_id[$key] = $value['job_name'];
|
|
|
+ }
|
|
|
+ $hy_table = JobIndustry::whereIn('hyid', $hy)->select('hyid','hyname')->get();
|
|
|
+ $zw_table = JobPosition::select('zwid','zwname')->get();
|
|
|
+ // 先将关联表转换为索引数组,提高查找效率
|
|
|
+ $hyLookup = [];
|
|
|
+ foreach ($hy_table as $item) {
|
|
|
+ $hyLookup[$item['hyid']] = $item['hyname'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $zwLookup = [];
|
|
|
+ foreach ($zw_table as $item) {
|
|
|
+ $zwLookup[$item['zwid']] = $item['zwname'];
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach ($job_experience as $key => &$value) {
|
|
|
+ // 处理行业名称
|
|
|
+ if (isset($hy[$key]) && isset($hyLookup[$hy[$key]])) {
|
|
|
+ $value['hy_name'] = $hyLookup[$hy[$key]];
|
|
|
+ }
|
|
|
+
|
|
|
+ // 处理职位名称
|
|
|
+ if (isset($zw_id[$key]) && isset($zwLookup[$zw_id[$key]])) {
|
|
|
+ $value['zw_name'] = $zwLookup[$zw_id[$key]];
|
|
|
+ }
|
|
|
+
|
|
|
+ // 处理具体职位名称
|
|
|
+ if (isset($jtzw_id[$key]) && isset($zwLookup[$jtzw_id[$key]])) {
|
|
|
+ $value['jtzw_name'] = $zwLookup[$jtzw_id[$key]];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 释放引用,防止意外修改后续代码
|
|
|
+ unset($value);
|
|
|
+ }
|
|
|
+ $result['job_experience'] = $job_experience?? [];
|
|
|
+
|
|
|
+ }
|
|
|
+ if(!empty($job[0]['education_experience'])){
|
|
|
+ $education_experience = json_decode($job[0]['education_experience'],true)?? '';
|
|
|
+ if(!empty($education_experience)){
|
|
|
+ foreach($education_experience as $key => $value){
|
|
|
+ // $id = $value['id'];
|
|
|
+ $education[$key] = $value['school_education'];
|
|
|
+ }
|
|
|
+ $education_table = JobEnum::where('egroup', 'education')->whereIn('evalue',$education)->select('evalue','ename')->get();
|
|
|
+ // // 先将关联表转换为索引数组,提高查找效率
|
|
|
+ $educationLookup = [];
|
|
|
+ foreach ($education_table as $item) {
|
|
|
+ $educationLookup[$item['evalue']] = $item['ename'];
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach ($education_experience as $key => &$value) {
|
|
|
+ // 处理学历名称
|
|
|
+ if (isset($education[$key]) && isset($educationLookup[$education[$key]])) {
|
|
|
+ $value['education_name'] = $educationLookup[$education[$key]];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $result['education_experience'] = $job_experience?? [];
|
|
|
+ }
|
|
|
$result['job'] = $this->processJob($job, $webid);
|
|
|
- // 返现对应的栏目
|
|
|
+ // // 返现对应的栏目
|
|
|
$catid = json_decode($job[0]['cat_arr_id'],true) ?? '';
|
|
|
$category = WebsiteCategory::where('website_id', $data['website_id'])
|
|
|
->whereIn('category_id', $catid)
|
|
@@ -2301,6 +2410,9 @@ class NewsService implements NewsServiceInterface
|
|
|
if(!empty($category)){
|
|
|
$result['category'] = $category;
|
|
|
}
|
|
|
+ $result['job'] = $job;
|
|
|
+ $result['job_experience'] = $job_experience?? [];
|
|
|
+ $result['education_experience'] = $education_experience?? [];
|
|
|
if(empty($result)){
|
|
|
return Result::error("参数错误", 0);
|
|
|
}
|