Sfoglia il codice sorgente

建立并修改接口:招工招聘-根据栏目获取招工招聘频道页的接口

15313670163 1 giorno fa
parent
commit
049ab4c09d
2 ha cambiato i file con 82 aggiunte e 2 eliminazioni
  1. 77 2
      app/JsonRpc/NewsService.php
  2. 5 0
      app/JsonRpc/NewsServiceInterface.php

+ 77 - 2
app/JsonRpc/NewsService.php

@@ -2935,7 +2935,7 @@ class NewsService implements NewsServiceInterface
           'job_recruiting.updated_at',
           'job_company.business_name'
         )
-        ->orderBy('updated_at', 'desc');
+        ->orderBy('job_recruiting.updated_at', 'desc');
       $recruit_count = $query->count();
       $query = clone $query;
       $JobRecruiting = $query
@@ -6761,7 +6761,7 @@ class NewsService implements NewsServiceInterface
         $query = Project::where($where)
             ->where('status', 1)
             ->where('website_id', $data['website_id'])
-            ->select('project.id','project.title','project.introduce','project.imgurl as imgs',
+            ->select('project.id','project.title','project.description','project.imgurl as imgs',
             'project.category_id','project.cat_arr_id')
             ->orderBy('updated_at', 'desc');
         $count = $query->count();
@@ -6794,4 +6794,79 @@ class NewsService implements NewsServiceInterface
         return Result::success($result);
     }
 
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getWebsiteCategoryJob(array $data): array
+    {
+        $categorys = json_decode($data['id'],true);
+        if(!empty($categorys)){
+            $category_arr = $this->processArticlePro($data['website_id']);
+            $cat_1st_arr = $category_arr['cat_1st_arr'];
+            $catiall = $category_arr['catiall'];
+            foreach($categorys as $key => $val){
+                if(isset($val['id']) && !empty($val['id'])){
+                    $catid = explode(',', $val['id'])[0] ?? null;
+                    $type = explode(',', $val['id'])[1] ?? null;
+                    $textnum = explode(',', $val['id'])[2] ?? null;
+                }
+               
+                // 4:招聘;5:求职;
+                if($textnum > 0 && $type == 4 && !empty($catid)){
+                    // 状态   0:待审核;1:已审核通过;(只有企业会员需要审核);2:已拒绝;
+                    $job = JobRecruiting::WhereRaw("JSON_CONTAINS(job_recruiting.cat_arr_id, '". intval($catid). "') = 1")
+                        ->leftJoin('job_company', 'job_recruiting.id', '=', 'job_company.job_id')
+                        ->where('job_recruiting.status', 1)
+                        ->where('job_recruiting.website_id', $data['website_id'])
+                        ->select('job_recruiting.id','job_recruiting.title',
+                        'job_company.business_name',
+                        'job_recruiting.updated_at','job_recruiting.cat_arr_id')
+                        ->orderBy('job_recruiting.updated_at', 'desc')
+                        
+                        ->limit($textnum)
+                        ->get()->all();
+                }else if($textnum > 0 && $type == 5 && !empty($catid)){
+                    // 状态  审核状态,1待审核2已审核3已拒绝
+                    $job = JobHunting::WhereRaw("JSON_CONTAINS(job_hunting.cat_arr_id, '". intval($catid). "') = 1")
+                        ->leftJoin('job_position', 'job_hunting.job_name_get', '=', 'job_position.zwid')
+                        ->where('job_hunting.status', 2)
+                        ->where('job_hunting.website_id', $data['website_id'])
+                        ->select('job_hunting.id','job_hunting.name','job_hunting.catid'
+                        ,'job_position.zwname as job_name','job_hunting.updated_at')
+                        ->orderBy('updated_at', 'desc')
+                        ->limit($textnum)
+                        ->get()->all();
+
+                }else{
+                    $job = [];
+                }
+                //  var_dump($catid.'222uuuuuuu'.$key);
+                if(!empty($job)){
+                    foreach($job as $k => $value){
+                        if (isset($value->catid)) {
+                            $catId = $value->catid;
+                        } else if (isset($value->cat_arr_id)) {
+                            $catArr = json_decode($value->cat_arr_id, true);
+                            $catId = end($catArr);
+                        } else {
+                            continue;
+                        }
+                        if (isset($catiall[$catId])) {
+                            $job[$k]->pinyin = $catiall[$catId]['pinyin'];
+                        }
+                    }
+                }
+                // var_dump($catid.'xxxxx'.$key);
+                $result[$key] = $job ?? [];
+                
+            }
+        }
+        if(empty($result)){
+            return Result::error("暂无相关分类信息", 0);
+        }
+        
+        return Result::success($result);
+    }
+
 }

+ 5 - 0
app/JsonRpc/NewsServiceInterface.php

@@ -447,4 +447,9 @@ interface NewsServiceInterface
      * @return array
      */
     public function getWebsiteProjectList(array $data):array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getWebsiteCategoryJob(array $data):array;
 }