ソースを参照

b端获取我的沟通列表

15313670163 3 日 前
コミット
8a51c4f46e
3 ファイル変更189 行追加0 行削除
  1. 157 0
      app/JsonRpc/NewsService.php
  2. 5 0
      app/JsonRpc/NewsServiceInterface.php
  3. 27 0
      app/Model/JobHunting.php

+ 157 - 0
app/JsonRpc/NewsService.php

@@ -31,6 +31,7 @@ use Hyperf\Utils\Random;
 
 use function Hyperf\Support\retry;
 use App\Model\JobResume;
+use App\Model\JobHunting;
 #[RpcService(name: "NewsService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
 class NewsService implements NewsServiceInterface
 {
@@ -1722,5 +1723,161 @@ class NewsService implements NewsServiceInterface
         }   
         return Result::success($recruiting);
     }
+    /*
+    * 获取企业会员-我的沟通
+    * */
+    public function getJobResumeList(array $data): array
+    {
+        $user = User::where('id', $data['user_id'])->first();
+        if(empty($user) || ($user['type_id']!= 10000 && $user['type_id']!= 3)){
+            return Result::error("用户不存在", 0);
+        }
+        $where = [];
+        if(isset($data['salary']) && $data['salary']!=null){
+            $where['job_hunting.salary'] = $data['salary'];
+        }
+        if(isset($data['user_name']) && $data['user_name']!=null){
+            array_push($where, ['user.user_name', 'like', '%'. $data['user_name']. '%']);
+        }
+        $job = JobResume::when($user['type_id'] == 3, function ($query) use ($user) {
+            $query->where('job_resume.user_id', $user['id']);
+        })
+        ->when(!empty($where), function ($query) use ($where) {
+            $query->where($where);
+        })
+        ->leftJoin('job_hunting','job_hunting.id','job_resume.hunt_id')
+        ->leftJoin('job_recruiting','job_recruiting.id','job_resume.recruit_id')
+        ->leftJoin('user','user.id','job_resume.receiver_id')
+        ->select('job_resume.hunt_id','job_resume.recruit_id','job_hunting.id','job_hunting.salary','job_hunting.city_id','job_recruiting.jtzw_id','user.user_name');
+        $count = $job->count();
+        if($count == 0){
+            return Result::error("暂无沟通记录", 0);
+        }
+        $jobs = $job->offset(($data['page'] - 1) * $data['pageSize'])
+            ->limit($data['pageSize'])
+            ->get();
+        if (empty($jobs)) {
+            return Result::error("暂无沟通记录", 0);
+        }
+        $result['row'] = $this->processJob($jobs, '');
+        $result['count'] = $count;
+        return Result::success($result);
+    }
     // 20250306 招聘
