LiuJ 12 小时之前
父节点
当前提交
658b746501
共有 1 个文件被更改,包括 65 次插入40 次删除
  1. 65 40
      app/JsonRpc/NewsService.php

+ 65 - 40
app/JsonRpc/NewsService.php

@@ -2672,18 +2672,18 @@ class NewsService implements NewsServiceInterface
     public function getWebsiteJobSelect(array $data): array
     {
         $web = Website::where('id', $data['website_id'])->first();
-        if(empty($web)){
+        if (empty($web)) {
             return Result::error("该网站不存在", 0);
         }
         $hy = JobIndustry::get()->all();
-        $zw = JobPosition::where('zwpid',0)->get()->all();
-        $jtzw = JobPosition::where('zwpid','!=',0)->get()->all();
+        $zw = JobPosition::where('zwpid', 0)->get()->all();
+        $jtzw = JobPosition::where('zwpid', '!=', 0)->get()->all();
         $result = [
             'hy' => $hy,
             'zw' => $zw,
             'jtzw' => $jtzw,
         ];
-        if(empty($result)){
+        if (empty($result)) {
             return Result::error("查询失败", 0);
         }
         return Result::success($result);
@@ -2706,8 +2706,19 @@ 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_name_get','job_hunting.industry','job_hunting.name','job_hunting.sexy'
-            ,'job_hunting.origin','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_name_get',
+                'job_hunting.industry',
+                'job_hunting.name',
+                'job_hunting.sexy',
+                'job_hunting.origin',
+                'job_hunting.city_arr_id',
+                'job_hunting.experience',
+                'job_hunting.updated_at',
+                'job_hunting.salary'
+            )
             ->orderBy('updated_at', 'desc')
             ->limit($data['job1_num'])
             ->get();
@@ -2749,7 +2760,7 @@ class NewsService implements NewsServiceInterface
         } else {
             $job_recruitings = $this->processJob($job_recruiting, $web);
         }
-       
+
         $result = [
             'job_hunting' => $job_huntings,
             'job_recuiting' => $job_recruitings,
@@ -3084,31 +3095,31 @@ class NewsService implements NewsServiceInterface
      */
     public function checkWebsiteRoute(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);
         }
         // 验证栏目路由
         $last_category = WebsiteCategory::where('website_id', $data['website_id'])
             ->where('aLIas_pinyin', $data['last_route'])
             ->first();
-        if(empty($last_category)){
+        if (empty($last_category)) {
             return Result::error("该栏目不存在", 0);
         }
-        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招工招聘'
             switch ($last_category['type']) {
                 case 1:
                     // 文章
                     //   `status` int DEFAULT '1' COMMENT '状态: 2:已拒绝  ;1:已发布,0待发布 草稿箱 404删除(移除) 
                     $article = Article::where('status', 1)
-                    ->where('id', $data['id'])
-                    ->where(function ($query) use ($data) {
-                        $query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
-                            ->orWhereNull("ignore_ids");
+                        ->where('id', $data['id'])
+                        ->where(function ($query) use ($data) {
+                            $query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
+                                ->orWhereNull("ignore_ids");
                         })
-                    ->first(['cat_arr_id']);
-                    if(empty($article)){
+                        ->first(['cat_arr_id']);
+                    if (empty($article)) {
                         return Result::error("该文章不存在", 0);
                     }
                     // return Result::success($article);
@@ -3120,7 +3131,7 @@ class NewsService implements NewsServiceInterface
                         ->where('status', 2)
                         ->where('id', $data['id'])
                         ->first(['cat_arr_id']);
-                    if(empty($article)){
+                    if (empty($article)) {
                         return Result::error("该商品不存在", 0);
                     }
                     break;
@@ -3130,8 +3141,8 @@ class NewsService implements NewsServiceInterface
                     $article = Book::where('website_id', $data['website_id'])
                         ->where('status', 2)
                         ->where('id', $data['id'])
-                        ->first(['id','cat_arr_id']);
-                    if(empty($article)){
+                        ->first(['id', 'cat_arr_id']);
+                    if (empty($article)) {
                         return Result::error("该书刊不存在", 0);
                     }
                     break;
@@ -3142,7 +3153,7 @@ class NewsService implements NewsServiceInterface
                         ->where('status', 1)
                         ->where('id', $data['id'])
                         ->first(['cat_arr_id']);
-                    if(empty($article)){
+                    if (empty($article)) {
                         return Result::error("该招聘不存在", 0);
                     }
                     break;
@@ -3153,7 +3164,7 @@ class NewsService implements NewsServiceInterface
                         ->where('status', 2)
                         ->where('id', $data['id'])
                         ->first(['cat_arr_id']);
-                    if(empty($article)){
+                    if (empty($article)) {
                         return Result::error("该求职不存在", 0);
                     }
                     break;
@@ -3164,13 +3175,13 @@ class NewsService implements NewsServiceInterface
                         ->where('status', 1)
                         ->where('id', $data['id'])
                         ->first(['cat_arr_id']);
-                    if(empty($article)){
+                    if (empty($article)) {
                         $article = JobHunting::where('website_id', $data['website_id'])
-                        ->where('status', 2)
-                        ->where('id', $data['id'])
-                        ->first(['cat_arr_id']);
+                            ->where('status', 2)
+                            ->where('id', $data['id'])
+                            ->first(['cat_arr_id']);
                     }
-                    if(empty($article)){
+                    if (empty($article)) {
                         return Result::error("该招工招聘不存在", 0);
                     }
                     break;
@@ -3179,33 +3190,32 @@ class NewsService implements NewsServiceInterface
                     break;
             }
             $catid = json_decode($article['cat_arr_id'], true);
-            if(empty($catid)){
+            if (empty($catid)) {
                 return Result::error("该数据不存在", 0);
             }
             $pinyin = WebsiteCategory::where('website_id', $data['website_id'])
-                ->orderByRaw('FIELD(category_id, '. implode(',', $catid). ')')
+                ->orderByRaw('FIELD(category_id, ' . implode(',', $catid) . ')')
                 ->whereIn('category_id', $catid)
                 ->pluck('aLIas_pinyin')
                 ->implode('/');
-            
         }
-        if($last_category['pid']!=0){
+        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). ')')
+                ->orderByRaw('FIELD(category_id, ' . implode(',', $cat_arr) . ')')
                 ->whereIn('category_id', $cat_arr)
                 ->pluck('aLIas_pinyin')
                 ->implode('/');
-        }else{
+        } else {
             $pinyin = $last_category['aLIas_pinyin'];
         }
-        if(empty($pinyin) || $pinyin!=$data['all_route']){
+        if (empty($pinyin) || $pinyin != $data['all_route']) {
             return Result::error('非法路径!');
-        }else{
+        } else {
             return Result::success($pinyin);
         }
     }
-    
+
     /**
      * 验证导航名称是否重复
      * @return void
@@ -3675,7 +3685,7 @@ class NewsService implements NewsServiceInterface
         if (isset($data['status']) && !empty($data['status'])) {
             $where[] = ['notice.status', '=', $data['status']];
         }
-        var_dump($data['type_id'], '-----------------test---------');
+        var_dump($data, '-----------------test---------');
         if ($data['type_id'] == 10000) {
             $result = Notice::when(!empty($data['status1']), function ($query) use ($data) {
                 return $query->whereIn('notice.status', [1, 3]);   //1待审核2已审核3已拒绝
@@ -3685,6 +3695,12 @@ class NewsService implements NewsServiceInterface
                 ->limit($data['page_size'])
                 ->offset(($data['page'] - 1) * $data['page_size'])
                 ->get();
+            $total = Notice::when(!empty($data['status1']), function ($query) use ($data) {
+                return $query->whereIn('notice.status', [1, 3]);   //1待审核2已审核3已拒绝
+            })
+                ->where($where)
+                ->orderBy('updated_at', 'desc')
+                ->count();
         } else {
             $result = Notice::where('status', 1)
                 ->where($where)
@@ -3696,14 +3712,20 @@ class NewsService implements NewsServiceInterface
                 ->limit($data['page_size'])
                 ->offset(($data['page'] - 1) * $data['page_size'])
                 ->get();
+            $total = Notice::where('status', 1)
+                ->where($where)
+                ->where('user_id', $data['user_id'])
+                ->orWhere(function ($query) use ($data) {
+                    $query->where('re_user_ids', 'like', '%' . $data['user_id'] . '%');
+                })
+                ->count();
         }
         if (empty($result)) {
             return Result::error("查询失败", 0);
         }
-        $count = Notice::where('status', 1)->count();
         $data = [
             'rows' => $result,
-            'count' => $count,
+            'count' => $total,
         ];
         return Result::success($data);
     }
@@ -4006,7 +4028,10 @@ class NewsService implements NewsServiceInterface
             $where['complaint.user_id'] = $user_id;
         }
         if (!empty($data['title'])) {
-            $where['complaint.title'] = ['like', '%' . $data['title'] . '%'];
+            $where[] = ['complaint.title', 'like', '%' . $data['title'] . '%'];
+        }
+        if (!empty($data['department_id'])) {
+            $where['complaint.department_id'] =   $data['department_id'];
         }
         if (!empty($data['deal'])) {
             $where['complaint.deal'] =   $data['deal'];