LiuJ 3 天之前
父節點
當前提交
dc604723b8
共有 2 個文件被更改,包括 151 次插入74 次删除
  1. 138 62
      app/JsonRpc/NewsService.php
  2. 13 12
      app/JsonRpc/NewsServiceInterface.php

+ 138 - 62
app/JsonRpc/NewsService.php

@@ -1924,55 +1924,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); 
-            } 
-            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')
+            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')
             ->orderBy('article.updated_at', 'desc')
             ->first();
         return Result::success($result);
@@ -4558,6 +4567,71 @@ class NewsService implements NewsServiceInterface
         }
         return Result::success($result);
     }
+    public function myApplyList(array $data): array
+    {
+        $user = User::where('id', $data['user_id'])->first();
+        if (empty($user) || ($user['type_id'] != 10000 && $user['type_id'] != 1)) {
+            return Result::error("用户不存在", 0);
+        }
+        // 1:个人会员    职场机会
+        if ($user['type_id'] == 1) {
+            $where['user_id'] = $user['id'];
+        }
+        $recruitingId = JobResume::when($user['type_id'] == 1, function ($query) use ($user) {
+            $query->where('recruit_id', $user['id']);
+        })
+            ->pluck('recruit_id');
+        $where = [];
+        if (isset($data['salary']) && $data['salary'] != null) {
+            $where['job_recruiting.salary'] = $data['salary'];
+        }
+        if (isset($data['experience']) && $data['experience'] != null) {
+            $where['job_recruiting.experience'] = $data['experience'];
+        }
+        if (isset($data['business_name']) && $data['business_name'] != null) {
+            array_push($where, ['job_company.business_name', 'like', '%' . $data['business_name'] . '%']);
+        }
+        $query = JobRecruiting::whereIn('job_recruiting.id', $recruitingId)
+            ->leftJoin('job_company', 'job_recruiting.id', '=', 'job_company.job_id')
+            ->where($where);
+        // ->count();
+        $count = $query->count();
+        $query = clone $query;
+        $job = $query
+            ->leftJoin('job_enum as income_enum', function ($join) {
+                $join->on('job_recruiting.salary', '=', 'income_enum.evalue')
+                    ->where('income_enum.egroup', 'income');
+            })
+            ->leftJoin('job_enum as years_enum', function ($join) {
+                $join->on('job_recruiting.experience', '=', 'years_enum.evalue')
+                    ->where('years_enum.egroup', 'years');
+            })
+            // ->where($where)
+            ->orderBy('job_recruiting.updated_at', 'desc')
+            ->select(
+                'job_recruiting.id',
+                'job_recruiting.title',
+                'job_company.business_name',
+                'income_enum.evalue as salary_evalue',
+                'income_enum.ename as salary_ename',
+                'years_enum.evalue as experience_evalue',
+                'years_enum.ename as experience_ename',
+                'job_recruiting.updated_at'
+            )
+            ->offset(($data['page'] - 1) * $data['pageSize'])
+            ->limit($data['pageSize'])
+            ->get()
+            ->all();
+
+        if (empty($job)) {
+            return Result::error("暂无招聘信息", 0);
+        }
+        $result = [
+            'row' => $job,
+            'count' => $count,
+        ];
+        return Result::success($result);
+    }
     /*
     * 获取招聘信息列表-职场机会(个人会员收到企业推送岗位)
     * */
@@ -4568,7 +4642,7 @@ class NewsService implements NewsServiceInterface
             return Result::error("用户不存在", 0);
         }
         // 1:个人会员    职场机会
