|
@@ -1590,47 +1590,25 @@ class NewsService implements NewsServiceInterface
|
|
|
$imgArticles = [];
|
|
|
$textArticles = [];
|
|
|
// return Result::error("暂无此栏目",0);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$child_category = WebsiteCategory::where('pid', $parentCatId)->where($website)->pluck('category_id')->toArray();
|
|
|
- $parent_alias = $category->aLIas_pinyin ? $category->aLIas_pinyin.'/' : null;
|
|
|
+ $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");
|
|
|
- })
|
|
|
-
|
|
|
+ $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']);
|
|
|
-
|
|
|
- // 查询文字新闻
|
|
|
- $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)
|
|
|
+
|
|
|
+ // 查询文字新闻
|
|
|
+ $textArticles = clone $baseQuery;
|
|
|
+ $textArticles = $textArticles->whereIn('catid', $child_category)
|
|
|
->select(
|
|
|
'article.id',
|
|
|
'article.title',
|
|
@@ -1650,33 +1628,55 @@ class NewsService implements NewsServiceInterface
|
|
|
->limit($parentTextNum)
|
|
|
->get()
|
|
|
->all();
|
|
|
+ if (empty($textArticles)) {
|
|
|
+ $textArticles = clone $baseQuery;
|
|
|
+ $textArticles = $textArticles->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')
|
|
|
+ ->limit($parentTextNum)
|
|
|
+ ->get()
|
|
|
+ ->all();
|
|
|
}
|
|
|
// 查询图片新闻
|
|
|
$imgArticles = clone $baseQuery;
|
|
|
- $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)
|
|
|
+ $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',
|
|
@@ -1694,18 +1694,17 @@ class NewsService implements NewsServiceInterface
|
|
|
->orderBy('article.updated_at', 'desc')
|
|
|
->limit($parentImgNum)
|
|
|
->get()
|
|
|
- ->all();
|
|
|
+ ->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;
|
|
@@ -2131,20 +2130,20 @@ class NewsService implements NewsServiceInterface
|
|
|
$where = [];
|
|
|
//title
|
|
|
if (isset($data['title']) && !empty($data['title'])) {
|
|
|
- $where[] = ['title', 'like', '%' . $data['title'] . '%'];
|
|
|
+ $where[] = ['notice.title', 'like', '%' . $data['title'] . '%'];
|
|
|
}
|
|
|
//level
|
|
|
if (isset($data['level']) && !empty($data['level'])) {
|
|
|
- $where[] = ['level', '=', $data['level']];
|
|
|
+ $where[] = ['notice.level', '=', $data['level']];
|
|
|
}
|
|
|
//status
|
|
|
if (isset($data['status']) && !empty($data['status'])) {
|
|
|
- $where[] = ['status', '=', $data['status']];
|
|
|
+ $where[] = ['notice.status', '=', $data['status']];
|
|
|
}
|
|
|
var_dump($data['type_id'], '-----------------test---------');
|
|
|
if ($data['type_id'] == 10000) {
|
|
|
$result = Notice::when(!empty($data['status1']), function ($query) use ($data) {
|
|
|
- return $query->whereIn('status', [1, 3]); //1待审核2已审核3已拒绝
|
|
|
+ return $query->whereIn('notice.status', [1, 3]); //1待审核2已审核3已拒绝
|
|
|
})
|
|
|
->where($where)
|
|
|
->orderBy('updated_at', 'desc')
|
|
@@ -2352,27 +2351,31 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
public function getComplaintList(array $data): array
|
|
|
{
|
|
|
-
|
|
|
+ var_dump($data, '00000001000000000000');
|
|
|
$type_id = isset($data['type_id']) ? $data['type_id'] : '';
|
|
|
unset($data['type_id']);
|
|
|
$user_id = isset($data['user_id']) ? $data['user_id'] : '';
|
|
|
$where = [];
|
|
|
if ($type_id != 10000) {
|
|
|
- $where['user_id'] = $user_id;
|
|
|
+ $where['complaint.user_id'] = $user_id;
|
|
|
}
|
|
|
if (!empty($data['title'])) {
|
|
|
- $where['title'] = ['like', '%' . $data['title'] . '%'];
|
|
|
+ $where['complaint.title'] = ['like', '%' . $data['title'] . '%'];
|
|
|
}
|
|
|
if (!empty($data['deal'])) {
|
|
|
- $where['deal'] = ['=', $data['deal']];
|
|
|
+ $where['complaint.deal'] = $data['deal'];
|
|
|
}
|
|
|
if (!empty($data['status'])) {
|
|
|
- $where['status'] = ['=', $data['status']];
|
|
|
+ $where['complaint.status'] = $data['status'];
|
|
|
}
|
|
|
-
|
|
|
+ var_dump(!empty($data['deal_user']), '----------1');
|
|
|
$result = Complaint::where($where)
|
|
|
- ->when(!empty($data['sattus1']), function ($query) use ($data) {
|
|
|
- $query->whereIn('status', [1, 3]); //1待审核2已审核3已拒绝
|
|
|
+ ->when(!empty($data['status1']), function ($query) use ($data) {
|
|
|
+ $query->whereIn('complaint.status', [1, 3]); //1待审核2已审核3已拒绝
|
|
|
+ })
|
|
|
+ ->when(!empty($data['deal_user']), function ($query) use ($data) {
|
|
|
+ //json re_user_ids data[user_id]是不是在里面
|
|
|
+ $query->whereRaw('JSON_CONTAINS(complaint.re_user_ids, \'' . $data['user_id'] . '\')');
|
|
|
})
|
|
|
->leftJoin('department', 'complaint.department_id', '=', 'department.id')
|
|
|
// ->leftJoin('user', 'complaint.user_id', '=', 'user.id')
|
|
@@ -2380,10 +2383,11 @@ class NewsService implements NewsServiceInterface
|
|
|
->select('complaint.*', 'department.name as department_name', 'district.name as cityname')
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->paginate($data['page_size'], ['*'], 'page', $data['page']);
|
|
|
+ //sql输出
|
|
|
+
|
|
|
if (empty($result)) {
|
|
|
return Result::error("暂无投诉信息", 0);
|
|
|
}
|
|
|
-
|
|
|
// 取出数据
|
|
|
$rows = $result->items();
|
|
|
$count = $result->total();
|
|
@@ -2412,8 +2416,13 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
public function updateComplaint(array $data): array
|
|
|
{
|
|
|
+
|
|
|
date_default_timezone_set('Asia/Shanghai');
|
|
|
$data['updated_at'] = date('Y-m-d H:i:s');
|
|
|
+ $user_id = $data['user_id'] ?? 0;
|
|
|
+ $type_id = $data['type_id'] ?? 0;
|
|
|
+ unset($data['user_id']);
|
|
|
+ unset($data['type_id']);
|
|
|
$result = Complaint::where('id', $data['id'])->update($data);
|
|
|
return Result::success($result);
|
|
|
}
|
|
@@ -2432,24 +2441,74 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
public function updateComplaintStatus(array $data): array
|
|
|
{
|
|
|
+ date_default_timezone_set('Asia/Shanghai');
|
|
|
+ $data['updated_at'] = date('Y-m-d H:i:s');
|
|
|
+ $user_id = $data['user_id'] ?? 0;
|
|
|
+ $type_id = $data['type_id'] ?? 0;
|
|
|
+
|
|
|
+ unset($data['user_id']);
|
|
|
+ unset($data['type_id']);
|
|
|
+ //处理, 写入处理人
|
|
|
+ if (isset($data['deal']) && ($data['deal'] == 1 || $data['deal'] == 4)) {
|
|
|
+ $data['real_deal_user'] = $user_id;
|
|
|
+ }
|
|
|
$result = complaint::where('id', $data['id'])->update($data);
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
public function updateGoodStatus(array $data): array
|
|
|
{
|
|
|
+ $user_id = $data['user_id'] ?? 0;
|
|
|
+ $type_id = $data['type_id'] ?? 0;
|
|
|
+ unset($data['user_id']);
|
|
|
+ unset($data['type_id']);
|
|
|
+
|
|
|
$result = Good::where('id', $data['id'])->update($data);
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
public function updateJobHuntingStatus(array $data): array
|
|
|
{
|
|
|
+ $user_id = $data['user_id'] ?? 0;
|
|
|
+ $type_id = $data['type_id'] ?? 0;
|
|
|
+ unset($data['user_id']);
|
|
|
+ unset($data['type_id']);
|
|
|
$result = JobHunting::where('id', $data['id'])->update($data);
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
public function updateNoticeStatus(array $data): array
|
|
|
{
|
|
|
+ $user_id = $data['user_id'] ?? 0;
|
|
|
+ $type_id = $data['type_id'] ?? 0;
|
|
|
+ unset($data['user_id']);
|
|
|
+ unset($data['type_id']);
|
|
|
$result = Notice::where('id', $data['id'])->update($data);
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
+ public function getDUser(array $data): array
|
|
|
+ {
|
|
|
+ if (!empty($data['ids'])) {
|
|
|
+ $user = User::whereIn('id', $data['ids'])->getall();
|
|
|
+ if (empty($user)) {
|
|
|
+ return Result::error('无数据', 0);
|
|
|
+ }
|
|
|
+ return Result::success($user);
|
|
|
+ }
|
|
|
+ $where = [];
|
|
|
+ if (!empty($data['department_id'])) {
|
|
|
+ $where['department_id'] = $data['department_id'];
|
|
|
+ }
|
|
|
+ if (!empty($data['city_id'])) {
|
|
|
+ $where['city_id'] = $data['city_id'];
|
|
|
+ }
|
|
|
+ $result = User::where('type_id', 2)
|
|
|
+ ->where('status', 1)
|
|
|
+ ->where($where)
|
|
|
+ ->leftJoin('user_info', 'user.id', '=', 'user_info.user_id')
|
|
|
+ ->get();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("查询失败", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
|
|
|
//20250324 通知,公告,消息
|
|
|
|
|
@@ -2462,13 +2521,13 @@ class NewsService implements NewsServiceInterface
|
|
|
{
|
|
|
$where = [];
|
|
|
// 状态 0:待审核;1:已审核通过;(只有企业会员需要审核);2:已拒绝;3;已撤回;
|
|
|
- if($data['checkout'] == 0){
|
|
|
+ if ($data['checkout'] == 0) {
|
|
|
$job_status = [0, 2];
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$job_status = [1];
|
|
|
}
|
|
|
- if(isset($data['keyword']) && !empty($data['keyword'])){
|
|
|
- array_push($where, ['job_recruiting.title', 'like', '%'. $data['keyword']. '%']);
|
|
|
+ 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)) {
|
|
@@ -2479,24 +2538,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);
|
|
|
- })
|
|
|
- ->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();
|
|
|
+ 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)
|
|
|
+ })
|
|
|
+ ->whereIn('job_recruiting.status', $job_status)
|
|
|
->count();
|
|
|
if (empty($result)) {
|
|
|
return Result::error("暂无招聘信息", 0);
|
|
@@ -2566,8 +2625,8 @@ class NewsService implements NewsServiceInterface
|
|
|
Db::beginTransaction();
|
|
|
try {
|
|
|
// 先添加职位相关信息
|
|
|
- if($user['type_id'] == 10000){
|
|
|
- $job['status'] = 1;
|
|
|
+ if ($user['type_id'] == 10000) {
|
|
|
+ $job['status'] = 1;
|
|
|
}
|
|
|
$jobId = JobRecruiting::insertGetId($job);
|
|
|
if (empty($jobId)) {
|
|
@@ -2714,7 +2773,7 @@ class NewsService implements NewsServiceInterface
|
|
|
$data['website_id'] = $web;
|
|
|
$company['website_id'] = $data['website_id'];
|
|
|
$data['status'] = 1;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$data['status'] = 0;
|
|
|
}
|
|
|
// Db::rollBack();
|
|
@@ -2994,30 +3053,30 @@ 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)){
|
|
|
+ if (empty($user)) {
|
|
|
return Result::error("用户不存在", 0);
|
|
|
}
|
|
|
$job = JobRecruiting::where('id', $data['id'])->first();
|
|
|
- if(empty($job)){
|
|
|
+ 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 ($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;
|
|
|
+ if ($data['status'] == 2) {
|
|
|
+ $data['refuse_reason'] = $data['refuse_reason'] ?? null;
|
|
|
}
|
|
|
$result = JobRecruiting::where('id', $data['id'])->update($data);
|
|
|
- if(empty($result)){
|
|
|
+ if (empty($result)) {
|
|
|
return Result::error("审核失败", 0);
|
|
|
}
|
|
|
return Result::success($result);
|