Explorar el Código

添加招聘查找bug

15313670163 hace 5 meses
padre
commit
06f8ab6ebc
Se han modificado 1 ficheros con 110 adiciones y 110 borrados
  1. 110 110
      app/JsonRpc/NewsService.php

+ 110 - 110
app/JsonRpc/NewsService.php

@@ -1112,118 +1112,118 @@ class NewsService implements NewsServiceInterface
     public function addJobRecruiting(array $data): array
     {
         var_dump('添加招聘进入news------data',$data);
-        // return Result::success($data);
-        $user = User::where('user.id', $data['user_id'])
-        ->where('user.status',1)
-        ->leftJoin('user_info', 'user_info.user_id', 'user.id')
-        ->select(
-            'user.type_id', 'user.mobile','user.email',
-            'user_info.business_name',
-            'user_info.company_hy_id',
-            'user_info.company_nature',
-            'user_info.company_size',
-            'user_info.introduction',
-            'user_info.real_name',
-            'user_info.company_url',
-            'user_info.address_arr_id',
-            'user_info.address'
-        )
-        ->first();
-        if(empty($user) || $user['type_id'] != $data['user_type']){
-            return Result::error("用户不存在", 0);
-        }
-        $web = Website::where('id', $data['website_id'])->first();
-        if(empty($web)){
-            return Result::error("网站不存在", 0);
-        }
-        var_dump('添加招聘进入news---user---user',$user);
-        // return Result::success($user);
-        $data['action_id'] = $data['user_id'] ?? null;
-        $data['user_type'] = $user['type_id'] ?? null;
-        $data['cat_arr_id'] = isset($data['cat_arr_id']) && !empty($data['cat_arr_id']) ? array_values(array_unique($data['cat_arr_id'])) : null;
-        $data['city_arr_id'] = isset($data['city_arr_id']) && !empty($data['city_arr_id']) ? array_values(array_unique($data['city_arr_id'])) : null;
-        $data['cat_arr_id'] = isset($data['cat_arr_id']) && !empty($data['cat_arr_id']) ? json_encode(array_map('intval', $data['cat_arr_id'])) : null;
-        $data['city_arr_id'] = isset($data['city_arr_id']) && !empty($data['city_arr_id']) ? json_encode(array_map('intval', $data['city_arr_id'])) : null;
-         // 公司地址 管理员必填
-        $data['address_arr_id'] = isset($data['address_arr_id']) && !empty($data['address_arr_id']) ? array_values(array_unique($data['address_arr_id'])) : null;
-        $data['address_arr_id'] = isset($data['address_arr_id']) && !empty($data['address_arr_id']) ? json_encode(array_map('intval', $data['address_arr_id'])) : null;
-        // 管理员-企业相关信息
-        $company = [
-            // 'user_id' => $data['user_id']?? null,
-            'business_name' => isset($data['business_name']) && $data['business_name'] !== '' ? $data['business_name'] : null,
-            'company_hy_id' => isset($data['company_hy_id']) && $data['company_hy_id'] !== '' ? $data['company_hy_id'] : null,
-            'company_size' => isset($data['company_size']) && $data['company_size'] !== '' ? $data['company_size'] : null,
-            'company_nature' => isset($data['company_nature']) && $data['company_nature'] !== '' ? $data['company_nature'] : null,
-            'introduction' => isset($data['introduction']) && $data['introduction'] !== '' ? $data['introduction'] : null,
-            'real_name' => isset($data['real_name']) && $data['real_name'] !== '' ? $data['real_name'] : null,
-            'mobile' => isset($data['mobile']) && $data['mobile'] !== '' ? $data['mobile'] : null,
-            'company_url' => isset($data['company_url']) && $data['company_url'] !== '' ? $data['company_url'] : null,
-            'address_arr_id' => isset($data['address_arr_id']) && $data['address_arr_id'] !== '' ? $data['address_arr_id'] : null,
-            'address' => isset($data['address']) && $data['address'] !== '' ? $data['address'] : null,
-            'email' => isset($data['email']) && $data['email'] !== '' ? $data['email'] : null,
-        ];    
-        //去掉相关企业信息
-        $job = array_diff_key($data, array_flip(array_keys($company)));
-        var_dump('添加招聘进入news---job---user',$job);
-        Db::beginTransaction();
-        try {
-        //     // 先添加职位相关信息
-            if($user['type_id'] == 10000){
-               $job['status'] = 1;  
-            }
-            $job['experience'] = isset($data['experience']) && $data['experience'] !== '' ? $data['experience'] : null;
-            $job['salary'] = isset($data['salary']) && $data['salary'] !== '' ? $data['salary'] : null;
-            $job['number'] = isset($data['number']) && $data['number'] !== '' ? $data['number'] : null;
-            $job['language'] = isset($data['language']) && $data['language'] !== '' ? $data['language'] : null;
-            $job['level'] = isset($data['level']) && $data['level'] !== '' ? $data['level'] : null;
-            $job['job_level'] = isset($data['job_level']) && $data['job_level'] !== '' ? $data['job_level'] : null;
-            $job['educational'] = isset($data['educational']) && $data['educational'] !== '' ? $data['educational'] : null;
+        return Result::success($data);
+        // $user = User::where('user.id', $data['user_id'])
+        // ->where('user.status',1)
+        // ->leftJoin('user_info', 'user_info.user_id', 'user.id')
+        // ->select(
+        //     'user.type_id', 'user.mobile','user.email',
+        //     'user_info.business_name',
+        //     'user_info.company_hy_id',
+        //     'user_info.company_nature',
+        //     'user_info.company_size',
+        //     'user_info.introduction',
+        //     'user_info.real_name',
+        //     'user_info.company_url',
+        //     'user_info.address_arr_id',
+        //     'user_info.address'
+        // )
+        // ->first();
+        // if(empty($user) || $user['type_id'] != $data['user_type']){
+        //     return Result::error("用户不存在", 0);
+        // }
+        // $web = Website::where('id', $data['website_id'])->first();
+        // if(empty($web)){
+        //     return Result::error("网站不存在", 0);
+        // }
+        // var_dump('添加招聘进入news---user---user',$user);
+        // // return Result::success($user);
+        // $data['action_id'] = $data['user_id'] ?? null;
+        // $data['user_type'] = $user['type_id'] ?? null;
+        // $data['cat_arr_id'] = isset($data['cat_arr_id']) && !empty($data['cat_arr_id']) ? array_values(array_unique($data['cat_arr_id'])) : null;
+        // $data['city_arr_id'] = isset($data['city_arr_id']) && !empty($data['city_arr_id']) ? array_values(array_unique($data['city_arr_id'])) : null;
+        // $data['cat_arr_id'] = isset($data['cat_arr_id']) && !empty($data['cat_arr_id']) ? json_encode(array_map('intval', $data['cat_arr_id'])) : null;
+        // $data['city_arr_id'] = isset($data['city_arr_id']) && !empty($data['city_arr_id']) ? json_encode(array_map('intval', $data['city_arr_id'])) : null;
+        //  // 公司地址 管理员必填
+        // $data['address_arr_id'] = isset($data['address_arr_id']) && !empty($data['address_arr_id']) ? array_values(array_unique($data['address_arr_id'])) : null;
+        // $data['address_arr_id'] = isset($data['address_arr_id']) && !empty($data['address_arr_id']) ? json_encode(array_map('intval', $data['address_arr_id'])) : null;
+        // // 管理员-企业相关信息
+        // $company = [
+        //     // 'user_id' => $data['user_id']?? null,
+        //     'business_name' => isset($data['business_name']) && $data['business_name'] !== '' ? $data['business_name'] : null,
+        //     'company_hy_id' => isset($data['company_hy_id']) && $data['company_hy_id'] !== '' ? $data['company_hy_id'] : null,
+        //     'company_size' => isset($data['company_size']) && $data['company_size'] !== '' ? $data['company_size'] : null,
+        //     'company_nature' => isset($data['company_nature']) && $data['company_nature'] !== '' ? $data['company_nature'] : null,
+        //     'introduction' => isset($data['introduction']) && $data['introduction'] !== '' ? $data['introduction'] : null,
+        //     'real_name' => isset($data['real_name']) && $data['real_name'] !== '' ? $data['real_name'] : null,
+        //     'mobile' => isset($data['mobile']) && $data['mobile'] !== '' ? $data['mobile'] : null,
+        //     'company_url' => isset($data['company_url']) && $data['company_url'] !== '' ? $data['company_url'] : null,
+        //     'address_arr_id' => isset($data['address_arr_id']) && $data['address_arr_id'] !== '' ? $data['address_arr_id'] : null,
+        //     'address' => isset($data['address']) && $data['address'] !== '' ? $data['address'] : null,
+        //     'email' => isset($data['email']) && $data['email'] !== '' ? $data['email'] : null,
+        // ];    
+        // //去掉相关企业信息
+        // $job = array_diff_key($data, array_flip(array_keys($company)));
+        // var_dump('添加招聘进入news---job---user',$job);
+        // Db::beginTransaction();
+        // try {
+        // //     // 先添加职位相关信息
+        //     if($user['type_id'] == 10000){
+        //        $job['status'] = 1;  
+        //     }
+        //     $job['experience'] = isset($data['experience']) && $data['experience'] !== '' ? $data['experience'] : null;
+        //     $job['salary'] = isset($data['salary']) && $data['salary'] !== '' ? $data['salary'] : null;
+        //     $job['number'] = isset($data['number']) && $data['number'] !== '' ? $data['number'] : null;
+        //     $job['language'] = isset($data['language']) && $data['language'] !== '' ? $data['language'] : null;
+        //     $job['level'] = isset($data['level']) && $data['level'] !== '' ? $data['level'] : null;
+        //     $job['job_level'] = isset($data['job_level']) && $data['job_level'] !== '' ? $data['job_level'] : null;
+        //     $job['educational'] = isset($data['educational']) && $data['educational'] !== '' ? $data['educational'] : null;
             
-            // return Result::success($job);
-            $jobId = JobRecruiting::insertGetId($job);
-            if (empty($jobId)) {
-                // Db::rollBack();
-                return Result::error("添加失败");
-            }
+        //     // return Result::success($job);
+        //     $jobId = JobRecruiting::insertGetId($job);
+        //     if (empty($jobId)) {
+        //         // Db::rollBack();
+        //         return Result::error("添加失败");
+        //     }
             
-            // 添加公司信息
-            $company['user_id'] = $data['user_id'] ?? null;
-            $company['job_id'] = $jobId;
-            $company['user_type'] = $user['type_id'] ?? null;
-            $company['website_id'] = $data['website_id'] ?? null;
-            if($user['type_id'] == 10000){
-                // 管理员添加企业信息
-               $companyId = JobCompany::insertGetId($company);
-               if (empty($companyId)) {
-                   Db::rollBack();
-                   return Result::error("添加失败");
-               }
-           }else{
-                // 企业会员添加企业信息   
-                $company['user_id'] = isset($data['user_id']) && $data['user_id'] !== '' ? $data['user_id'] : null;
-                $company['website_id'] = isset($data['website_id']) && $data['website_id'] !== '' ? $data['website_id'] : null;
-                $company['user_type'] = isset($data['user_type']) && $data['user_type'] !== '' ? $data['user_type'] : null;
-                $company['job_id'] = $jobId;
-                $companyId = JobCompany::insertGetId($company);
-                if (empty($companyId)) {
-                    // Db::rollBack();
-                    return Result::error("添加失败");
-                }
-           }
-            Db::commit();
-            $result = [
-                'job_id' => $jobId,
-                'company_id' => $companyId,
-            ];
-            if (empty($result)) {
-                return Result::error("添加失败", 0);
-            }
-            return Result::success($result);
-        } catch (\Exception $e) {
-            Db::rollBack();
-            return Result::error($e->getMessage(), 0);
-        }
-        return Result::success($result);
+        //     // 添加公司信息
+        //     $company['user_id'] = $data['user_id'] ?? null;
+        //     $company['job_id'] = $jobId;
+        //     $company['user_type'] = $user['type_id'] ?? null;
+        //     $company['website_id'] = $data['website_id'] ?? null;
+        //     if($user['type_id'] == 10000){
+        //         // 管理员添加企业信息
+        //        $companyId = JobCompany::insertGetId($company);
+        //        if (empty($companyId)) {
+        //            Db::rollBack();
+        //            return Result::error("添加失败");
+        //        }
+        //    }else{
+        //         // 企业会员添加企业信息   
+        //         $company['user_id'] = isset($data['user_id']) && $data['user_id'] !== '' ? $data['user_id'] : null;
+        //         $company['website_id'] = isset($data['website_id']) && $data['website_id'] !== '' ? $data['website_id'] : null;
+        //         $company['user_type'] = isset($data['user_type']) && $data['user_type'] !== '' ? $data['user_type'] : null;
+        //         $company['job_id'] = $jobId;
+        //         $companyId = JobCompany::insertGetId($company);
+        //         if (empty($companyId)) {
+        //             // Db::rollBack();
+        //             return Result::error("添加失败");
+        //         }
+        //    }
+        //     Db::commit();
+        //     $result = [
+        //         'job_id' => $jobId,
+        //         'company_id' => $companyId,
+        //     ];
+        //     if (empty($result)) {
+        //         return Result::error("添加失败", 0);
+        //     }
+        //     return Result::success($result);
+        // } catch (\Exception $e) {
+        //     Db::rollBack();
+        //     return Result::error($e->getMessage(), 0);
+        // }
+        // return Result::success($result);
     }
      /*
     * 获取招聘信息详情