searchService = $searchService;
$this->resumeService = $resumeService;
$this->membersSetmealService = $membersSetmealService;
$this->jobsService = $jobsService;
$this->companyDownResumeService = $companyDownResumeService;
$this->setmealIncrementsService = $setmealIncrementsService;
$this->feedbackService = $feedbackService;
$this->personalJobsApplyService = $personalJobsApplyService;
$this->jobsfairPutJobService = $jobsfairPutJobService;
$this->companyService = $companyService;
}
public function index(Request $request){
$order_by = array('stime'=>'desc', 'updated_at'=>'desc');
if (config('aix.personal_set.per_set.show_set.resume_display')=='1') {
$where[] = array('audit','=','2');
} else {
$where[] = array('audit','<>','0');
}
$where[] = array('display','=',1);
$where[] = array('subsite_ids','=',get_subsite_id());
$list = $this->searchService->search('Resume',$where,$order_by);
if ($list->total()>0) {
$list_items = $this->resumeService->dealResumeFields($list->items());
} else {
$list_items = array();
}
return view('app.hardware.pad.search_resume_index',['list_items'=>$list_items,'list'=>$list]);
}
/**
* @param $id
* @param Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @throws \App\Exceptions\ResponseException
*/
public function show($id,Request $request){
/**
* type:
* 1:正常流程,判断是否可以下载、邀请面试
* 2:直接邀请,不判断是否下载(已收到简历跳转)
* 3:直接邀请,不判断是否下载(面试邀请跳转)
* 4:只显示详情,不给任何操作
* 5:直接邀请,不判断是否下载(已收到简历跳转)
*/
$type = $request->input('type');
$apply_id = $request->input('apply_id','');
$res = $this->resumeService->padResumeShow($id,$type, '', $this->getUser());
$this->putSeoData('resume', $res['resume']);
//获取企业在招职位
$user = auth('web-company')->user();
$job_where = array(
array('display','=',1),
array('company_id','=',$user->id),
);
if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
$job_where[] = array('audit','=',1);
} else {
$job_where[] = array('audit','<>',3);
}
$job_where[] = array('jobfair_id','=',session('floorplan_stands.jobfair_id'));
$where1 = ['position_id'=>session('floorplan_stands.id')];
$jobs = $this->jobsfairPutJobService->jobfairCompany($job_where,$user,$where1);
$html = '';
if($type == 3 || $type == 5){
foreach ($jobs as $val){
$html .= "";
}
}
return view('app.hardware.pad.search_resume_show', ['content'=>$res,'resume'=>$res['resume'],'type'=>$type,'html'=>$html,'apply_id'=>$apply_id]);
}
public function search(Request $request){
$order_by = array('stime'=>'desc', 'updated_at'=>'desc');
if (config('aix.personal_set.per_set.show_set.resume_display')=='1') {
$where[] = array('audit','=','2');
} else {
$where[] = array('audit','<>','0');
}
$where[] = array('display','=',1);
$where[] = array('subsite_ids','=',get_subsite_id());
$list = $this->searchService->search('Resume', $where, $order_by, $request->input('key'));
if ($list->total()>0) {
$list_items = $this->resumeService->dealResumeFields($list->items());
} else {
$list_items = array();
}
return view('app.hardware.pad.search_resume_index',['list_items'=>$list_items,'list'=>$list]);
}
/**
* @param Request $request
* @return \Illuminate\Http\JsonResponse
* @throws \Throwable
* 下载简历
*/
public function resumeDown(Request $request){
$resume_id = $request->input('rid');
if (!$resume_id) {
return response()->json(['status'=>0, 'msg'=>'请选择简历!']);
}
$rid = is_array($resume_id)?$resume_id:explode(",", $resume_id);
$resume_num =count($rid);
$user = auth('web-company')->user();
$member_setmeal = $this->membersSetmealService->getUserSetmeal($user, '1');
if ($request->method() == 'POST') {
$addarr['rid'] = $rid;
$rst = $this->companyDownResumeService->addDownResume($addarr, $user, $member_setmeal);
if (array_get($rst, 'status')==1) {
if ($resume_num == 1) {
if ($member_setmeal->download_resume > 0) {
$this->membersSetmealService->actionUserSetmeal($user->id, 'download_resume', 2); //修改会员套餐信息中的下载简历数量
$log_value = '下载简历【'.array_get($rst, 'msg')->resume_name.'】(简历id:'.$addarr['rid'][0].'),消耗简历下载数:1,套餐剩余:'.($member_setmeal->download_resume-1);
}
//添加会员日志
$member_log = array(
'uid' =>$user->id,
'utype' =>1,
'username' => $user->username,
'ip' => ip2long($request->getClientIp()),
'log_address'=>'本机地址'
);
$this->feedbackService->addMembersLog($member_log, '1012', $log_value);
}
}
return response()->json($rst);
} else {
//判断是否开通会员服务
if (!$member_setmeal) {
return response()->json(['status'=>0, 'msg'=>'您还没有开通服务,请开通!']);
}
//判断服务是否到期
if ($member_setmeal->expire == 1) {
return response()->json(['status'=>0, 'msg'=>'您的服务已经到期,请重新开通!']);
}
//后台简历下载设置判断
if (config('aix.personal_set.per_set.resume_download_set.down_resume_limit') == 1) {
//判断企业是否有通过审核的职位(已登录且有发布职位的企业)
$jobs_num = $this->jobsService->getAuditJobsNum($user->id);
if ($jobs_num==0) {
return response()->json(['status'=>0, 'msg'=>'你没有发布职位或职位审核未通过导致无法下载简历!']);
}
} elseif (config('aix.personal_set.per_set.resume_download_set.down_resume_limit') == 3) {
//判断是否是认证企业(已认证企业)
$company_info = $this->companyService->getInfoById($user);
if ($company_info && $company_info->audit != 1) {
return response()->json(['status'=>0, 'msg'=>'你的营业执照未通过认证导致无法下载简历!']);
}
}
if ($member_setmeal->download_resume_max > 0) { //判断当天简历下载数量是否已达上限
$downwhere = array(
array('down_addtime','>=',strtotime('today')),
array('down_addtime','<',strtotime('tomorrow')),
array('company_uid','=',$user->id)
);
$downnum = $this->companyDownResumeService->getCompanyDownResumeNum($downwhere); //获取当天企业已下载简历数
if ($resume_num>1 && $resume_num+$downnum > $member_setmeal->download_resume_max && $downnum < $member_setmeal->download_resume_max) {
return response()->json(['status'=>0, 'msg'=>'您今天剩余的下载简历数量不足,请选择单个简历下载!']);
} elseif ($downnum>= $member_setmeal->download_resume_max) {
return response()->json(['status'=>0, 'msg'=>'您今天已下载 '.$downnum.' 份简历,已达到每天下载上限,请先收藏该简历,明天继续下载。']);
}
}
$mode = 'setmeal';
if ($member_setmeal->download_resume == 0) { //套餐中简历下载数已用完
return response()->json(['status'=>0, 'msg'=>'您套餐中剩余的下载简历数量不足,请升级套餐后继续下载!']);
}
$view_data = array();
$free_time = $member_setmeal->download_resume;
$view_data['free_time'] = $free_time;
$view_data['resume_num'] = $resume_num;
$view_data['resume_id'] = implode(",", $rid);
$view_data['uid'] = $user->id;
$view_data['is_free'] = $member_setmeal->is_free;
$view_data['my_setmeal'] = $member_setmeal;
$view_data['to_detail'] = $request->input('to_detail', '');
$max_discount = $this->setmealIncrementsService->getMaxDiscount('download_resume');
$view_data['max_discount'] = $max_discount?$max_discount:0;
$view_data['mode'] = $mode;
$html = view('mobile.app.content.resume.ajax_resume_download', $view_data)->render();
$return_data = array( 'status'=>1, 'html' => $html,'params'=>$view_data);
return response()->json($return_data);
}
}
//面试邀请页面
public function interview(Request $request)
{
$resume_id = $request->input('id', '');
$type= $request->input('type');
$back_url = \Illuminate\Support\Facades\URL::previous();
if (!$resume_id) {
return $this->showMessage('请选择简历!', $back_url, true, '上一页', '3');
}
$user = $this->getUser();
if (!$user) {
return redirect()->route('mobile.login.company');
}
//判断是否需要下载简历(已下载或者简历公开)
if (config('aix.personal_set.per_set.contact_set.show_resume_contact_wap') ==1) {
if (!$user) {
return redirect()->route('hardware.pad.login');
}
} elseif (config('aix.personal_set.per_set.contact_set.show_resume_contact_wap') ==2) {
if($type == 1){
//判断是否有下载记录
$down_where = array(
'resume_id' => $resume_id,
'company_uid' => $user->id
);
$down_info = $this->companyDownResumeService->getDownResume($down_where);
if (!$down_info) {
return $this->notFount('请先下载简历!');
}
}
}
//获取企业在招职位
$job_where = array(
array('display','=',1),
array('company_id','=',$user->id),
);
if (config('aix.companyset.comset.show_set.jobs_display') == 1) {
$job_where[] = array('audit','=',1);
} else {
$job_where[] = array('audit','<>',3);
}
$where[] = array('jobfair_id','=',session('floorplan_stands.jobfair_id'));
$where[] = array('position_id','=',session('floorplan_stands.id'));
$jobs = $this->jobsService->getAuditJobs($user->id);
if ($jobs->isEmpty()) {
return $this->notFount('您还没有发布招职位或者职位未通过审核!');
}
//获取简历信息
$resume_info = $this->resumeService->getResumeAllInfo($resume_id);
//获取申请记录
$apply = $this->resumeService->getPersonApply(['resume_id'=>$resume_id,'company_id'=>$user->id]);
$is_apply = 0;
$default_jobs = array();
if ($apply->isNotEmpty()) {
$is_apply = 1;
$apply_info = $apply[0];
$default_jobs = array(
'jobs_id' => $apply_info->jobs_id,
'jobs_name' => $apply_info->jobs_name
);
}
$return_data = array(
'resume' => $resume_info,
'jobs' => $jobs,
'company' => $user,
'is_apply' => $is_apply,
'default_jobs' => $default_jobs,
'wap_title' => '发送面试邀请',
'type' => $type
);
return view('app.hardware.pad.resume_interview', $return_data);
}
//保存邀请
public function jobsInterview(Request $request)
{
$user = auth('web-company')->user();
return $this->personalJobsApplyService->padSaveApply($request,$user);
}
public function getUser()
{
$user = array();
if (auth('web-member')->check()) {
$user = auth('web-member')->user();
} elseif (auth('web-company')->check()) {
$user = auth('web-company')->user();
}
return $user;
}
}