|
@@ -1590,24 +1590,47 @@ class NewsService implements NewsServiceInterface
|
|
|
$imgArticles = [];
|
|
|
$textArticles = [];
|
|
|
// return Result::error("暂无此栏目",0);
|
|
|
- } else {
|
|
|
- $parent_alias = $category->aLIas_pinyin ? $category->aLIas_pinyin . '/' : null;
|
|
|
+ }else{
|
|
|
+ $child_category = WebsiteCategory::where('pid', $parentCatId)->where($website)->pluck('category_id')->toArray();
|
|
|
+ $parent_alias = $category->aLIas_pinyin ? $category->aLIas_pinyin.'/' : null;
|
|
|
// return Result::success($website);
|
|
|
// 查询图片新闻
|
|
|
// 合并查询条件
|
|
|
$baseQuery = Article::where(function ($query) use ($website) {
|
|
|
- $query->where(function ($subQuery) use ($website) {
|
|
|
- $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($website['website_id']) . "') = 0");
|
|
|
- })->orWhereNull("ignore_ids");
|
|
|
- })
|
|
|
- ->whereRaw("JSON_CONTAINS(category_arr_id, '" . intval($parentCatId) . "')")
|
|
|
+ $query->where(function ($subQuery) use ($website) {
|
|
|
+ $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($website['website_id']) . "') = 0");
|
|
|
+ })->orWhereNull("ignore_ids");
|
|
|
+ })
|
|
|
+
|
|
|
+ ->where('article.status', 1)
|
|
|
->leftJoin('website_category', 'website_category.category_id', 'article.catid')
|
|
|
- ->where('website_category.website_id', $website['website_id'])
|
|
|
- ->where('article.status', 1);
|
|
|
-
|
|
|
- // 查询文字新闻
|
|
|
- $textArticles = clone $baseQuery;
|
|
|
- $textArticles = $textArticles
|
|
|
+ ->where('website_category.website_id', $website['website_id']);
|
|
|
+
|
|
|
+ // 查询文字新闻
|
|
|
+ $textArticles = clone $baseQuery;
|
|
|
+ $textArticles = $textArticles->whereIn('catid',$child_category)
|
|
|
+ ->select(
|
|
|
+ 'article.id',
|
|
|
+ 'article.title',
|
|
|
+ // 'article.imgurl',
|
|
|
+ 'article.author',
|
|
|
+ 'article.updated_at',
|
|
|
+ 'article.introduce',
|
|
|
+ 'article.islink',
|
|
|
+ 'article.linkurl',
|
|
|
+ 'article.copyfrom',
|
|
|
+ 'website_category.category_id',
|
|
|
+ 'website_category.alias',
|
|
|
+ 'website_category.aLIas_pinyin'
|
|
|
+ )
|
|
|
+ ->selectRaw("CONCAT(?, aLIas_pinyin) as aLIas_pinyin", [$parent_alias])
|
|
|
+ ->orderBy('article.updated_at', 'desc')
|
|
|
+ ->limit($parentTextNum)
|
|
|
+ ->get()
|
|
|
+ ->all();
|
|
|
+ if(empty($textArticles)){
|
|
|
+ $textArticles = clone $baseQuery;
|
|
|
+ $textArticles = $textArticles->where('catid',$parentCatId)
|
|
|
->select(
|
|
|
'article.id',
|
|
|
'article.title',
|
|
@@ -1627,39 +1650,62 @@ class NewsService implements NewsServiceInterface
|
|
|
->limit($parentTextNum)
|
|
|
->get()
|
|
|
->all();
|
|
|
+ }
|
|
|
// 查询图片新闻
|
|
|
$imgArticles = clone $baseQuery;
|
|
|
- $imgArticles = $imgArticles
|
|
|
+ $imgArticles = $imgArticles->where('imgurl', '!=', '')->whereIn('catid',$child_category)
|
|
|
+ ->select(
|
|
|
+ 'article.id',
|
|
|
+ 'article.title',
|
|
|
+ 'article.imgurl',
|
|
|
+ 'article.author',
|
|
|
+ 'article.updated_at',
|
|
|
+ 'article.introduce',
|
|
|
+ 'article.islink',
|
|
|
+ 'article.linkurl',
|
|
|
+ 'article.copyfrom',
|
|
|
+ 'website_category.category_id',
|
|
|
+ 'website_category.alias',
|
|
|
+ 'website_category.aLIas_pinyin'
|
|
|
+ )
|
|
|
+ ->selectRaw("CONCAT(?, aLIas_pinyin) as aLIas_pinyin", [$parent_alias])
|
|
|
+ ->orderBy('article.updated_at', 'desc')
|
|
|
+ ->limit($parentImgNum)
|
|
|
+ ->get()
|
|
|
+ ->all();
|
|
|
+ if(empty($imgArticles)){
|
|
|
+ $imgArticles = clone $baseQuery;
|
|
|
+ $imgArticles = $imgArticles->where('imgurl', '!=', '')->where('catid',$parentCatId)
|
|
|
->select(
|
|
|
- 'article.id',
|
|
|
- 'article.title',
|
|
|
- 'article.imgurl',
|
|
|
- 'article.author',
|
|
|
- 'article.updated_at',
|
|
|
- 'article.introduce',
|
|
|
- 'article.islink',
|
|
|
- 'article.linkurl',
|
|
|
- 'article.copyfrom',
|
|
|
- 'website_category.category_id',
|
|
|
- 'website_category.alias',
|
|
|
- 'website_category.aLIas_pinyin'
|
|
|
- )
|
|
|
- ->selectRaw("CONCAT(?, aLIas_pinyin ) as aLIas_pinyin", [$parent_alias])
|
|
|
- ->orderBy('article.updated_at', 'desc')
|
|
|
- ->where('imgurl', '!=', '')
|
|
|
- ->limit($parentImgNum)
|
|
|
- ->get()
|
|
|
- ->all();
|
|
|
+ 'article.id',
|
|
|
+ 'article.title',
|
|
|
+ 'article.imgurl',
|
|
|
+ 'article.author',
|
|
|
+ 'article.updated_at',
|
|
|
+ 'article.introduce',
|
|
|
+ 'article.islink',
|
|
|
+ 'article.linkurl',
|
|
|
+ 'article.copyfrom',
|
|
|
+ 'website_category.category_id',
|
|
|
+ 'website_category.alias',
|
|
|
+ 'website_category.aLIas_pinyin'
|
|
|
+ )
|
|
|
+ ->selectRaw("CONCAT(?, aLIas_pinyin) as aLIas_pinyin", [$parent_alias])
|
|
|
+ ->orderBy('article.updated_at', 'desc')
|
|
|
+ ->limit($parentImgNum)
|
|
|
+ ->get()
|
|
|
+ ->all();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
- $resultItem = [
|
|
|
- 'alias' => $category ? $category->alias : null,
|
|
|
- 'category_id' => $parentCatId,
|
|
|
- 'pinyin' => $pinyin ? $pinyin : null,
|
|
|
- 'imgnum' => $imgArticles ?? [],
|
|
|
- 'textnum' => $textArticles ?? [],
|
|
|
-
|
|
|
- ];
|
|
|
+ $resultItem = [
|
|
|
+ 'alias' => $category ? $category->alias : null,
|
|
|
+ 'category_id' => $parentCatId,
|
|
|
+ 'pinyin' => $pinyin ? $pinyin : null,
|
|
|
+ 'imgnum' => $imgArticles ?? [],
|
|
|
+ 'textnum' => $textArticles ?? [],
|
|
|
+
|
|
|
+ ];
|
|
|
|
|
|
|
|
|
return $resultItem;
|
|
@@ -2415,8 +2461,14 @@ class NewsService implements NewsServiceInterface
|
|
|
public function getJobRecruitingList(array $data): array
|
|
|
{
|
|
|
$where = [];
|
|
|
- if (isset($data['keyword']) && !empty($data['keyword'])) {
|
|
|
- array_push($where, ['job_recruiting.title', 'like', '%' . $data['keyword'] . '%']);
|
|
|
+ // 状态 0:待审核;1:已审核通过;(只有企业会员需要审核);2:已拒绝;3;已撤回;
|
|
|
+ if($data['checkout'] == 0){
|
|
|
+ $job_status = [0, 2];
|
|
|
+ }else{
|
|
|
+ $job_status = [1];
|
|
|
+ }
|
|
|
+ if(isset($data['keyword']) && !empty($data['keyword'])){
|
|
|
+ array_push($where, ['job_recruiting.title', 'like', '%'. $data['keyword']. '%']);
|
|
|
}
|
|
|
$user = User::where('id', $data['user_id'])->first();
|
|
|
if (empty($user)) {
|
|
@@ -2427,21 +2479,24 @@ class NewsService implements NewsServiceInterface
|
|
|
array_push($where, ['job_recruiting.user_id', $data['user_id']]);
|
|
|
array_push($where, ['job_recruiting.website_id', $data['website_id']]);
|
|
|
}
|
|
|
+
|
|
|
// 如果 $where 为空,则不添加 where 条件
|
|
|
$result['rows'] = JobRecruiting::when(!empty($where), function ($query) use ($where) {
|
|
|
- return $query->where($where);
|
|
|
- })
|
|
|
- ->leftJoin('website', 'job_recruiting.website_id', '=', 'website.id')
|
|
|
- ->leftJoin('user', 'job_recruiting.user_id', '=', 'user.id')
|
|
|
- ->select('job_recruiting.*', 'website.website_name as website_name', 'user.user_name as user_name')
|
|
|
- ->orderBy("updated_at", "desc")
|
|
|
- ->offset(($data['page'] - 1) * $data['page_size'])
|
|
|
- ->limit($data['page_size'])
|
|
|
- ->get()
|
|
|
- ->all();
|
|
|
+ return $query->where($where);
|
|
|
+ })
|
|
|
+ ->whereIn('job_recruiting.status',$job_status)
|
|
|
+ ->leftJoin('website', 'job_recruiting.website_id', '=', 'website.id')
|
|
|
+ ->leftJoin('user', 'job_recruiting.user_id', '=', 'user.id')
|
|
|
+ ->select('job_recruiting.*', 'website.website_name as website_name', 'user.user_name as user_name')
|
|
|
+ ->orderBy("updated_at", "desc")
|
|
|
+ ->offset(($data['page'] - 1) * $data['page_size'])
|
|
|
+ ->limit($data['page_size'])
|
|
|
+ ->get()
|
|
|
+ ->all();
|
|
|
$result['count'] = JobRecruiting::when(!empty($where), function ($query) use ($where) {
|
|
|
return $query->where($where);
|
|
|
- })
|
|
|
+ })
|
|
|
+ ->whereIn('job_recruiting.status',$job_status)
|
|
|
->count();
|
|
|
if (empty($result)) {
|
|
|
return Result::error("暂无招聘信息", 0);
|
|
@@ -2511,6 +2566,9 @@ class NewsService implements NewsServiceInterface
|
|
|
Db::beginTransaction();
|
|
|
try {
|
|
|
// 先添加职位相关信息
|
|
|
+ if($user['type_id'] == 10000){
|
|
|
+ $job['status'] = 1;
|
|
|
+ }
|
|
|
$jobId = JobRecruiting::insertGetId($job);
|
|
|
if (empty($jobId)) {
|
|
|
Db::rollBack();
|
|
@@ -2655,6 +2713,9 @@ class NewsService implements NewsServiceInterface
|
|
|
if ($user['type_id'] == 10000) {
|
|
|
$data['website_id'] = $web;
|
|
|
$company['website_id'] = $data['website_id'];
|
|
|
+ $data['status'] = 1;
|
|
|
+ }else{
|
|
|
+ $data['status'] = 0;
|
|
|
}
|
|
|
// Db::rollBack();
|
|
|
// return Result::success($company);
|
|
@@ -2933,5 +2994,33 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 招聘信息审核
|
|
|
+ * */
|
|
|
+ public function checkJobRecruiting(array $data): array
|
|
|
+ {
|
|
|
+ $user = User::where('id', $data['user_id'])->first();
|
|
|
+ if(empty($user)){
|
|
|
+ return Result::error("用户不存在", 0);
|
|
|
+ }
|
|
|
+ $job = JobRecruiting::where('id', $data['id'])->first();
|
|
|
+ if(empty($job)){
|
|
|
+ return Result::error("招聘信息不存在", 0);
|
|
|
+ }
|
|
|
+ // 状态 0:待审核;1:已审核通过;(只有企业会员需要审核);2:已驳回;
|
|
|
+ if($user['type_id']== 3 && ($data['status'] == 1 || $data['status'] == 2)){
|
|
|
+ return Result::error("用户暂无权限审核此招聘信息!", 0);
|
|
|
+ }
|
|
|
+ // 驳回原因
|
|
|
+ if($data['status'] == 2){
|
|
|
+ $data['refuse_reason'] = $data['refuse_reason']?? null;
|
|
|
+ }
|
|
|
+ $result = JobRecruiting::where('id', $data['id'])->update($data);
|
|
|
+ if(empty($result)){
|
|
|
+ return Result::error("审核失败", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
// 20250306 招聘
|
|
|
}
|