15313670163 1 개월 전
부모
커밋
8a001052eb
2개의 변경된 파일109개의 추가작업 그리고 19개의 파일을 삭제
  1. 99 19
      app/JsonRpc/NewsService.php
  2. 10 0
      app/JsonRpc/NewsServiceInterface.php

+ 99 - 19
app/JsonRpc/NewsService.php

@@ -1085,6 +1085,80 @@ class NewsService implements NewsServiceInterface
         return Result::success($result);
     }
     /*
+    * 获取公司信息
+    * */
+    public function getJobCompany(array $data): array
+    {
+        $where = [];
+        if(isset($data['job_id']) && !empty($data['job_id'])){
+            $where = [ 'job_id' => $data['job_id'] ];
+        }
+        $user = User::where('id', $data['user_id'])->first();
+        if(empty($user)){
+            return Result::error("用户不存在", 0);
+        }
+        if($user['type_id'] != 3){
+            $result = JobCompany::where($where)->first();
+        }else{
+            $result = [
+                'id' => 0,
+                'user_id' => $data['user_id'],
+                'website_id' =>  $data['website_id'],
+                'business_name' => $user['business_name'],       // 企业名称
+                'hy_id' => $user['hy_id'],                       // 企业所属行业
+                'company_nature' => $user['company_nature'],     // 公司性质
+                'company_size' => $user['company_size'],         // 公司规模
+                'introduction' => $user['introduction'],         // 公司简介
+                'real_name' => $user['real_name'],               // 企业联系人
+                'mobile' => $user['mobile'],                     // 企业联系电话
+                'company_url' => $user['company_url'],           // 企业网址
+                'address_arr_id' => $user['address_arr_id'],     // 企业网址
+                'address' => $user['address'],                   // 企业地址
+                'email' => $user['email'],                       // 企业邮箱
+            ];
+        }
+        if(empty($result)){
+            return Result::error("公司信息不存在", 0);
+        }
+        return Result::success($result);
+    }
+    /*
+    * 修改公司信息
+    * */
+    public function upJobCompany(array $data): array
+    {
+        $where = [];
+        $where = [ 'user_id' => $data['user_id'] ];
+        $user = User::where('id', $data['user_id'])->first();
+        if(empty($user)){
+            return Result::error("用户不存在", 0);
+        }
+        if($user['type_id'] != 3){
+            $result = JobCompany::where($where)->first();
+        }else{
+            $result = [
+                'id' => 0,
+                'user_id' => $data['user_id'],
+                'website_id' =>  $data['website_id'],
+                'business_name' => $user['business_name'],       // 企业名称
+                'hy_id' => $user['hy_id'],                       // 企业所属行业
+                'company_nature' => $user['company_nature'],     // 公司性质
+                'company_size' => $user['company_size'],         // 公司规模
+                'introduction' => $user['introduction'],         // 公司简介
+                'real_name' => $user['real_name'],               // 企业联系人
+                'mobile' => $user['mobile'],                     // 企业联系电话
+                'company_url' => $user['company_url'],           // 企业网址
+                'address_arr_id' => $user['address_arr_id'],     // 企业网址
+                'address' => $user['address'],                   // 企业地址
+                'email' => $user['email'],                       // 企业邮箱
+            ];
+        }
+        if(empty($result)){
+            return Result::error("公司信息不存在", 0);
+        }
+        return Result::success($result);
+    }
+    /*
     * 招聘信息详情
     * */
     public function getJobRecruitingInfo(array $data): array
@@ -1097,25 +1171,31 @@ class NewsService implements NewsServiceInterface
         if(empty($user)){
             return Result::error("用户不存在", 0);
         }
-        if($user['user_type'] == 3){
-            $result = JobRecruiting::where('job_recruiting.id', $data['id'])
-            ->leftJoin('user_info', 'job_recruiting.user_id', 'user_info.id')
-            ->leftJoin('user', 'job_recruiting.user_id', 'user.id')
-            ->select(
-                'job_recruiting.*',
-                'user_info.business_name',          // 企业名称
-                'user_info.hy_id',                  // 企业所属行业
-                'user_info.company_size',           // 公司规模
-                'user_info.company_nature',         // 公司性质
-                'user_info.introduction',           // 公司简介
-                'user_info.real_name',              // 企业联系人
-                'user.mobile',                      // 企业联系电话
-                'user_info.company_url',            // 企业网址
-                'user_info.address_arr_id',         // 企业地址
-                'user_info.address as address_info',                // 企业地址
-                'user.email',                       // 企业邮箱
-            )
-            ->first();
+        if($job['user_type'] == 3){
+            $result = JobRecruiting::where('job_recruiting.id', $data['id'])->first();
+            // 假设当前类实例为 $this
+            $jobCompanyData = $this->getJobCompany([
+                'user_id' => $data['user_id'],
+                'website_id' => $job['website_id']
+                // 假设 $data 是当前方法的参数数组
+            ]);
+            // ->leftJoin('user_info', 'job_recruiting.user_id', 'user_info.id')
+            // ->leftJoin('user', 'job_recruiting.user_id', 'user.id')
+            // ->select(
+            //     'job_recruiting.*',
+            //     'user_info.business_name',          // 企业名称
+            //     'user_info.hy_id',                  // 企业所属行业
+            //     'user_info.company_size',           // 公司规模
+            //     'user_info.company_nature',         // 公司性质
+            //     'user_info.introduction',           // 公司简介
+            //     'user_info.real_name',              // 企业联系人
+            //     'user.mobile',                      // 企业联系电话
+            //     'user_info.company_url',            // 企业网址
+            //     'user_info.address_arr_id',         // 企业地址
+            //     'user_info.address as address_info',                // 企业地址
+            //     'user.email',                       // 企业邮箱
+            // )
+            
         }else{
             $result = JobRecruiting::where('job_recruiting.id', $data['id'])
             ->leftJoin('job_company', 'job_recruiting.id', 'job_company.job_id')

+ 10 - 0
app/JsonRpc/NewsServiceInterface.php

@@ -220,4 +220,14 @@ interface NewsServiceInterface
      * @return array
      */
     public function getCompanyNature(array $data):array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getJobCompany(array $data):array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function upJobCompany(array $data):array;
 }