|
@@ -1180,6 +1180,11 @@ class NewsService implements NewsServiceInterface
|
|
|
if (empty($result)) {
|
|
if (empty($result)) {
|
|
|
return Result::error("暂无此新闻!", 0);
|
|
return Result::error("暂无此新闻!", 0);
|
|
|
}
|
|
}
|
|
|
|
|
+ if(!empty($result['publiced_at']))
|
|
|
|
|
+ {
|
|
|
|
|
+ $result['updated_at'] = $result['publiced_at'];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$category = WebsiteCategory::leftJoin('website', 'website.id', '=', 'website_category.website_id')
|
|
$category = WebsiteCategory::leftJoin('website', 'website.id', '=', 'website_category.website_id')
|
|
|
->select('website_category.*', 'website.website_name', 'website.suffix')
|
|
->select('website_category.*', 'website.website_name', 'website.suffix')
|
|
|
->where('website_category.website_id', $data['website_id'])
|
|
->where('website_category.website_id', $data['website_id'])
|
|
@@ -2236,9 +2241,9 @@ class NewsService implements NewsServiceInterface
|
|
|
'status' => 2,
|
|
'status' => 2,
|
|
|
'website_id' => $data['website_id'],
|
|
'website_id' => $data['website_id'],
|
|
|
];
|
|
];
|
|
|
- if ((empty($data['catid']) || !isset($data['catid'])) && (empty($data['keyword']) || !isset($data['keyword'])) && (empty($data['city_id']) || !isset($data['city_id']))) {
|
|
|
|
|
- return Result::error("查询失败", 0);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // if ((empty($data['catid']) || !isset($data['catid'])) && (empty($data['keyword']) || !isset($data['keyword'])) && (empty($data['city_id']) || !isset($data['city_id']))) {
|
|
|
|
|
+ // return Result::error("查询失败", 0);
|
|
|
|
|
+ // }
|
|
|
if ((empty($data['catid']) || !isset($data['catid'])) && (!empty($data['city_id']) || isset($data['city_id']))) {
|
|
if ((empty($data['catid']) || !isset($data['catid'])) && (!empty($data['city_id']) || isset($data['city_id']))) {
|
|
|
$category = WebsiteCategory::where('website_id', $data['website_id'])->where('pid', $data['id'])->orderBy('sort')->first(['category_id']);
|
|
$category = WebsiteCategory::where('website_id', $data['website_id'])->where('pid', $data['id'])->orderBy('sort')->first(['category_id']);
|
|
|
$data['catid'] = $category->category_id ?? 0;
|
|
$data['catid'] = $category->category_id ?? 0;
|
|
@@ -3086,34 +3091,41 @@ class NewsService implements NewsServiceInterface
|
|
|
$JobRecruiting = $this->processJob($JobRecruiting, $website_id);
|
|
$JobRecruiting = $this->processJob($JobRecruiting, $website_id);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if ((isset($data['type']) && $data['type'] == 2) || !isset($data['type'])) {
|
|
|
|
|
- if (isset($data['zw_id']) && !empty($data['zw_id'])) {
|
|
|
|
|
- array_push($hunt_where, ['job', $data['zw_id']]);
|
|
|
|
|
|
|
+ if((isset($data['type']) && $data['type'] == 2) || !isset($data['type'])){
|
|
|
|
|
+ if(isset($data['zw_id']) && !empty($data['zw_id'])){
|
|
|
|
|
+ array_push($hunt_where, ['job_hunting.job',$data['zw_id']]);
|
|
|
}
|
|
}
|
|
|
- if (isset($data['jtzw_id']) && !empty($data['jtzw_id'])) {
|
|
|
|
|
- array_push($hunt_where, ['job_name_get', $data['jtzw_id']]);
|
|
|
|
|
|
|
+ if(isset($data['jtzw_id']) &&!empty($data['jtzw_id'])){
|
|
|
|
|
+ array_push($hunt_where, ['job_hunting.job_name_get',$data['jtzw_id']]);
|
|
|
}
|
|
}
|
|
|
- if (isset($data['hy_id']) && !empty($data['hy_id'])) {
|
|
|
|
|
- array_push($hunt_where, ['industry', $data['hy_id']]);
|
|
|
|
|
|
|
+ if(isset($data['hy_id']) && !empty($data['hy_id'])){
|
|
|
|
|
+ array_push($hunt_where, ['job_hunting.industry',$data['hy_id']]);
|
|
|
}
|
|
}
|
|
|
- $query = JobHunting::where('status', 2)
|
|
|
|
|
- ->where('job_hunting.website_id', $data['website_id'])
|
|
|
|
|
- ->where($hunt_where)
|
|
|
|
|
- ->when(isset($data['keyword']) && !empty($data['keyword']), function ($query) use ($data) {
|
|
|
|
|
- $query->where('job_position.zwname', 'like', '%' . $data['keyword'] . '%');
|
|
|
|
|
- })
|
|
|
|
|
- ->when(isset($data['city_id']) && !empty($data['city_id']), function ($query) use ($data) {
|
|
|
|
|
- $query->where(function ($q) use ($data) {
|
|
|
|
|
- $q->WhereRaw("JSON_CONTAINS(job_hunting.city_arr_id, '" . intval($data['city_id']) . "') = 1");
|
|
|
|
|
|
|
+ if(isset($data['keyword']) && !empty($data['keyword'])){
|
|
|
|
|
+ array_push($hunt_where, ['job_position.zwname','like','%'.$data['keyword'].'%']);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ $query = JobHunting::where('job_hunting.status', 2)
|
|
|
|
|
+ ->where('job_hunting.website_id', $data['website_id'])
|
|
|
|
|
+ ->leftJoin('job_position', 'job_hunting.job_name_get', '=', 'job_position.zwid')
|
|
|
|
|
+ ->where($hunt_where)
|
|
|
|
|
+ // ->when(isset($data['keyword']) &&!empty($data['keyword']), function ($query) use ($data) {
|
|
|
|
|
+ // $query->where('job_position.zwname','like','%'.$data['keyword'].'%');
|
|
|
|
|
+ // })
|
|
|
|
|
+ ->when(isset($data['city_id']) &&!empty($data['city_id']), function ($query) use ($data) {
|
|
|
|
|
+ $query->where(function($q) use ($data) {
|
|
|
|
|
+ $q->WhereRaw("JSON_CONTAINS(job_hunting.city_arr_id, '". intval($data['city_id']). "') = 1");
|
|
|
});
|
|
});
|
|
|
- })
|
|
|
|
|
- ->when(isset($data['catid_id']) && !empty($data['catid_id']), function ($query) use ($data) {
|
|
|
|
|
- $query->where(function ($q) use ($data) {
|
|
|
|
|
- $q->WhereRaw("JSON_CONTAINS(job_hunting.cat_arr_id, '" . intval($data['catid_id']) . "') = 1");
|
|
|
|
|
|
|
+ })
|
|
|
|
|
+ ->when(isset($data['catid_id']) &&!empty($data['catid_id']), function ($query) use ($data) {
|
|
|
|
|
+ $query->where(function($q) use ($data) {
|
|
|
|
|
+ $q->WhereRaw("JSON_CONTAINS(job_hunting.cat_arr_id, '". intval($data['catid_id']). "') = 1");
|
|
|
});
|
|
});
|
|
|
- })
|
|
|
|
|
- ->select('id', 'sexy', 'experience', 'origin', 'industry', 'name', 'job', 'job_name_get', 'city_arr_id', 'cat_arr_id', 'created_at', 'updated_at')
|
|
|
|
|
- ->orderBy('updated_at', 'desc');
|
|
|
|
|
|
|
+ })
|
|
|
|
|
+ ->select('job_hunting.id','job_hunting.sexy','job_hunting.experience','job_hunting.origin','job_hunting.industry',
|
|
|
|
|
+ 'job_hunting.name','job_hunting.job','job_hunting.job_name_get','job_hunting.city_arr_id','job_hunting.cat_arr_id',
|
|
|
|
|
+ 'job_hunting.created_at','job_hunting.updated_at','job_position.zwname as job_name')
|
|
|
|
|
+ ->orderBy('job_hunting.updated_at', 'desc');
|
|
|
$hunt_count = $query->count();
|
|
$hunt_count = $query->count();
|
|
|
$query = clone $query;
|
|
$query = clone $query;
|
|
|
$JobHunting = $query
|
|
$JobHunting = $query
|
|
@@ -3452,17 +3464,29 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
}
|
|
|
if (isset($data['other_route']) && !empty($data['other_route'])) {
|
|
if (isset($data['other_route']) && !empty($data['other_route'])) {
|
|
|
$whiteRouterInfo = WhiteRouter::whereJsonContains("website_id", $data['website_id'])->where('router_url', $data['other_route'])->first();
|
|
$whiteRouterInfo = WhiteRouter::whereJsonContains("website_id", $data['website_id'])->where('router_url', $data['other_route'])->first();
|
|
|
|
|
+ // 验证路由是否存在
|
|
|
|
|
+ if (empty($whiteRouterInfo)) {
|
|
|
|
|
+ $whiteRouterInfo = WhiteRouter::where("router_type", 1)->where('router_url', $data['other_route'])->first();
|
|
|
|
|
+ }
|
|
|
if (!empty($whiteRouterInfo)) {
|
|
if (!empty($whiteRouterInfo)) {
|
|
|
- return Result::success($whiteRouterInfo->toArray());
|
|
|
|
|
|
|
+ return Result::success($whiteRouterInfo->toArray());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// 验证栏目路由
|
|
// 验证栏目路由
|
|
|
$last_category = WebsiteCategory::where('website_id', $data['website_id'])
|
|
$last_category = WebsiteCategory::where('website_id', $data['website_id'])
|
|
|
->where('aLIas_pinyin', $data['last_route'])
|
|
->where('aLIas_pinyin', $data['last_route'])
|
|
|
- ->first();
|
|
|
|
|
- if (empty($last_category)) {
|
|
|
|
|
|
|
+ ->get()->all();
|
|
|
|
|
+ if (count($last_category) == 0) {
|
|
|
return Result::error("该栏目不存在", 0);
|
|
return Result::error("该栏目不存在", 0);
|
|
|
}
|
|
}
|
|
|
|
|
+ if(count($last_category) > 1){
|
|
|
|
|
+ return Result::error("该子级栏目存在多个,路由验证失败!", 0);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(count($last_category) == 1){
|
|
|
|
|
+ $last_category = $last_category[0];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // return Result::success($last_category);
|
|
|
if (isset($data['id']) && !empty($data['id'])) {
|
|
if (isset($data['id']) && !empty($data['id'])) {
|
|
|
// `type` int unsigned DEFAULT '1' COMMENT '类型:1资讯(默认)2商品3书刊音像4招聘5求职类型:1资讯(默认)2商品3书刊音像4招聘5求职6招工招聘'
|
|
// `type` int unsigned DEFAULT '1' COMMENT '类型:1资讯(默认)2商品3书刊音像4招聘5求职类型:1资讯(默认)2商品3书刊音像4招聘5求职6招工招聘'
|
|
|
switch ($last_category['type']) {
|
|
switch ($last_category['type']) {
|
|
@@ -3551,27 +3575,32 @@ class NewsService implements NewsServiceInterface
|
|
|
return Result::error("该数据不存在", 0);
|
|
return Result::error("该数据不存在", 0);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- $catid = json_decode($article['cat_arr_id'], true);
|
|
|
|
|
|
|
+ $catid =0 ;
|
|
|
|
|
+ $catidArray = json_decode($article['cat_arr_id'], true);
|
|
|
|
|
+ $catid = !empty($catidArray) ? end($catidArray) : null;
|
|
|
|
|
+ // return Result::success($article['cat_arr_id']);
|
|
|
if (empty($catid)) {
|
|
if (empty($catid)) {
|
|
|
return Result::error("该数据不存在", 0);
|
|
return Result::error("该数据不存在", 0);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
$pinyin = WebsiteCategory::where('website_id', $data['website_id'])
|
|
$pinyin = WebsiteCategory::where('website_id', $data['website_id'])
|
|
|
- ->orderByRaw('FIELD(category_id, ' . implode(',', $catid) . ')')
|
|
|
|
|
- ->whereIn('category_id', $catid)
|
|
|
|
|
- ->pluck('aLIas_pinyin')
|
|
|
|
|
- ->implode('/');
|
|
|
|
|
- }
|
|
|
|
|
- if ($last_category['pid'] != 0) {
|
|
|
|
|
- $cat_arr = json_decode($last_category['category_arr_id'], true);
|
|
|
|
|
- $pinyin = WebsiteCategory::where('website_id', $data['website_id'])
|
|
|
|
|
- ->orderByRaw('FIELD(category_id, ' . implode(',', $cat_arr) . ')')
|
|
|
|
|
- ->whereIn('category_id', $cat_arr)
|
|
|
|
|
- ->pluck('aLIas_pinyin')
|
|
|
|
|
- ->implode('/');
|
|
|
|
|
- } else {
|
|
|
|
|
- $pinyin = $last_category['aLIas_pinyin'];
|
|
|
|
|
|
|
+ ->where('category_id',$catid)
|
|
|
|
|
+ ->select('path')
|
|
|
|
|
+ ->pluck('path');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if ($last_category['pid'] != 0) {
|
|
|
|
|
+ $cat_arr = json_decode($last_category['category_arr_id'], true);
|
|
|
|
|
+ $catid = !empty($cat_arr) ? end($cat_arr) : null;
|
|
|
|
|
+ $pinyin = WebsiteCategory::where('website_id', $data['website_id'])
|
|
|
|
|
+ ->where('category_id',$catid)
|
|
|
|
|
+ ->where('path',$data['all_route'])
|
|
|
|
|
+ ->pluck('path');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $pinyin[0] = $last_category['aLIas_pinyin'];
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- if (empty($pinyin) || $pinyin != $data['all_route']) {
|
|
|
|
|
|
|
+ // return Result::success($pinyin[0]);
|
|
|
|
|
+ if (empty($pinyin) || count($pinyin)>1 || $pinyin[0] != $data['all_route']) {
|
|
|
return Result::error('非法路径!');
|
|
return Result::error('非法路径!');
|
|
|
} else {
|
|
} else {
|
|
|
return Result::success($pinyin);
|
|
return Result::success($pinyin);
|
|
@@ -6262,57 +6291,58 @@ class NewsService implements NewsServiceInterface
|
|
|
* @return array
|
|
* @return array
|
|
|
*/
|
|
*/
|
|
|
public function getCompanyList(array $data): array
|
|
public function getCompanyList(array $data): array
|
|
|
- {
|
|
|
|
|
- // return Result::success($data);
|
|
|
|
|
- $where = [];
|
|
|
|
|
- $user = User::where('id', $data['user_id'])->first();
|
|
|
|
|
- if (empty($user)) {
|
|
|
|
|
- return Result::error('用户不存在!');
|
|
|
|
|
- }
|
|
|
|
|
- if ($user['type_id'] != 10000) {
|
|
|
|
|
- $where['user_id'] = $data['user_id'];
|
|
|
|
|
- }
|
|
|
|
|
- if (isset($data['title']) && !empty($data['title'])) {
|
|
|
|
|
- array_push($where, ['company.title', 'like', '%' . $data['title'] . '%']);
|
|
|
|
|
- }
|
|
|
|
|
- if (isset($data['website_id']) && !empty($data['website_id'])) {
|
|
|
|
|
- array_push($where, ['website.id', $data['website_id']]);
|
|
|
|
|
- }
|
|
|
|
|
- if (isset($data['ischeck']) && !empty($data['ischeck'])) {
|
|
|
|
|
- if ($data['ischeck'] == 1) {
|
|
|
|
|
- if (isset($data['status']) && $data['status'] != '') {
|
|
|
|
|
- array_push($where, ['company.status', $data['status']]);
|
|
|
|
|
- $query = Company::where($where);
|
|
|
|
|
- } else {
|
|
|
|
|
- $query = Company::whereIn('company.status', [0, 2]);
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ // return Result::success($data);
|
|
|
|
|
+ $where = [];
|
|
|
|
|
+ $user = User::where('id', $data['user_id'])->first();
|
|
|
|
|
+ if(empty($user)){
|
|
|
|
|
+ return Result::error('用户不存在!');
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- $query = Company::where('company.status', 1);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- $result = $query->where($where)
|
|
|
|
|
- ->leftJoin('website_category', function ($query) {
|
|
|
|
|
- $query->on('website_category.category_id', '=', 'company.category_id')
|
|
|
|
|
- ->on('website_category.website_id', '=', 'company.website_id');
|
|
|
|
|
- })
|
|
|
|
|
- ->leftJoin('website', 'company.website_id', '=', 'website.id')
|
|
|
|
|
- ->select(
|
|
|
|
|
- 'company.id',
|
|
|
|
|
- 'company.title',
|
|
|
|
|
- 'company.website_id',
|
|
|
|
|
- 'company.category_id',
|
|
|
|
|
- 'website.website_name',
|
|
|
|
|
- 'website_category.alias as category_name',
|
|
|
|
|
- 'company.status',
|
|
|
|
|
- 'company.updated_at',
|
|
|
|
|
- )
|
|
|
|
|
- ->orderBy('company.updated_at', 'desc')
|
|
|
|
|
- ->paginate($data['pageSize'], ['*'], 'page', $data['page']);
|
|
|
|
|
|
|
+ if($user['type_id']!= 10000){
|
|
|
|
|
+ $where['user_id'] = $data['user_id'];
|
|
|
|
|
+ }
|
|
|
|
|
+ if(isset($data['title']) && !empty($data['title'])){
|
|
|
|
|
+ array_push($where, ['company.title', 'like', '%'. $data['title']. '%']);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(isset($data['website_id']) && !empty($data['website_id'])){
|
|
|
|
|
+ array_push($where, ['website.id', $data['website_id']]);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(isset($data['ischeck']) && !empty($data['ischeck'])){
|
|
|
|
|
+ if($data['ischeck'] == 1){
|
|
|
|
|
+ if(isset($data['status']) && $data['status'] != ''){
|
|
|
|
|
+ array_push($where, ['company.status', $data['status']]);
|
|
|
|
|
+ $query = Company::where($where);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $query = Company::whereIn('company.status', [0,2]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $query = Company::where('company.status', 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $result = $query->where($where)
|
|
|
|
|
+ ->leftJoin('website_category', function ($query) {
|
|
|
|
|
+ $query->on('website_category.category_id', '=', 'company.category_id')
|
|
|
|
|
+ ->on('website_category.website_id', '=', 'company.website_id');
|
|
|
|
|
+ })
|
|
|
|
|
+ ->leftJoin('website', 'company.website_id', '=', 'website.id')
|
|
|
|
|
+ ->select(
|
|
|
|
|
+ 'company.id',
|
|
|
|
|
+ 'company.title',
|
|
|
|
|
+ 'company.website_id',
|
|
|
|
|
+ 'company.category_id',
|
|
|
|
|
+ 'website.website_name',
|
|
|
|
|
+ 'website_category.alias as category_name',
|
|
|
|
|
+ 'company.status',
|
|
|
|
|
+ 'company.updated_at',
|
|
|
|
|
+ 'company.user_id'
|
|
|
|
|
+ )
|
|
|
|
|
+ ->orderBy('company.updated_at', 'desc')
|
|
|
|
|
+ ->paginate($data['pageSize'], ['*'], 'page', $data['page']);
|
|
|
|
|
|
|
|
- if ($result->isEmpty()) {
|
|
|
|
|
- return Result::error("暂无企业", 0);
|
|
|
|
|
- }
|
|
|
|
|
- return Result::success($result);
|
|
|
|
|
|
|
+ if($result->isEmpty()){
|
|
|
|
|
+ return Result::error("暂无企业", 0);
|
|
|
|
|
+ }
|
|
|
|
|
+ return Result::success($result);
|
|
|
}
|
|
}
|
|
|
/**
|
|
/**
|
|
|
* 添加企业
|
|
* 添加企业
|
|
@@ -6540,6 +6570,11 @@ class NewsService implements NewsServiceInterface
|
|
|
public function getCompanyInfo(array $data): array
|
|
public function getCompanyInfo(array $data): array
|
|
|
{
|
|
{
|
|
|
$result = Company::where('id', $data['id'])->first();
|
|
$result = Company::where('id', $data['id'])->first();
|
|
|
|
|
+ $city_arr = json_decode($result['city_arr_id']);
|
|
|
|
|
+ $result['city_name'] = District::whereIn('id', $city_arr)
|
|
|
|
|
+ ->pluck('name')
|
|
|
|
|
+ ->implode('-');
|
|
|
|
|
+
|
|
|
if (empty($result)) {
|
|
if (empty($result)) {
|
|
|
return Result::error('企业不存在!');
|
|
return Result::error('企业不存在!');
|
|
|
} else {
|
|
} else {
|
|
@@ -6742,7 +6777,9 @@ class NewsService implements NewsServiceInterface
|
|
|
'project.updated_at',
|
|
'project.updated_at',
|
|
|
'project.status',
|
|
'project.status',
|
|
|
'website.website_name',
|
|
'website.website_name',
|
|
|
- 'website_category.alias as category_name'
|
|
|
|
|
|
|
+ 'website_category.alias as category_name',
|
|
|
|
|
+ 'project.website_id',
|
|
|
|
|
+ 'project.user_id'
|
|
|
)
|
|
)
|
|
|
->orderBy('project.updated_at', 'desc')
|
|
->orderBy('project.updated_at', 'desc')
|
|
|
->offset(($data['page'] - 1) * $data['pageSize'])
|
|
->offset(($data['page'] - 1) * $data['pageSize'])
|