|
@@ -13,9 +13,9 @@ use App\Model\JobCompany;
|
|
use App\Model\Website;
|
|
use App\Model\Website;
|
|
use App\Model\JobRecruiting;
|
|
use App\Model\JobRecruiting;
|
|
use App\Model\JobIndustry;
|
|
use App\Model\JobIndustry;
|
|
|
|
+use App\Model\Book;
|
|
use App\Model\JobPosition;
|
|
use App\Model\JobPosition;
|
|
use App\Model\Notice;
|
|
use App\Model\Notice;
|
|
-use App\Model\Book;
|
|
|
|
use App\Model\JobNature;
|
|
use App\Model\JobNature;
|
|
use App\Model\JobEnum;
|
|
use App\Model\JobEnum;
|
|
use App\Model\User;
|
|
use App\Model\User;
|
|
@@ -219,16 +219,14 @@ class NewsService implements NewsServiceInterface
|
|
public function categoryList(array $data): array
|
|
public function categoryList(array $data): array
|
|
{
|
|
{
|
|
$where[] = [
|
|
$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);
|
|
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::error("没有栏目数据");
|
|
}
|
|
}
|
|
return Result::success($result);
|
|
return Result::success($result);
|
|
@@ -719,6 +717,7 @@ class NewsService implements NewsServiceInterface
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
|
|
+ * 获取新闻详情
|
|
* @param array $data
|
|
* @param array $data
|
|
* @return array
|
|
* @return array
|
|
*/
|
|
*/
|
|
@@ -740,7 +739,7 @@ class NewsService implements NewsServiceInterface
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
- * 获取新闻
|
|
|
|
|
|
+ * 获取头条新闻
|
|
* @param array $data
|
|
* @param array $data
|
|
* @return array
|
|
* @return array
|
|
*/
|
|
*/
|
|
@@ -749,7 +748,7 @@ class NewsService implements NewsServiceInterface
|
|
// return Result::success($data['website_id']);
|
|
// return Result::success($data['website_id']);
|
|
$category = WebsiteCategory::where('website_id', $data['website_id'])->pluck('category_id');
|
|
$category = WebsiteCategory::where('website_id', $data['website_id'])->pluck('category_id');
|
|
$category = array_values(array_unique($category->toArray()));
|
|
$category = array_values(array_unique($category->toArray()));
|
|
-
|
|
|
|
|
|
+
|
|
if ($category) {
|
|
if ($category) {
|
|
$placeid = isset($data['placeid']) && !empty($data['placeid']) ? $data['placeid'] - 1 : 0;
|
|
$placeid = isset($data['placeid']) && !empty($data['placeid']) ? $data['placeid'] - 1 : 0;
|
|
$where = [
|
|
$where = [
|
|
@@ -965,11 +964,11 @@ class NewsService implements NewsServiceInterface
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- *获取新闻列表
|
|
|
|
|
|
+ *获取新闻列表
|
|
* @param array $data
|
|
* @param array $data
|
|
* @return array
|
|
* @return array
|
|
*/
|
|
*/
|
|
- public function getWebsiteArticleList(array $data): array
|
|
|
|
|
|
+ public function getWebsiteArticleList(array $data): array
|
|
{
|
|
{
|
|
// return Result::success($data);
|
|
// return Result::success($data);
|
|
$where[] = ['status', '=', 1];
|
|
$where[] = ['status', '=', 1];
|
|
@@ -1404,8 +1403,7 @@ class NewsService implements NewsServiceInterface
|
|
'article.copyfrom',
|
|
'article.copyfrom',
|
|
'article.catid',
|
|
'article.catid',
|
|
'article.department_arr_id',
|
|
'article.department_arr_id',
|
|
- 'article.city_arr_id',
|
|
|
|
- )
|
|
|
|
|
|
+ 'article.city_arr_id',)
|
|
->orderBy("updated_at", "desc")
|
|
->orderBy("updated_at", "desc")
|
|
->offset(($data['page'] - 1) * $data['pageSize'])
|
|
->offset(($data['page'] - 1) * $data['pageSize'])
|
|
->limit($data['pageSize'])
|
|
->limit($data['pageSize'])
|
|
@@ -1924,64 +1922,55 @@ class NewsService implements NewsServiceInterface
|
|
$data = json_decode($input['id'] ?? '', true) ?? [];
|
|
$data = json_decode($input['id'] ?? '', true) ?? [];
|
|
$result['goods'] = array_map(function ($item) use ($input) {
|
|
$result['goods'] = array_map(function ($item) use ($input) {
|
|
// 检查parent元素是否存在且不是undefined
|
|
// 检查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')
|
|
->orderBy('article.updated_at', 'desc')
|
|
->first();
|
|
->first();
|
|
return Result::success($result);
|
|
return Result::success($result);
|
|
@@ -2097,40 +2086,31 @@ class NewsService implements NewsServiceInterface
|
|
->orWhereRaw("JSON_CONTAINS(good.city_arr_id, '\"" . intval($data['city_id']) . "\"') = 1");
|
|
->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.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.catid','good.type_id','good.website_id','good.cat_arr_id','good.created_at','good.city_id')
|
|
->latest('updated_at');
|
|
->latest('updated_at');
|
|
- // 获取 type_id 为 1 的数据
|
|
|
|
- $result['type1'] = $this->processGoods(
|
|
|
|
- $query->clone()
|
|
|
|
- ->where('type_id', 1)
|
|
|
|
- ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
|
- ->limit($data['pageSize'])
|
|
|
|
- ->get(),
|
|
|
|
- $data
|
|
|
|
- );
|
|
|
|
- // 获取 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->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->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);
|
|
return Result::success($result);
|
|
@@ -2146,7 +2126,7 @@ class NewsService implements NewsServiceInterface
|
|
'good.status' => 2,
|
|
'good.status' => 2,
|
|
'good.website_id' => $data['website_id'],
|
|
'good.website_id' => $data['website_id'],
|
|
'good.id' => $data['id'],
|
|
'good.id' => $data['id'],
|
|
- ];
|
|
|
|
|
|
+ ];
|
|
$goods = Good::where($where)
|
|
$goods = Good::where($where)
|
|
->where('good.id', $data['id'])
|
|
->where('good.id', $data['id'])
|
|
->leftJoin('website_category', 'website_category.category_id', 'good.catid')
|
|
->leftJoin('website_category', 'website_category.category_id', 'good.catid')
|
|
@@ -2188,8 +2168,7 @@ class NewsService implements NewsServiceInterface
|
|
});
|
|
});
|
|
}
|
|
}
|
|
// 封装处理由问题
|
|
// 封装处理由问题
|
|
- function processJob($job, $data)
|
|
|
|
- {
|
|
|
|
|
|
+ function processJob($job, $data) {
|
|
return $job->map(function ($job) use ($data) {
|
|
return $job->map(function ($job) use ($data) {
|
|
$category = $job->cat_arr_id ?? '';
|
|
$category = $job->cat_arr_id ?? '';
|
|
$cityid = $job->city_arr_id ?? '';
|
|
$cityid = $job->city_arr_id ?? '';
|
|
@@ -2222,35 +2201,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']);
|
|
$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) ?? [];
|
|
$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)
|
|
$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_name = ($address ?? '') . ($job->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) {
|
|
$hy_name = JobIndustry::when($job, function ($query) use ($job) {
|
|
- if (!empty($job->industry)) {
|
|
|
|
|
|
+ if(!empty($job->industry)){
|
|
$query->where('hyid', $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);
|
|
$query->where('hyid', $job->hy_id);
|
|
- } else {
|
|
|
|
|
|
+ }else{
|
|
$query->where('hyid', $job->company_hy_id);
|
|
$query->where('hyid', $job->company_hy_id);
|
|
}
|
|
}
|
|
})->first(['hyname']);
|
|
})->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))) {
|
|
if ((isset($job->zw_id) && !empty($job->zw_id)) || (isset($job->job) && !empty($job->job))) {
|
|
@@ -2440,12 +2419,11 @@ class NewsService implements NewsServiceInterface
|
|
'book.cat_id',
|
|
'book.cat_id',
|
|
'book.description',
|
|
'book.description',
|
|
'book.updated_at',
|
|
'book.updated_at',
|
|
- DB::raw("'$child_pinyin' as pinyin")
|
|
|
|
- )
|
|
|
|
|
|
+ DB::raw("'$child_pinyin' as pinyin"))
|
|
->orderBy('updated_at', 'desc')
|
|
->orderBy('updated_at', 'desc')
|
|
->limit($childImgNum)
|
|
->limit($childImgNum)
|
|
->get()->all();
|
|
->get()->all();
|
|
- // 查询子栏目文字新闻
|
|
|
|
|
|
+ // 查询子栏目文字新闻
|
|
$childTextArticles = Book::where('cat_id', $childCatId)
|
|
$childTextArticles = Book::where('cat_id', $childCatId)
|
|
->where('status', 2)
|
|
->where('status', 2)
|
|
->leftJoin('website_category', function ($join) use ($website) {
|
|
->leftJoin('website_category', function ($join) use ($website) {
|
|
@@ -2462,8 +2440,7 @@ class NewsService implements NewsServiceInterface
|
|
'book.cat_id',
|
|
'book.cat_id',
|
|
'book.description',
|
|
'book.description',
|
|
'book.updated_at',
|
|
'book.updated_at',
|
|
- DB::raw("'$child_pinyin' as pinyin")
|
|
|
|
- )
|
|
|
|
|
|
+ DB::raw("'$child_pinyin' as pinyin"))
|
|
->orderBy('updated_at', 'desc')
|
|
->orderBy('updated_at', 'desc')
|
|
->limit($childTextNum)
|
|
->limit($childTextNum)
|
|
->get()->all();
|
|
->get()->all();
|
|
@@ -2504,16 +2481,8 @@ class NewsService implements NewsServiceInterface
|
|
$categorys = WebsiteCategory::where('website_id', $data['website_id'])
|
|
$categorys = WebsiteCategory::where('website_id', $data['website_id'])
|
|
->where('pid', $category['pid'])
|
|
->where('pid', $category['pid'])
|
|
->select(
|
|
->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")
|
|
DB::raw("CONCAT('$parent_pinyin', '/', aLIas_pinyin) as pinyin")
|
|
)
|
|
)
|
|
->orderBy('sort')
|
|
->orderBy('sort')
|
|
@@ -2538,13 +2507,13 @@ class NewsService implements NewsServiceInterface
|
|
$query = clone $query;
|
|
$query = clone $query;
|
|
$Book = $query
|
|
$Book = $query
|
|
->limit($data['pageSize'])
|
|
->limit($data['pageSize'])
|
|
- ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
|
|
|
+ ->offset(($data['page']-1)*$data['pageSize'])
|
|
->get()->all();
|
|
->get()->all();
|
|
-
|
|
|
|
|
|
+
|
|
$result = [
|
|
$result = [
|
|
'category' => $categorys,
|
|
'category' => $categorys,
|
|
'books' => $Book,
|
|
'books' => $Book,
|
|
- 'count' => $count,
|
|
|
|
|
|
+ 'count' =>$count,
|
|
];
|
|
];
|
|
// if(empty($result)){
|
|
// if(empty($result)){
|
|
// return Result::error("查询失败", 0);
|
|
// return Result::error("查询失败", 0);
|
|
@@ -2558,8 +2527,8 @@ class NewsService implements NewsServiceInterface
|
|
* */
|
|
* */
|
|
public function getWebsiteBookInfo(array $data): array
|
|
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);
|
|
return Result::error("查询失败", 0);
|
|
}
|
|
}
|
|
$book = Book::where('status', 2)
|
|
$book = Book::where('status', 2)
|
|
@@ -2588,15 +2557,7 @@ class NewsService implements NewsServiceInterface
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$categorys = $query->where('pid', $pid)
|
|
$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')
|
|
->orderBy('sort')
|
|
->get();
|
|
->get();
|
|
@@ -2607,7 +2568,7 @@ class NewsService implements NewsServiceInterface
|
|
];
|
|
];
|
|
return Result::success($result);
|
|
return Result::success($result);
|
|
}
|
|
}
|
|
- /**
|
|
|
|
|
|
+ /**
|
|
* 尝试
|
|
* 尝试
|
|
* @param array $data
|
|
* @param array $data
|
|
* @return array
|
|
* @return array
|
|
@@ -2616,7 +2577,7 @@ class NewsService implements NewsServiceInterface
|
|
{
|
|
{
|
|
$input['id'] = $data['id'];
|
|
$input['id'] = $data['id'];
|
|
$input['website_id'] = $data['website_id'];
|
|
$input['website_id'] = $data['website_id'];
|
|
- // 将 JSON 字符串转换为 PHP 数组
|
|
|
|
|
|
+ // 将 JSON 字符串转换为 PHP 数组
|
|
$data = json_decode($input['id'], true);
|
|
$data = json_decode($input['id'], true);
|
|
$result = [];
|
|
$result = [];
|
|
$article = $data;
|
|
$article = $data;
|
|
@@ -2690,15 +2651,8 @@ class NewsService implements NewsServiceInterface
|
|
$q->WhereRaw("JSON_CONTAINS(job_hunting.city_arr_id, '" . intval($data['city_id']) . "') = 1");
|
|
$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'
|
|
|
|
- )
|
|
|
|
|
|
+ ->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')
|
|
->orderBy('updated_at', 'desc')
|
|
->limit($data['job1_num'])
|
|
->limit($data['job1_num'])
|
|
->get();
|
|
->get();
|
|
@@ -2716,19 +2670,10 @@ class NewsService implements NewsServiceInterface
|
|
});
|
|
});
|
|
})
|
|
})
|
|
->leftJoin('job_company', 'job_recruiting.id', '=', 'job_company.job_id')
|
|
->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_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')
|
|
->orderBy('updated_at', 'desc')
|
|
->limit($data['job2_num'])
|
|
->limit($data['job2_num'])
|
|
->get();
|
|
->get();
|
|
@@ -2785,17 +2730,9 @@ class NewsService implements NewsServiceInterface
|
|
});
|
|
});
|
|
})
|
|
})
|
|
->leftJoin('job_company', 'job_recruiting.id', '=', 'job_company.job_id')
|
|
->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'
|
|
|
|
- )
|
|
|
|
|
|
+ ->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');
|
|
->orderBy('updated_at', 'desc');
|
|
$recruit_count = $query->count();
|
|
$recruit_count = $query->count();
|
|
$query = clone $query;
|
|
$query = clone $query;
|
|
@@ -3032,6 +2969,34 @@ class NewsService implements NewsServiceInterface
|
|
}
|
|
}
|
|
return Result::success($result);
|
|
return Result::success($result);
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * 招工招聘 -我的职位(企业会员)
|
|
|
|
+ * @param array $data
|
|
|
|
+ * @return array
|
|
|
|
+ */
|
|
|
|
+ public function getWebsiteJobRecruiting(array $data): array
|
|
|
|
+ {
|
|
|
|
+ $web = Website::where('id', $data['website_id'])->first('id');
|
|
|
|
+ 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)){
|
|
|
|
+ return Result::error("用户暂无权限!", 0);
|
|
|
|
+ }
|
|
|
|
+ $result = JobRecruiting::where('website_id', $data['website_id'])
|
|
|
|
+ ->when(isset($user['type_id']) && $user['type_id']== 3, function ($query) use ($user) {
|
|
|
|
+ $query->where('user_id', $user['id']);
|
|
|
|
+ })
|
|
|
|
+ ->select('id','title','website_id','user_id','updated_at')
|
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
|
+ ->limit($data['pageSize'])
|
|
|
|
+ ->get();
|
|
|
|
+ if(empty($result)){
|
|
|
|
+ return Result::error("暂无相关职位信息", 0);
|
|
|
|
+ }
|
|
|
|
+ return Result::success($result);
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 验证导航名称是否重复
|
|
* 验证导航名称是否重复
|
|
* @return void
|
|
* @return void
|