|
@@ -219,14 +219,16 @@ class NewsService implements NewsServiceInterface
|
|
|
public function categoryList(array $data): array
|
|
|
{
|
|
|
$where[] = [
|
|
|
- 'pid','=',$data['pid']
|
|
|
+ 'pid',
|
|
|
+ '=',
|
|
|
+ $data['pid']
|
|
|
];
|
|
|
- if(isset($data['name'])){
|
|
|
- array_push($where, ['category.name','like','%'.$data['name'].'%']);
|
|
|
+ if (isset($data['name'])) {
|
|
|
+ array_push($where, ['category.name', 'like', '%' . $data['name'] . '%']);
|
|
|
}
|
|
|
var_dump($where);
|
|
|
- $result = Category::where($where)->select('category.*','category.id as category_id')->get();
|
|
|
- if(empty($result)){
|
|
|
+ $result = Category::where($where)->select('category.*', 'category.id as category_id')->get();
|
|
|
+ if (empty($result)) {
|
|
|
return Result::error("没有栏目数据");
|
|
|
}
|
|
|
return Result::success($result);
|
|
@@ -748,7 +750,7 @@ class NewsService implements NewsServiceInterface
|
|
|
// return Result::success($data['website_id']);
|
|
|
$category = WebsiteCategory::where('website_id', $data['website_id'])->pluck('category_id');
|
|
|
$category = array_values(array_unique($category->toArray()));
|
|
|
-
|
|
|
+
|
|
|
if ($category) {
|
|
|
$placeid = isset($data['placeid']) && !empty($data['placeid']) ? $data['placeid'] - 1 : 0;
|
|
|
$where = [
|
|
@@ -968,7 +970,7 @@ class NewsService implements NewsServiceInterface
|
|
|
* @param array $data
|
|
|
* @return array
|
|
|
*/
|
|
|
- public function getWebsiteArticleList(array $data): array
|
|
|
+ public function getWebsiteArticleList(array $data): array
|
|
|
{
|
|
|
// return Result::success($data);
|
|
|
$where[] = ['status', '=', 1];
|
|
@@ -1403,7 +1405,8 @@ class NewsService implements NewsServiceInterface
|
|
|
'article.copyfrom',
|
|
|
'article.catid',
|
|
|
'article.department_arr_id',
|
|
|
- 'article.city_arr_id',)
|
|
|
+ 'article.city_arr_id',
|
|
|
+ )
|
|
|
->orderBy("updated_at", "desc")
|
|
|
->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
->limit($data['pageSize'])
|
|
@@ -1506,7 +1509,7 @@ class NewsService implements NewsServiceInterface
|
|
|
$category['text'] = WebsiteCategory::where($where)
|
|
|
->leftJoin('article', 'article.catid', 'website_category.category_id')
|
|
|
->where('article.status', 1)
|
|
|
- ->select('article.*','website_category.category_id','website_category.alias')
|
|
|
+ ->select('article.*', 'website_category.category_id', 'website_category.alias')
|
|
|
->orderBy('article.updated_at', 'desc')
|
|
|
->limit($data['text_num'])
|
|
|
->get();
|
|
@@ -1910,55 +1913,64 @@ class NewsService implements NewsServiceInterface
|
|
|
$data = json_decode($input['id'] ?? '', true) ?? [];
|
|
|
$result['goods'] = array_map(function ($item) use ($input) {
|
|
|
// 检查parent元素是否存在且不是undefined
|
|
|
- if (isset($item['level']) && $item['level'] != 'undefined' && $item['level']!= "") {
|
|
|
- list($Levelid, $goodStart,$goodNum) = explode(',', $item['level']);
|
|
|
- $website = $input['website_id'];
|
|
|
- $query = Good::where('good.status', 2)
|
|
|
- ->where('good.website_id', $website);
|
|
|
- switch ($Levelid) {
|
|
|
- case 1:
|
|
|
- case 2:
|
|
|
- case 3:
|
|
|
- $goods = $query->where(function($q) use ($Levelid) {
|
|
|
- $q->whereRaw("JSON_CONTAINS(good.level, '". intval($Levelid). "') = 1")
|
|
|
- ->orWhereRaw("JSON_CONTAINS(good.level, '\"". intval($Levelid). "\"') = 1");
|
|
|
- });
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- $goods = $query;
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- $goods = $query->where('type_id',1);
|
|
|
- break;
|
|
|
- case 6:
|
|
|
- $goods = $query->where('type_id',2);
|
|
|
- break;
|
|
|
- default:
|
|
|
- return [];
|
|
|
- }
|
|
|
- $all_goods = $goods
|
|
|
- ->select('good.id', 'good.name', 'good.imgurl', 'good.description',
|
|
|
- 'good.updated_at', 'good.catid','good.type_id','good.price','good.level',
|
|
|
- 'good.website_id')
|
|
|
- ->orderBy('updated_at','desc')
|
|
|
- ->offset($goodStart)
|
|
|
- ->limit($goodNum)
|
|
|
- ->get();
|
|
|
- $web['website_id'] = $website;
|
|
|
- $all_goods = $this->processGoods($all_goods, $web);
|
|
|
+ if (isset($item['level']) && $item['level'] != 'undefined' && $item['level'] != "") {
|
|
|
+ list($Levelid, $goodStart, $goodNum) = explode(',', $item['level']);
|
|
|
+ $website = $input['website_id'];
|
|
|
+ $query = Good::where('good.status', 2)
|
|
|
+ ->where('good.website_id', $website);
|
|
|
+ switch ($Levelid) {
|
|
|
+ case 1:
|
|
|
+ case 2:
|
|
|
+ case 3:
|
|
|
+ $goods = $query->where(function ($q) use ($Levelid) {
|
|
|
+ $q->whereRaw("JSON_CONTAINS(good.level, '" . intval($Levelid) . "') = 1")
|
|
|
+ ->orWhereRaw("JSON_CONTAINS(good.level, '\"" . intval($Levelid) . "\"') = 1");
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ $goods = $query;
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ $goods = $query->where('type_id', 1);
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ $goods = $query->where('type_id', 2);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ $all_goods = $goods
|
|
|
+ ->select(
|
|
|
+ 'good.id',
|
|
|
+ 'good.name',
|
|
|
+ 'good.imgurl',
|
|
|
+ 'good.description',
|
|
|
+ 'good.updated_at',
|
|
|
+ 'good.catid',
|
|
|
+ 'good.type_id',
|
|
|
+ 'good.price',
|
|
|
+ 'good.level',
|
|
|
+ 'good.website_id'
|
|
|
+ )
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->offset($goodStart)
|
|
|
+ ->limit($goodNum)
|
|
|
+ ->get();
|
|
|
+ $web['website_id'] = $website;
|
|
|
+ $all_goods = $this->processGoods($all_goods, $web);
|
|
|
}
|
|
|
- return $all_goods;
|
|
|
- }, $data);
|
|
|
- $website = $input['website_id'];
|
|
|
- $result['article'] = Article::where(function ($query) use ($website) {
|
|
|
- $query->where(function ($subQuery) use ($website) {
|
|
|
- $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($website) . "') = 0");
|
|
|
- })->orWhereNull("ignore_ids");
|
|
|
- })
|
|
|
- ->where('catid', $catid)
|
|
|
- ->where('article.status', 1)
|
|
|
- ->leftJoin('article_data', 'article_data.article_id', 'article.id')
|
|
|
- ->select('article.id', 'article.title', 'article.updated_at', 'introduce', 'islink', 'linkurl','article_data.content')
|
|
|
+ return $all_goods;
|
|
|
+ }, $data);
|
|
|
+ $website = $input['website_id'];
|
|
|
+ $result['article'] = Article::where(function ($query) use ($website) {
|
|
|
+ $query->where(function ($subQuery) use ($website) {
|
|
|
+ $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($website) . "') = 0");
|
|
|
+ })->orWhereNull("ignore_ids");
|
|
|
+ })
|
|
|
+ ->where('catid', $catid)
|
|
|
+ ->where('article.status', 1)
|
|
|
+ ->leftJoin('article_data', 'article_data.article_id', 'article.id')
|
|
|
+ ->select('article.id', 'article.title', 'article.updated_at', 'introduce', 'islink', 'linkurl', 'article_data.content')
|
|
|
->orderBy('article.updated_at', 'desc')
|
|
|
->first();
|
|
|
return Result::success($result);
|
|
@@ -2074,31 +2086,43 @@ class NewsService implements NewsServiceInterface
|
|
|
->orWhereRaw("JSON_CONTAINS(good.city_arr_id, '\"" . intval($data['city_id']) . "\"') = 1");
|
|
|
});
|
|
|
})
|
|
|
- ->select('good.id', 'good.name', 'good.imgurl', 'good.description', 'good.updated_at', 'good.com',
|
|
|
- 'good.catid','good.type_id','good.website_id','good.cat_arr_id','good.created_at','good.city_id')
|
|
|
+ ->select(
|
|
|
+ 'good.id',
|
|
|
+ 'good.name',
|
|
|
+ 'good.imgurl',
|
|
|
+ 'good.description',
|
|
|
+ 'good.updated_at',
|
|
|
+ 'good.com',
|
|
|
+ 'good.catid',
|
|
|
+ 'good.type_id',
|
|
|
+ 'good.website_id',
|
|
|
+ 'good.cat_arr_id',
|
|
|
+ 'good.created_at',
|
|
|
+ 'good.city_id'
|
|
|
+ )
|
|
|
->latest('updated_at');
|
|
|
- $result['type1_count'] = $query->clone()->where('type_id', 1)->count();
|
|
|
- // 获取 type_id 为 1 的数据
|
|
|
- $result['type1'] = $this->processGoods(
|
|
|
- $query->clone()
|
|
|
- ->where('type_id', 1)
|
|
|
- ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
- ->limit($data['pageSize'])
|
|
|
- ->get(),
|
|
|
- $data
|
|
|
- );
|
|
|
- $result['type2_count'] = $query->clone()->where('type_id', 2)->count();
|
|
|
- // 获取 type_id 为 2 的数据
|
|
|
- $result['type2'] = $this->processGoods(
|
|
|
- $query->clone()
|
|
|
- ->where('type_id', 2)
|
|
|
- ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
- ->limit($data['pageSize'])
|
|
|
- ->get(),
|
|
|
- $data
|
|
|
- );
|
|
|
- if(empty($result)){
|
|
|
- return Result::error("查询失败", 0);
|
|
|
+ $result['type1_count'] = $query->clone()->where('type_id', 1)->count();
|
|
|
+ // 获取 type_id 为 1 的数据
|
|
|
+ $result['type1'] = $this->processGoods(
|
|
|
+ $query->clone()
|
|
|
+ ->where('type_id', 1)
|
|
|
+ ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
+ ->limit($data['pageSize'])
|
|
|
+ ->get(),
|
|
|
+ $data
|
|
|
+ );
|
|
|
+ $result['type2_count'] = $query->clone()->where('type_id', 2)->count();
|
|
|
+ // 获取 type_id 为 2 的数据
|
|
|
+ $result['type2'] = $this->processGoods(
|
|
|
+ $query->clone()
|
|
|
+ ->where('type_id', 2)
|
|
|
+ ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
+ ->limit($data['pageSize'])
|
|
|
+ ->get(),
|
|
|
+ $data
|
|
|
+ );
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("查询失败", 0);
|
|
|
}
|
|
|
|
|
|
return Result::success($result);
|
|
@@ -2114,7 +2138,7 @@ class NewsService implements NewsServiceInterface
|
|
|
'good.status' => 2,
|
|
|
'good.website_id' => $data['website_id'],
|
|
|
'good.id' => $data['id'],
|
|
|
- ];
|
|
|
+ ];
|
|
|
$goods = Good::where($where)
|
|
|
->where('good.id', $data['id'])
|
|
|
->leftJoin('website_category', 'website_category.category_id', 'good.catid')
|
|
@@ -2156,7 +2180,8 @@ class NewsService implements NewsServiceInterface
|
|
|
});
|
|
|
}
|
|
|
// 封装处理由问题
|
|
|
- function processJob($job, $data) {
|
|
|
+ function processJob($job, $data)
|
|
|
+ {
|
|
|
return $job->map(function ($job) use ($data) {
|
|
|
$category = $job->cat_arr_id ?? '';
|
|
|
$cityid = $job->city_arr_id ?? '';
|
|
@@ -2189,35 +2214,35 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
}
|
|
|
// 获取简历最后一级地区
|
|
|
- if(isset($job->city_id) &&!empty($job->city_id)){
|
|
|
+ if (isset($job->city_id) && !empty($job->city_id)) {
|
|
|
$city = District::where('id', $job->city_id)->first(['name']);
|
|
|
- $job->hunt_cityname = $city->name?? '';
|
|
|
+ $job->hunt_cityname = $city->name ?? '';
|
|
|
}
|
|
|
// 组合详细地址
|
|
|
- if(isset($job->address_arr_id) && !empty($job->address_arr_id)){
|
|
|
+ if (isset($job->address_arr_id) && !empty($job->address_arr_id)) {
|
|
|
$address_id = json_decode($job->address_arr_id, true) ?? [];
|
|
|
- if(is_array($address_id) && !empty($address_id)){
|
|
|
+ if (is_array($address_id) && !empty($address_id)) {
|
|
|
$address = District::whereIn('id', $address_id)
|
|
|
- ->orderBy('level', 'asc')
|
|
|
- ->get(['name'])
|
|
|
- ->pluck('name')
|
|
|
- ->implode('');
|
|
|
+ ->orderBy('level', 'asc')
|
|
|
+ ->get(['name'])
|
|
|
+ ->pluck('name')
|
|
|
+ ->implode('');
|
|
|
// $job->address_name = $address ?? '';
|
|
|
$job->address_name = ($address ?? '') . ($job->address ?? '');
|
|
|
}
|
|
|
}
|
|
|
// 取行业
|
|
|
- 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)) {
|
|
|
$hy_name = JobIndustry::when($job, function ($query) use ($job) {
|
|
|
- if(!empty($job->industry)){
|
|
|
+ if (!empty($job->industry)) {
|
|
|
$query->where('hyid', $job->industry);
|
|
|
- }else if(!empty($job->hy_id)){
|
|
|
+ } else if (!empty($job->hy_id)) {
|
|
|
$query->where('hyid', $job->hy_id);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$query->where('hyid', $job->company_hy_id);
|
|
|
}
|
|
|
})->first(['hyname']);
|
|
|
- $job->hy_name = $hy_name->hyname?? '';
|
|
|
+ $job->hy_name = $hy_name->hyname ?? '';
|
|
|
}
|
|
|
// 取职位
|
|
|
if ((isset($job->zw_id) && !empty($job->zw_id)) || (isset($job->job) && !empty($job->job))) {
|
|
@@ -2407,11 +2432,12 @@ class NewsService implements NewsServiceInterface
|
|
|
'book.cat_id',
|
|
|
'book.description',
|
|
|
'book.updated_at',
|
|
|
- DB::raw("'$child_pinyin' as pinyin"))
|
|
|
+ DB::raw("'$child_pinyin' as pinyin")
|
|
|
+ )
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->limit($childImgNum)
|
|
|
->get()->all();
|
|
|
- // 查询子栏目文字新闻
|
|
|
+ // 查询子栏目文字新闻
|
|
|
$childTextArticles = Book::where('cat_id', $childCatId)
|
|
|
->where('status', 2)
|
|
|
->leftJoin('website_category', function ($join) use ($website) {
|
|
@@ -2428,7 +2454,8 @@ class NewsService implements NewsServiceInterface
|
|
|
'book.cat_id',
|
|
|
'book.description',
|
|
|
'book.updated_at',
|
|
|
- DB::raw("'$child_pinyin' as pinyin"))
|
|
|
+ DB::raw("'$child_pinyin' as pinyin")
|
|
|
+ )
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->limit($childTextNum)
|
|
|
->get()->all();
|
|
@@ -2469,8 +2496,16 @@ class NewsService implements NewsServiceInterface
|
|
|
$categorys = WebsiteCategory::where('website_id', $data['website_id'])
|
|
|
->where('pid', $category['pid'])
|
|
|
->select(
|
|
|
- 'category_id','alias','aLIas_pinyin','pid','sort','is_url','web_url',
|
|
|
- 'seo_title','seo_keywords','seo_description',
|
|
|
+ 'category_id',
|
|
|
+ 'alias',
|
|
|
+ 'aLIas_pinyin',
|
|
|
+ 'pid',
|
|
|
+ 'sort',
|
|
|
+ 'is_url',
|
|
|
+ 'web_url',
|
|
|
+ 'seo_title',
|
|
|
+ 'seo_keywords',
|
|
|
+ 'seo_description',
|
|
|
DB::raw("CONCAT('$parent_pinyin', '/', aLIas_pinyin) as pinyin")
|
|
|
)
|
|
|
->orderBy('sort')
|
|
@@ -2495,13 +2530,13 @@ class NewsService implements NewsServiceInterface
|
|
|
$query = clone $query;
|
|
|
$Book = $query
|
|
|
->limit($data['pageSize'])
|
|
|
- ->offset(($data['page']-1)*$data['pageSize'])
|
|
|
+ ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
->get()->all();
|
|
|
-
|
|
|
+
|
|
|
$result = [
|
|
|
'category' => $categorys,
|
|
|
'books' => $Book,
|
|
|
- 'count' =>$count,
|
|
|
+ 'count' => $count,
|
|
|
];
|
|
|
// if(empty($result)){
|
|
|
// return Result::error("查询失败", 0);
|
|
@@ -2515,8 +2550,8 @@ class NewsService implements NewsServiceInterface
|
|
|
* */
|
|
|
public function getWebsiteBookInfo(array $data): array
|
|
|
{
|
|
|
- $web = Website::where('id', $data['website_id'])->first(['id','website_name']);
|
|
|
- if(empty($web)){
|
|
|
+ $web = Website::where('id', $data['website_id'])->first(['id', 'website_name']);
|
|
|
+ if (empty($web)) {
|
|
|
return Result::error("查询失败", 0);
|
|
|
}
|
|
|
$book = Book::where('status', 2)
|
|
@@ -2545,7 +2580,15 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
}
|
|
|
$categorys = $query->where('pid', $pid)
|
|
|
- ->select('category_id','alias','aLIas_pinyin','pid','sort','is_url','web_url','category_arr_id as cat_arr_id',
|
|
|
+ ->select(
|
|
|
+ 'category_id',
|
|
|
+ 'alias',
|
|
|
+ 'aLIas_pinyin',
|
|
|
+ 'pid',
|
|
|
+ 'sort',
|
|
|
+ 'is_url',
|
|
|
+ 'web_url',
|
|
|
+ 'category_arr_id as cat_arr_id',
|
|
|
)
|
|
|
->orderBy('sort')
|
|
|
->get();
|
|
@@ -2556,7 +2599,7 @@ class NewsService implements NewsServiceInterface
|
|
|
];
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
- /**
|
|
|
+ /**
|
|
|
* 尝试
|
|
|
* @param array $data
|
|
|
* @return array
|
|
@@ -2565,7 +2608,7 @@ class NewsService implements NewsServiceInterface
|
|
|
{
|
|
|
$input['id'] = $data['id'];
|
|
|
$input['website_id'] = $data['website_id'];
|
|
|
- // 将 JSON 字符串转换为 PHP 数组
|
|
|
+ // 将 JSON 字符串转换为 PHP 数组
|
|
|
$data = json_decode($input['id'], true);
|
|
|
$result = [];
|
|
|
$article = $data;
|
|
@@ -2639,8 +2682,16 @@ class NewsService implements NewsServiceInterface
|
|
|
$q->WhereRaw("JSON_CONTAINS(job_hunting.city_arr_id, '" . intval($data['city_id']) . "') = 1");
|
|
|
});
|
|
|
})
|
|
|
- ->select('job_hunting.id','job_hunting.cat_arr_id','job_hunting.job','job_hunting.industry',
|
|
|
- 'job_hunting.city_arr_id','job_hunting.experience','job_hunting.updated_at','job_hunting.salary')
|
|
|
+ ->select(
|
|
|
+ 'job_hunting.id',
|
|
|
+ 'job_hunting.cat_arr_id',
|
|
|
+ 'job_hunting.job',
|
|
|
+ 'job_hunting.industry',
|
|
|
+ 'job_hunting.city_arr_id',
|
|
|
+ 'job_hunting.experience',
|
|
|
+ 'job_hunting.updated_at',
|
|
|
+ 'job_hunting.salary'
|
|
|
+ )
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->limit($data['job1_num'])
|
|
|
->get();
|
|
@@ -2659,10 +2710,21 @@ class NewsService implements NewsServiceInterface
|
|
|
});
|
|
|
})
|
|
|
->leftJoin('job_company', 'job_recruiting.id', '=', 'job_company.job_id')
|
|
|
- ->select('job_recruiting.id','job_recruiting.cat_arr_id','job_recruiting.title',
|
|
|
- 'job_recruiting.jtzw_id','job_recruiting.hy_id','job_recruiting.city_arr_id',
|
|
|
- 'job_recruiting.due_data','job_recruiting.updated_at','job_recruiting.experience',
|
|
|
- 'job_recruiting.educational','job_recruiting.salary','job_recruiting.zw_id','job_company.business_name')
|
|
|
+ ->select(
|
|
|
+ 'job_recruiting.id',
|
|
|
+ 'job_recruiting.cat_arr_id',
|
|
|
+ 'job_recruiting.title',
|
|
|
+ 'job_recruiting.jtzw_id',
|
|
|
+ 'job_recruiting.hy_id',
|
|
|
+ 'job_recruiting.city_arr_id',
|
|
|
+ 'job_recruiting.due_data',
|
|
|
+ 'job_recruiting.updated_at',
|
|
|
+ 'job_recruiting.experience',
|
|
|
+ 'job_recruiting.educational',
|
|
|
+ 'job_recruiting.salary',
|
|
|
+ 'job_recruiting.zw_id',
|
|
|
+ 'job_company.business_name'
|
|
|
+ )
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->limit($data['job2_num'])
|
|
|
->get();
|
|
@@ -2705,73 +2767,81 @@ class NewsService implements NewsServiceInterface
|
|
|
if (isset($data['jtzw_id']) && !empty($data['jtzw_id'])) {
|
|
|
array_push($where, ['jtzw_id', $data['jtzw_id']]);
|
|
|
}
|
|
|
- if((isset($data['type']) && $data['type'] == 1) || !isset($data['type'])){
|
|
|
+ if ((isset($data['type']) && $data['type'] == 1) || !isset($data['type'])) {
|
|
|
$query = JobRecruiting::where('job_recruiting.status', 1)
|
|
|
- ->where('job_recruiting.website_id', $data['website_id'])
|
|
|
- ->where($where)
|
|
|
- ->when(isset($data['city_id']) && !empty($data['city_id']), function ($query) use ($data) {
|
|
|
- $query->where(function ($q) use ($data) {
|
|
|
- $q->WhereRaw("JSON_CONTAINS(job_recruiting.city_arr_id, '" . intval($data['city_id']) . "') = 1");
|
|
|
- });
|
|
|
- })
|
|
|
- ->when(isset($data['catid']) &&!empty($data['catid']), function ($query) use ($data) {
|
|
|
- $query->where(function($q) use ($data) {
|
|
|
- $q->WhereRaw("JSON_CONTAINS(job_recruiting.cat_arr_id, '". intval($data['catid']). "') = 1");
|
|
|
- });
|
|
|
- })
|
|
|
- ->leftJoin('job_company', 'job_recruiting.id', '=', 'job_company.job_id')
|
|
|
- ->select('job_recruiting.id','job_recruiting.hy_id','job_recruiting.title','job_recruiting.zw_id',
|
|
|
- 'job_recruiting.jtzw_id','job_recruiting.city_arr_id','job_recruiting.due_data',
|
|
|
- 'job_recruiting.cat_arr_id','job_recruiting.updated_at')
|
|
|
- ->orderBy('updated_at', 'desc');
|
|
|
+ ->where('job_recruiting.website_id', $data['website_id'])
|
|
|
+ ->where($where)
|
|
|
+ ->when(isset($data['city_id']) && !empty($data['city_id']), function ($query) use ($data) {
|
|
|
+ $query->where(function ($q) use ($data) {
|
|
|
+ $q->WhereRaw("JSON_CONTAINS(job_recruiting.city_arr_id, '" . intval($data['city_id']) . "') = 1");
|
|
|
+ });
|
|
|
+ })
|
|
|
+ ->when(isset($data['catid']) && !empty($data['catid']), function ($query) use ($data) {
|
|
|
+ $query->where(function ($q) use ($data) {
|
|
|
+ $q->WhereRaw("JSON_CONTAINS(job_recruiting.cat_arr_id, '" . intval($data['catid']) . "') = 1");
|
|
|
+ });
|
|
|
+ })
|
|
|
+ ->leftJoin('job_company', 'job_recruiting.id', '=', 'job_company.job_id')
|
|
|
+ ->select(
|
|
|
+ 'job_recruiting.id',
|
|
|
+ 'job_recruiting.hy_id',
|
|
|
+ 'job_recruiting.title',
|
|
|
+ 'job_recruiting.zw_id',
|
|
|
+ 'job_recruiting.jtzw_id',
|
|
|
+ 'job_recruiting.city_arr_id',
|
|
|
+ 'job_recruiting.due_data',
|
|
|
+ 'job_recruiting.cat_arr_id',
|
|
|
+ 'job_recruiting.updated_at'
|
|
|
+ )
|
|
|
+ ->orderBy('updated_at', 'desc');
|
|
|
$recruit_count = $query->count();
|
|
|
$query = clone $query;
|
|
|
$JobRecruiting = $query
|
|
|
- ->offset(($data['page']-1)*$data['pageSize'])
|
|
|
+ ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
->limit($data['pageSize'])
|
|
|
->get();
|
|
|
- if(empty($JobRecruiting)){
|
|
|
+ if (empty($JobRecruiting)) {
|
|
|
$JobRecruiting = "暂无相关职位信息";
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$JobRecruiting = $this->processJob($JobRecruiting, $website_id);
|
|
|
}
|
|
|
}
|
|
|
- if((isset($data['type']) && $data['type'] == 2) || !isset($data['type'])){
|
|
|
+ if ((isset($data['type']) && $data['type'] == 2) || !isset($data['type'])) {
|
|
|
$query = JobHunting::where('status', 2)
|
|
|
- ->where('job_hunting.website_id', $data['website_id'])
|
|
|
- ->where($where)
|
|
|
- ->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");
|
|
|
- });
|
|
|
- })
|
|
|
- ->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');
|
|
|
+ ->where('job_hunting.website_id', $data['website_id'])
|
|
|
+ ->where($where)
|
|
|
+ ->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");
|
|
|
+ });
|
|
|
+ })
|
|
|
+ ->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');
|
|
|
$hunt_count = $query->count();
|
|
|
$query = clone $query;
|
|
|
$JobHunting = $query
|
|
|
- ->offset(($data['page']-1)*$data['pageSize'])
|
|
|
+ ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
->limit($data['pageSize'])
|
|
|
->get();
|
|
|
- if(empty($JobHunting)){
|
|
|
+ if (empty($JobHunting)) {
|
|
|
$JobRecruiting = "暂无相关简历信息";
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$JobHunting = $this->processJob($JobHunting, $website_id);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
$result = [
|
|
|
'JobRecruiting' => $JobRecruiting ?? [],
|
|
|
- 'recruit_count' =>$recruit_count ?? 0,
|
|
|
+ 'recruit_count' => $recruit_count ?? 0,
|
|
|
'JobHunting' => $JobHunting ?? [],
|
|
|
- 'hunt_count' =>$hunt_count ?? 0,
|
|
|
+ 'hunt_count' => $hunt_count ?? 0,
|
|
|
];
|
|
|
return Result::success($result);
|
|
|
}
|
|
@@ -2973,24 +3043,24 @@ class NewsService implements NewsServiceInterface
|
|
|
public function getWebsiteJobRecruiting(array $data): array
|
|
|
{
|
|
|
$web = Website::where('id', $data['website_id'])->first('id');
|
|
|
- if(empty($web)){
|
|
|
+ if (empty($web)) {
|
|
|
return Result::error("该网站不存在", 0);
|
|
|
}
|
|
|
- $user = User::where('id', $data['user_id'])->first(['id','type_id']);
|
|
|
- if(empty($user) || ($user['type_id']!= 3 && $user['type_id']!= 10000)){
|
|
|
+ $user = User::where('id', $data['user_id'])->first(['id', 'type_id']);
|
|
|
+ if (empty($user) || ($user['type_id'] != 3 && $user['type_id'] != 10000)) {
|
|
|
return Result::error("用户暂无权限!", 0);
|
|
|
}
|
|
|
// '状态 0:待审核;1:已审核通过;(只有企业会员需要审核);2:已拒绝;
|
|
|
$result = JobRecruiting::where('website_id', $data['website_id'])
|
|
|
- ->when(isset($user['type_id']) && $user['type_id']== 3, function ($query) use ($user) {
|
|
|
+ ->when(isset($user['type_id']) && $user['type_id'] == 3, function ($query) use ($user) {
|
|
|
$query->where('user_id', $user['id']);
|
|
|
})
|
|
|
->where('status', 1)
|
|
|
- ->select('id','title','website_id','user_id','updated_at')
|
|
|
+ ->select('id', 'title', 'website_id', 'user_id', 'updated_at')
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->limit($data['pageSize'])
|
|
|
->get();
|
|
|
- if(empty($result)){
|
|
|
+ if (empty($result)) {
|
|
|
return Result::error("暂无相关职位信息", 0);
|
|
|
}
|
|
|
return Result::success($result);
|
|
@@ -4848,9 +4918,9 @@ class NewsService implements NewsServiceInterface
|
|
|
public function updateBook(array $data): array
|
|
|
{
|
|
|
|
|
|
- $user_id = $data['user_id'] ?? 0;
|
|
|
+ // $user_id = $data['user_id'] ?? 0;
|
|
|
$type_id = $data['type_id'] ?? 0;
|
|
|
- $website_id = $data['website_id'] ?? 0;
|
|
|
+ // $website_id = $data['website_id'] ?? 0;
|
|
|
unset($data['user_id']);
|
|
|
unset($data['type_id']);
|
|
|
// unset($data['website_id']);
|