소스 검색

招聘功能1.0

15313670163 1 개월 전
부모
커밋
20762f548d
2개의 변경된 파일120개의 추가작업 그리고 10개의 파일을 삭제
  1. 70 10
      app/JsonRpc/NewsService.php
  2. 50 0
      app/JsonRpc/NewsServiceInterface.php

+ 70 - 10
app/JsonRpc/NewsService.php

@@ -1064,7 +1064,7 @@ class NewsService implements NewsServiceInterface
         if(empty($user)){
             return Result::error("用户不存在", 0);
         }
-        // 企业会员
+        //   3:企业会员
         if($user['type_id'] == 3){
             array_push($where,['user_id', $data['user_id']]);
         }
@@ -1087,9 +1087,18 @@ class NewsService implements NewsServiceInterface
     * */
     public function getJobRecruitingInfo(array $data): array
     {
-        $result = JobRecruiting::where('id', $data['id'])
-        ->leftJoin('user_info', 'job_recruiting.user_id', '=', 'user.id')
-        ->select('job_recruiting.*', 'user_info.*')
+        $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.address_arr_id',         // 企业地址
+            'user_info.address',                // 企业地址
+            'user.mobile',                      // 企业联系电话
+            'user_info.real_name',            // 企业联系人
+            // 'user_info.industry_name',          // 企业行业名称
+        )
         ->orderBy("updated_at", "desc")
         ->first();
         if (empty($result)) {
@@ -1102,7 +1111,23 @@ class NewsService implements NewsServiceInterface
     * */
     public function addJobRecruiting(array $data): array
     {
-        // return Result::success($data);
+        $user = User::where('id', $data['user_id'])->first();
+        if(empty($user)){
+            return Result::error("用户不存在", 0);
+        }
+        //   3:企业会员
+        if($user['type_id'] != 3){
+            if($data['website_id'] == 0){
+                return Result::error("请选择所属网站", 0);
+            }
+            $website = Website::where('id', $data['website_id'])->first();
+            if(empty($website)){
+                return Result::error("网站不存在", 0);
+            }
+            $data['website_id'] = $website['id'];
+        }
+        $data['cat_arr_id'] = array_values(array_unique($data['cat_arr_id']));
+        $data['city_arr_id'] = array_values(array_unique($data['city_arr_id']));
         $data['cat_arr_id'] = isset($data['cat_arr_id'])? json_encode($data['cat_arr_id']) : '';
         $data['city_arr_id'] = isset($data['city_arr_id'])? json_encode($data['city_arr_id']) : '';
         $result = JobRecruiting::insertGetId($data);
@@ -1115,8 +1140,35 @@ class NewsService implements NewsServiceInterface
     /*
     * 招聘信息更新
     * */
-    public function updateJobRecruiting(array $data): array
+    public function upJobRecruiting(array $data): array
     {
+        $job = JobRecruiting::where('id', $data['id'])->first();
+        if(empty($job)){
+            return Result::error("招聘信息不存在", 0);
+        }
+        $user = User::where('id', $data['user_id'])->first();
+        if(empty($user)){
+            return Result::error("用户不存在", 0);
+        }
+         //   3:企业会员
+         if($user['type_id'] != 3){
+            if($data['website_id'] == 0){
+                return Result::error("请选择所属网站", 0);
+            }
+            $website = Website::where('id', $data['website_id'])->first();
+            if(empty($website)){
+                return Result::error("网站不存在", 0);
+            }
+            $data['website_id'] = $website['id'];
+        }
+        $data['cat_arr_id'] = array_values(array_unique($data['cat_arr_id']));
+        $data['city_arr_id'] = array_values(array_unique($data['city_arr_id']));
+        $data['cat_arr_id'] = isset($data['cat_arr_id'])? json_encode($data['cat_arr_id']) : '';
+        $data['city_arr_id'] = isset($data['city_arr_id'])? json_encode($data['city_arr_id']) : '';
+        $result = JobRecruiting::where('id', $data['id'])->update($data);
+        if (empty($result)) {
+            return Result::error("更新失败", 0);   
+        }
         return Result::success($data);
     }
     /*
@@ -1124,6 +1176,14 @@ class NewsService implements NewsServiceInterface
     * */
     public function delJobRecruiting(array $data): array
     {
+        $job = JobRecruiting::where('id', $data['id'])->first();
+        if(empty($job)){
+            return Result::error("招聘信息不存在", 0);
+        }
+        $result = JobRecruiting::where('id',$data['id'])->delete();
+        if (empty($result)) {
+            return Result::error("删除失败", 0);
+        }
         return Result::success($data);   
     }
     /*
@@ -1172,12 +1232,12 @@ class NewsService implements NewsServiceInterface
     * */
     public function getJobNature(array $data): array
     {
-        $result = JobEnum::get('egroup','nature')->all();
+        $result = JobEnum::where('egroup','nature')->get()->all();
         if (empty($result)) {
             return Result::error("暂无工作性质", 0);
         }
         return Result::success($result);
-    }
+    } 
     /*
     * 获取工作经验-菜单
     * */
@@ -1248,9 +1308,9 @@ class NewsService implements NewsServiceInterface
     /*
     * 获取公司规模-菜单
     * */
-    public function getCompanyScale(array $data): array
+    public function getCompanySize(array $data): array
     {
-        $result = JobEnum::get('egroup','cosize')->all();
+        $result = JobEnum::where('egroup','cosize')->get()->all();
         if (empty($result)) {
             return Result::error("暂无公司规模", 0);
         }

+ 50 - 0
app/JsonRpc/NewsServiceInterface.php

@@ -155,6 +155,16 @@ interface NewsServiceInterface
      * @return array
      */
     public function addJobRecruiting(array $data):array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function upJobRecruiting(array $data):array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function delJobRecruiting(array $data):array;
      /**
      * @param array $data
      * @return array
@@ -170,4 +180,44 @@ interface NewsServiceInterface
      * @return array
      */
     public function getPositionList(array $data):array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getJobNature(array $data):array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getExperience(array $data):array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getEducation(array $data):array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getSalary(array $data):array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getLanguage(array $data):array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getLevel(array $data):array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getCompanySize(array $data):array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getCompanyNature(array $data):array;
 }