jobfairoutPersonalJobsApplyRepository = $jobfairoutPersonalJobsApplyRepository; $this->resumeRepository = $resumeRepository; } public function downResumeDel($request,$user) { $id = $request->y_id; if (!$id) { return response()->json(['status'=>0, 'msg'=>'请选择操作的项目!']); } if (!is_array($id)) { $ids = explode(',', $id); } else { $ids = $id; } $this->isComOwn($ids,$user); if ($this->jobfairoutPersonalJobsApplyRepository->downResumeDel($ids)) { return response()->json(['status'=>1,'msg'=>'简历删除成功!']); } return response()->json(['status'=>0,'msg'=>'简历删除失败!']); } public function personJobfair() { $data[] = ['personal_uid','=',auth('web-member')->user()->id]; if (request()->resume_id) { $data[] = ['resume_id','=',request()->resume_id]; } $interview = $this->jobfairoutPersonalJobsApplyRepository->personJobfair($data, getJobsStatus(), getResumeStatus()); return ['interview'=>$interview]; } public function personDelect($id, $user) { if (empty($id)) { throw new ResponseException('请选择预约职位!'); } $res = JobfairoutPersonalJobsApply::where(['personal_uid'=>$user->id])->get()->toArray(); $array_id = array_column($res,'id'); $arr_id = string_to_array(',', $id); foreach ($arr_id as $key=>$val){ if(!in_array($val,$array_id)){ throw new ResponseException('预约职位不存在!'); } } return $this->jobfairoutPersonalJobsApplyRepository->downResumeDel(string_to_array(',', $id)); } public function ifJobApply($user) { //判断是否有可以投递的简历 $resume_audit = config('aix.personal_set.per_set.show_set.resume_display'); $resume_where = array(array('uid', '=', $user->id)); if (config('aix.personal_set.per_set.show_set.resume_display') == '1') { $resume_where[] = array('audit', '=', '2'); } else { $resume_where[] = array('audit', '<>', '0'); } $resumes = $this->resumeRepository->getResumes($resume_where); if (count($resumes) == 0) { //判断是否有简历 $user_resumes = $this->resumeRepository->getResumes(array('uid' => $user->id)); if ($user_resumes->toArray()) { throw new ResponseException("您没有审核通过的简历!"); } else { throw new ResponseException("请您先填写一份简历!"); } } else if (count($resumes) == 1) { //直接进入投递环节 return ['status'=>3, 'resumes'=>$resumes]; } else { //获取默认简历信息 $def_resume = array(); foreach ($resumes as $k => $v) { if ($v->def == '1') { $def_resume = $v; } } if (!$def_resume) { $def_resume = $resumes[0]; } //提示用户选择需要投递的简历 return array('status' => 2, 'resumes' => $resumes, 'def_resume' => $def_resume); } } public function applyJob($data) { return $this->jobfairoutPersonalJobsApplyRepository->create($data); } //发送面试邀请 public function interview($request,$user){ $type = $request->input('type'); if($type == 2){ //直接修改状态 if(empty($request->input('apply_id'))){ return response()->json(array('status'=>0,'msg'=>'邀请失败')); } $ret = $this->jobfairoutPersonalJobsApplyRepository->interviewEdit($request->input('apply_id')); $msg2 = '邀请成功'; $msg3 = '邀请失败,请稍后重试'; }else{ if($type == 3 || $type == 5){ $data['jobs_id'] = $request->input('job_id'); $data['personal_uid'] = $request->input('personal_uid'); $data['company_id'] = $user->id; $data['position_id'] = session('floorplan_stands.id'); $data['jobfair_id'] = session('floorplan_stands.jobfair_id'); } $res = $this->jobfairoutPersonalJobsApplyRepository->applyFind($data); if ($type == 3){ $data['is_apply'] = 2; $msg = '您已对该简历进行过面试邀请,不能重复邀请'; $msg2 = '邀请成功'; $msg3 = '邀请失败,请稍后重试'; }elseif ($type == 5){ $data['is_apply'] = 1; $msg = '恭喜您已被面试邀请'; $msg1 = '您已投递该职位,不能重复投递'; $msg2 = '投递成功'; $msg3 = '投递失败,请稍后重试'; } if(!$res){ $data['resume_id'] = $request->input('resume_id'); $ret = $this->jobfairoutPersonalJobsApplyRepository->interviewAdd($data); }else{ if($res->is_apply == 2 || ($res->is_apply == 1 && $res->is_interview == 1)){ return response()->json(array('status'=>0,'msg'=>$msg)); }elseif($res->is_apply == 1 && $res->is_interview == 2){ if($type == 5){ return response()->json(array('status'=>0,'msg'=>$msg1)); }else{ $ret = $this->jobfairoutPersonalJobsApplyRepository->interviewEdit($res->id); } } } } if ($ret) { return response()->json(array('status'=>1,'msg'=>$msg2)); } else { return response()->json(array('status'=>0,'msg'=>$msg3)); } } public function getApplyJobs($where, $field = 'jobs_id') { $rst = $this->jobfairoutPersonalJobsApplyRepository->getJobsApply($where); $list = array(); if ($rst->toArray()) { foreach ($rst as $key => $val) { $list[$val->$field] = $val; } } return $list; } public function isOwn($id,$user) { $apply = $this->jobfairoutPersonalJobsApplyRepository->applyFind(['id'=>$id]); if(!$apply) { throw new ResponseException('参数错误!'); } if($apply->personal_uid != $user->id) { throw new ResponseException('抱歉,您只能操作自己的招聘会!'); } } //企业判断 public function isComOwn($idsArr,$user) { $allIdsArr = $this->jobfairoutPersonalJobsApplyRepository->getPluck(['company_id'=>$user->id],'id')->toArray(); if(array_diff($idsArr,$allIdsArr)) { throw new ResponseException('抱歉,您只能操作自己的招聘会数据!'); } } }