Explorar o código

审核接口;招聘信息列表审核(end..)

15313670163 hai 1 semana
pai
achega
eb1bb01376
Modificáronse 2 ficheiros con 46 adicións e 0 borrados
  1. 41 0
      app/JsonRpc/NewsService.php
  2. 5 0
      app/JsonRpc/NewsServiceInterface.php

+ 41 - 0
app/JsonRpc/NewsService.php

@@ -1061,6 +1061,12 @@ class NewsService implements NewsServiceInterface
     public function getJobRecruitingList(array $data): array
     {
         $where = [];
+        // 状态   0:待审核;1:已审核通过;(只有企业会员需要审核);2:已拒绝;3;已撤回;
+        if($data['checkout'] == 1){
+            $job_status=['status'=>[1,3]];
+        }else{
+            $job_status = ['status'=>[0,2]];
+        }
         if(isset($data['keyword']) && !empty($data['keyword'])){
             array_push($where, ['job_recruiting.title', 'like', '%'. $data['keyword']. '%']);
         }
@@ -1073,10 +1079,12 @@ 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_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')
@@ -1088,6 +1096,7 @@ class NewsService implements NewsServiceInterface
         $result['count'] = JobRecruiting::when(!empty($where), function ($query) use ($where) {
             return $query->where($where);
             })
+            // ->whereIn($job_status)
             ->count();
         if (empty($result)) {
             return Result::error("暂无招聘信息", 0);
@@ -1155,6 +1164,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();
@@ -1300,6 +1312,7 @@ class NewsService implements NewsServiceInterface
             }
             // Db::rollBack();
             // return Result::success($company);
+            $data['status'] = 0;
             $result['job'] = JobRecruiting::where('id', $jobId)->update($data);
             if (empty($result['job'])) {
                 Db::rollBack();
@@ -1576,5 +1589,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:已驳回;3:已撤回;
+        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 招聘
 }

+ 5 - 0
app/JsonRpc/NewsServiceInterface.php

@@ -230,4 +230,9 @@ interface NewsServiceInterface
      * @return array
      */
     public function upJobCompany(array $data):array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function checkJobRecruiting(array $data):array;
 }