+     // 封装处理由问题
+     function processJob($job, $data)
+     {
+         return $job->map(function ($job) use ($data) {
+             $category = $job->cat_arr_id ?? '';
+             $cityid = $job->city_arr_id ?? '';
+             $city = json_decode($cityid, true);
+             $pinyin = '';
+             $level = json_decode($category, true);
+             // 路由
+             if (!empty($level) && is_array($level)) {
+                 $pinyin = WebsiteCategory::whereIn('category_id', $level)
+                     ->where('website_id', $data['website_id']) // 添加网站ID条件 
+                     ->orderByRaw('FIELD(category_id, ' . implode(',', $level) . ')')
+                     ->get(['aLIas_pinyin'])
+                     ->pluck('aLIas_pinyin')
+                     ->implode('/');
+                 if (empty($pinyin)) {
+                     $pinyin = $pinyin->aLIas_pinyin ?? '';
+                 }
+                 $job->pinyin = $pinyin;
+             }
+             // 取职位城市-市??省
+             if (!empty($city) && is_array($city)) {
+                 if (isset($city[1]) && !empty($city[1])) {
+                     $city = District::where('id', $city[1])->first(['name']);
+                     $job->city_name = $city->name ?? '';
+                 } else if (isset($city[0]) && !empty($city[0])) {
+                     $city = District::where('id', $city[0])->first(['name']);
+                     $job->city_name = $city->name ?? '';
+                 } else {
+                     $job->city_name = '全国';
+                 }
+             }
+             // 取公司详细地址拼接
+             if (isset($job->address_arr_id) && !empty($job->address_arr_id)) {
+                 $address_id = json_decode($job->address_arr_id, true) ?? [];
+                 if (is_array($address_id) && !empty($address_id)) {
+                     $address = District::whereIn('id', $address_id)
+                         ->orderBy('level', 'asc')
+                         ->get(['name'])
+                         ->pluck('name')
+                         ->implode('');
+                     // $job->address_name = $address ?? '';
+                     $job->address_name = ($address ?? '') . ($job->address ?? '');
+                 }
+             }
+            //  获取简历地址最后一级
+            if(isset($job->city_id) &&!empty($job->city_id)){
+                $city_name = District::where('id', $job->city_id)->first(['name']);
+                $job->hunt_cityname = $city_name->name?? '';
+            }
+             // 取行业
+             if (!empty($job->hy_id) || !empty($job->industry) || !empty($job->company_hy_id)) {
+                 $hy_name = JobIndustry::when($job, function ($query) use ($job) {
+                     if (!empty($job->industry)) {
+                         $query->where('hyid', $job->industry);
+                     } else if (!empty($job->hy_id)) {
+                         $query->where('hyid', $job->hy_id);
+                     } else {
+                         $query->where('hyid', $job->company_hy_id);
+                     }
+                 })->first(['hyname']);
+                 $job->hy_name = $hy_name->hyname ?? '';
+             }
+             // 取职位
+             if ((isset($job->zw_id) && !empty($job->zw_id)) || (isset($job->job) && !empty($job->job))) {
+                 $zwid = $job->job ?? $job->zw_id;
+                 $zw_name = JobPosition::where('zwid', $zwid)->first(['zwname']);
+                 $job->zw_name = $zw_name->zwname ?? '';
+             }
+             // 取具体职位
+             if ((isset($job->jtzw_id) && !empty($job->jtzw_id)) || (isset($job->job_name_get) && !empty($job->job_name_get))) {
+                 $jtzwid = $job->job_name_get ?? $job->jtzw_id;
+                 $jtzw_name = JobPosition::where('zwid', $jtzwid)->first(['zwname']);
+                 $job->jtzw_name = $jtzw_name->zwname ?? '';
+             }
+             // 取工作经验
+             if (isset($job->experience) && !empty($job->experience)) {
+                 $experience = JobEnum::where('egroup', 'years')->where('evalue', $job->experience)->first(['ename']);
+                 $job->experience_name = $experience->ename ?? '';
+             }
+             // 取学历
+             if (isset($job->educational) && !empty($job->educational)) {
+                 $education = JobEnum::where('egroup', 'education')->where('evalue', $job->educational)->first(['ename']);
+                 $job->education_name = $education->ename ?? '';
+             }
+             // 语言
+             if (isset($job->language) && !empty($job->language)) {
+                 $language = JobEnum::where('egroup', 'language')->where('evalue', $job->language)->first(['ename']);
+                 $job->language_name = $language->ename ?? '';
+             }
+             // 薪资
+             if (isset($job->salary) && !empty($job->salary)) {
+                 $salary = JobEnum::where('egroup', 'income')->where('evalue', $job->salary)->first(['ename']);
+                 $job->salary_name = $salary->ename ?? '';
+             }
+             // 职位性质
+             if (isset($job->nature_id) && !empty($job->nature_id)) {
+                 $job_nature = JobEnum::where('egroup', 'nature')->where('evalue', $job->nature_id)->first(['ename']);
+                 $job->job_nature_name = $job_nature->ename ?? '';
+             }
+             // 公司规模
+             if (isset($job->company_size) && !empty($job->company_size)) {
+                 $company_size = JobEnum::where('egroup', 'cosize')->where('evalue', $job->company_size)->first(['ename']);
+                 $job->company_size_name = $company_size->ename ?? '';
+             }
+             // 公司性质
+             if (isset($job->company_nature) && !empty($job->company_nature)) {
+                 $company_nature = JobNature::where('id', $job->company_nature)->first(['nature_name']);
+                 $job->company_nature_name = $company_nature->nature_name ?? '';
+             }
+             // $job->pinyin = $pinyin;
+             return $job;
+         });
+     }
 }

+ 5 - 0
app/JsonRpc/NewsServiceInterface.php

@@ -245,4 +245,9 @@ interface NewsServiceInterface
      * @return array
      */
     public function getRecruitingInfo(array $data):array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getJobResumeList(array $data):array;
 }

+ 27 - 0
app/Model/JobHunting.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class JobHunting extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'job_hunting';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}