-        if($user['type_id'] == 1){
+        if ($user['type_id'] == 1) {
             $where['user_id'] = $user['id'];
         }
         $recruitingId = JobResume::when($user['type_id'] == 1, function ($query) use ($user) {
@@ -4663,28 +4737,28 @@ class NewsService implements NewsServiceInterface
     public function getJobResumeList(array $data): array
     {
         $user = User::where('id', $data['user_id'])->first();
-        if(empty($user) || ($user['type_id']!= 10000 && $user['type_id']!= 3)){
+        if (empty($user) || ($user['type_id'] != 10000 && $user['type_id'] != 3)) {
             return Result::error("用户不存在", 0);
         }
         $where = [];
-        if(isset($data['salary']) && $data['salary']!=null){
+        if (isset($data['salary']) && $data['salary'] != null) {
             $where['job_hunting.salary'] = $data['salary'];
         }
-        if(isset($data['user_name']) && $data['user_name']!=null){
-            array_push($where, ['user.user_name', 'like', '%'. $data['user_name']. '%']);
+        if (isset($data['user_name']) && $data['user_name'] != null) {
+            array_push($where, ['user.user_name', 'like', '%' . $data['user_name'] . '%']);
         }
         $job = JobResume::when($user['type_id'] == 3, function ($query) use ($user) {
             $query->where('job_resume.user_id', $user['id']);
         })
-        ->when(!empty($where), function ($query) use ($where) {
-            $query->where($where);
-        })
-        ->leftJoin('job_hunting','job_hunting.id','job_resume.hunt_id')
-        ->leftJoin('job_recruiting','job_recruiting.id','job_resume.recruit_id')
-        ->leftJoin('user','user.id','job_resume.receiver_id')
-        ->select('job_resume.hunt_id','job_resume.recruit_id','job_hunting.id','job_hunting.salary','job_hunting.city_id','job_recruiting.jtzw_id','user.user_name');
+            ->when(!empty($where), function ($query) use ($where) {
+                $query->where($where);
+            })
+            ->leftJoin('job_hunting', 'job_hunting.id', 'job_resume.hunt_id')
+            ->leftJoin('job_recruiting', 'job_recruiting.id', 'job_resume.recruit_id')
+            ->leftJoin('user', 'user.id', 'job_resume.receiver_id')
+            ->select('job_resume.hunt_id', 'job_resume.recruit_id', 'job_hunting.id', 'job_hunting.salary', 'job_hunting.city_id', 'job_recruiting.jtzw_id', 'user.user_name');
         $count = $job->count();
-        if($count == 0){
+        if ($count == 0) {
             return Result::error("暂无沟通记录", 0);
         }
         $jobs = $job->offset(($data['page'] - 1) * $data['pageSize'])
@@ -4842,6 +4916,8 @@ class NewsService implements NewsServiceInterface
     }
     public function updateBookStatus(array $data): array
     {
+        //审核
+        unset($data['user_id']);
         $result = Book::where("id", $data["id"])->update($data);
         if (empty($result)) {
             return Result::error("更新失败", 0);

+ 13 - 12
app/JsonRpc/NewsServiceInterface.php

@@ -308,60 +308,61 @@ interface NewsServiceInterface
      * @param array $data
      * @return array
      */
-    public function getRecruitingList(array $data):array;
+    public function getRecruitingList(array $data): array;
     /**
      * @param array $data
      * @return array
      */
-    public function getRecruitingInfo(array $data):array;
+    public function getRecruitingInfo(array $data): array;
     /**
      * @param array $data
      * @return array
      */
-    public function getJobResumeList(array $data):array;
+    public function getJobResumeList(array $data): array;
     /**
      * @param array $data
      * @return array
      */
-    public function getWebsiteBook(array $data):array;
+    public function getWebsiteBook(array $data): array;
     /**
      * @param array $data
      * @return array
      */
-    public function getWebsiteBookList(array $data):array;
+    public function getWebsiteBookList(array $data): array;
     /**
      * @param array $data
      * @return array
      */
-    public function getWebsiteBookInfo(array $data):array;
+    public function getWebsiteBookInfo(array $data): array;
     /**
      * @param array $data
      * @return array
      */
-    public function getWebsiteJob(array $data):array;
+    public function getWebsiteJob(array $data): array;
     /**
      * @param array $data
      * @return array
      */
-    public function getWebsiteJobList(array $data):array;
+    public function getWebsiteJobList(array $data): array;
     /**
      * @param array $data
      * @return array
      */
-    public function getWebsiteJobInfo(array $data):array;
+    public function getWebsiteJobInfo(array $data): array;
     /**
      * @param array $data
      * @return array
      */
-    public function getWebsiteJobApply(array $data):array;
+    public function getWebsiteJobApply(array $data): array;
     /**
      * @param array $data
      * @return array
      */
-    public function getWebsiteJobResume(array $data):array;
+    public function getWebsiteJobResume(array $data): array;
     /**
      * @param array $data
      * @return array
      */
-    public function test(array $data):array;
+    public function test(array $data): array;
+    public function myApplyList(array $data): array;
 }