jobfairoutJobsService = $jobfairoutJobsService;
$this->jobfairoutCompanyRepository = $jobfairoutCompanyRepository;
$this->jobfairoutCompanyService = $jobfairoutCompanyService;
$this->jobfairoutService = $jobfairoutService;
$this->jobfairoutRepository = $jobfairoutRepository;
$this->jobfairoutPersonalJobsApplyRepository = $jobfairoutPersonalJobsApplyRepository;
$this->jobfairoutPersonalJopApplyService = $jobfairoutPersonalJopApplyService;
$this->resumeService = $resumeService;
$this->jobfairoutPutJobRepository = $jobfairoutPutJobRepository;
$this->resumeRepository = $resumeRepository;
$this->jobfairoutPutJobService = $jobfairoutPutJobService;
$this->companyRepository = $companyRepository;
$this->jobfairoutInfoRepository = $jobfairoutInfoRepository;
$this->jobfairJobRepository = $jobfairJobRepository;
$this->jobfairoutReserveRepository = $jobfairoutReserveRepository;
$this->jobfairoutReserveListRepository = $jobfairoutReserveListRepository;
$this->jobfairoutFeedbackRepository = $jobfairoutFeedbackRepository;
$this->companyService = $companyService;
$this->companyDownResumeService = $companyDownResumeService;
$this->jobfairoutReserveService = $jobfairoutReserveService;
}
/**近期招聘会
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function jobfairoutIndex()
{
$user = auth('web-company')->user();
$res = $this->jobfairoutService->jobfairIndex($user);
return view('app.jobfairout.company.index', $res);
}
/**定展记录
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function jobfairEnact()
{
$user = auth('web-company')->user();
$res = $this->jobfairoutCompanyService->jobfairEnact($user);
return view('app.jobfairout.company.jobfair_enact', $res);
}
/**招聘会职位库管理
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function jobfairoutJobsList()
{
$res = $this->jobfairoutJobsService->jobfairoutJobsList();
return view('app.jobfairout.company.jobfair_joblist', $res);
}
/**招聘会职位添加
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function jobfairoutJobsAdd()
{
$res = $this->jobfairoutJobsService->jobfairoutJobsAdd();
return view('app.jobfairout.company.jobfair_job_add', $res);
}
/**招聘会职位修改
* @param int $id
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function jobfairoutJobsEdit($id)
{
$user = auth('web-company')->user();
$res = $this->jobfairoutJobsService->jobfairoutJobsEdit($id, $user);
if (!$res) {
return $this->showMessage('参数错误', route('jobfairout.quarterslist'), true, '上一页');
}
return view('app.jobfairout.company.jobfair_job_add', $res);
}
/**招聘会职位删除
* @param Request $request
* @return \Illuminate\Http\JsonResponse
* @throws \Throwable
*/
public function jobfairoutJobsDel(Request $request)
{
if ($request->method() == 'POST') {
return $this->jobfairoutJobsService->jobfairoutJobsDel($request);
}
$tip = "被删除后将无法恢复,您确定要删除选中的职位吗?";
return response()->json(['status'=>1,'data'=>['html'=>view('app.company.ajax.ajax_warning', ['tip'=>$tip])->render()]]);
}
/**招聘会职位修改和添加
* @param Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function jobfairoutJobsSave(Request $request)
{
$user = auth('web-company')->user();
$data = $request->except(['_method', '_token']);
return $this->jobfairoutJobsService->jobsSave($data, $user);
}
/**职位添加到招聘会中
* @param Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View
* @throws \Throwable
*/
public function jobfairoutJobsToJobfair(Request $request)
{
$user = auth('web-company')->user();
if ($request->method() == 'POST') {
$jids = $request->y_id;
if (!$jids || !$request->exid_list) {
return $this->showMessage('请选择职位或加入的招聘会', route('jobfair.quarterslist'), true, '上一页');
}
$this->jobfairoutJobsService->isOwn($jids,$user);
$exidArr = explode(',', $request->exid_list);
$this->jobfairoutCompanyService->isOwnArr($exidArr,$user);
$res = $this->jobfairoutJobsService->jobfairoutJobsToJobfair($request);
if ($res['state']) {
return $this->showMessage('添加成功!'.$res['error'], route('jobfairout.quarterslist'), false, '上一页');
}
return $this->showMessage($res['msg'], route('jobfairout.quarterslist'), true, '上一页');
}
//公司参加的招聘会
$jobfairInfo = $this->jobfairoutCompanyRepository->getJobfair($user->id);
if ($jobfairInfo->isEmpty()) {
return response()->json(['status'=>0, 'msg'=>"您还没有参加招聘会或申请未通过审核,请点击右侧链接参加招聘会【点击参加】"]);
}
return response()->json(['status'=>1,'data'=>['html'=>view('app.jobfairout.ajax.ajax_jobfair_mod', ['jobfairInfo'=>$jobfairInfo])->render()]]);
}
/**参展职位
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function jobfairoutjob(Request $request)
{
$user = auth('web-company')->user();
$jobfairid = $request->jobfairid?$request->jobfairid:'';
$audit = $request->audit?$request->audit:'';
$map = [];
$map1['company_id'] = $user->id;
if ($audit) {
$map1['audit'] = $audit;
}
if ($jobfairid) {
$map['jobfair_id'] = $jobfairid;
}
$param_array = array('jobfairid','audit');
$params= array();
if ($request->all()) {
foreach ($request->all() as $k => $v) {
if (in_array($k, $param_array)) {
$params[$k] = $v;
}
}
}
$res = $this->jobfairoutPutJobService->jobfairoutPutJobsList($map,$map1);
$jobfairArr = $this->jobfairoutCompanyRepository->findWhere(['company_id'=>$user->id], ['jobfair_id']);
$jobfairList = [];
if ($jobfairArr) {
$list = $jobfairArr->toArray();
$jobfairList = $this->jobfairoutRepository->findWhereIn('id', $list, ['id','title'])->toArray();
}
$res['jobfairid'] = $jobfairid;
$res['audit'] = $audit;
$res['params'] = $params;
$res['jobfairList'] = array_column($jobfairList, 'title', 'id');
$res['audtiArr'] = [1=>'审核通过',2=>'待审核',3=>'审核未通过'];
return view('app.jobfairout.company.jobfair_job', $res);
}
public function jobfairPutJobsSave(Request $request)
{
$data = $request->except(['_token', 'method']);
$user = auth('web-company')->user();
return $this->jobfairoutPutJobService->jobfairoutPutJobsSave($data, $user);
}
public function jobfairjobdel(Request $request)
{
$id = $request->y_id?$request->y_id:0;
$ids = is_array($id)?$id:explode(',', $id);
if ($request->method() == 'POST') {
if (!$ids) {
return response()->json(['status'=>0,'html'=>'参数错误']);
}
return $this->jobfairoutPutJobService->jobfairPutJobsDel($ids);
}
$tip = "被删除后将无法恢复,您确定要删除选中的职位吗?";
return response()->json(['status'=>1,'data'=>['html'=>view('app.company.ajax.ajax_warning', ['tip'=>$tip])->render()]]);
}
/**收到的招聘会简历
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function downResume(Request $request)
{
$user = auth('web-company')->user();
$jobs_id = $request->input('jobs_id','');
$jobfair_id = $request->input('jobfair_id','');
$where = [];
$where1 = [];
$result['jobfairList'] = $this->jobfairoutCompanyService->jobfairList($user);
$result['jobs_name'] = '全部职位';
if($jobs_id)
{
$where1['job_id'] = $jobs_id;
$result['jobs_name'] = $this->jobfairJobRepository->find($jobs_id,['jobs_name'])->jobs_name;
}
$result['jobfair_name'] = '全部招聘会';
if($jobfair_id)
{
$where['jobfair_id'] = $jobfair_id;
$result['jobfair_name'] = $this->jobfairoutRepository->find($jobfair_id,['title'])->title;
}
$result['apply'] = $this->jobfairoutPersonalJobsApplyRepository->getResumeJobs($user->id,$where,$where1);
$whereJob = [
'company_id' => $user->id,
'audit' => 1,
'type' => 2,
];
$result['jobs'] = $this->jobfairJobRepository->getJobs($whereJob);
$params= array();
$param_array = array('jobs_id','jobfair_id');
if ($request->all()) {
foreach ($request->all() as $k => $v) {
if (in_array($k, $param_array)) {
$params[$k] = $v;
}
}
}
$result['params'] = $params;
return view('app.jobfairout.company.down_resume', $result);
}
public function downResumeDel(Request $request)
{
if ($request->method() == 'POST') {
$user = $this->getLoginUser();
return $this->jobfairoutPersonalJopApplyService->downResumeDel($request,$user);
}
$tip = "被删除后将无法恢复,您确定要删除选中的简历吗?";
return response()->json(['status'=>1,'data'=>['html'=>view('app.company.ajax.ajax_warning', ['tip'=>$tip])->render()]]);
}
/**招聘会详情
* @param int $id
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function jobfairoutShow($id = 0)
{
$back_url = \Illuminate\Support\Facades\URL::previous();
if (!$id) {
return $this->showMessage('参数错误!', $back_url, true, '上一页');
}
$user = auth('web-company')->user();
$res = $this->jobfairoutService->jobfairShow($id,$user);
if (!$res['status']) {
return $this->showMessage($res['msg'], $back_url, true, '上一页');
} else {
$res['jobfair']->sitename = Subsite::where('id',$res['jobfair']->subsite_id)->value('sitename');
if (array_has($res, 'jobfair')) {
$this->putSeoData('jobfair', $res['jobfair']);
}
return view('app.jobfairout.jobfair_show', $res);
}
}
/**招聘会企业
* @param Request $request
* @param int $id
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View
* @throws \Throwable
*/
public function jobfairoutShowCom(Request $request, $id = 0)
{
$back_url = \Illuminate\Support\Facades\URL::previous();
if (!$id) {
return $this->showMessage('参数错误!', $back_url, true, '上一页');
}
$user = auth('web-company')->user();
$res = $this->jobfairoutService->jobfairShowCom($request, $id,$user);
if ($request->ajax()) {
if ($res->isNotEmpty()) {
return response()->json(['status'=>1,'data'=>view('app.jobfairout.ajax.ajax_jobfair_com', ['jobfairCompany'=>$res])->render()]);
}
return response()->json(['status'=>0]);
}
if (!$res['status']) {
return $this->showMessage($res['msg'], $back_url, true, '上一页');
} else {
$res['jobfair']->sitename = Subsite::where('id',$res['jobfair']->subsite_id)->value('sitename');
$this->putSeoData('jobfair', $res['jobfair']);
return view('app.jobfairout.jobfair_com', $res);
}
}
/**招聘会职位详情
* @param $jobfair_id
* @param $job_id
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function jobfairoutShowJob($id)
{
$job = $this->jobfairoutService->jobfairShowJob($id);
if (!$job['status']) {
return $this->showMessage($job['msg'], route('jobfair'), true, '上一页');
} else {
$this->putSeoData('jobfair_job', $job['jobInfo']);
return view('app.jobfairout.jobfair_job', $job);
}
}
/**异步查询职位(废弃)
* @param Request $request
* @return \Illuminate\Http\JsonResponse
* @throws \Throwable
*/
// public function jobfairoutAjaxJobs(Request $request)
// {
// $keyinput = $request->keyinput?$request->keyinput:'';
// if (!$keyinput) {
// return response()->json(['status'=>0,'msg'=>"请输入要搜索的职位名称"]);
// }
// $jobfair_id = $request->jobfair_id?$request->jobfair_id:0;
// if (!$jobfair_id) {
// return response()->json(['status'=>0,'msg'=>"招聘会ID不正确"]);
// }
// $where = [
// 'jobfair_id'=>$jobfair_id,
// 'audit'=>1
// ];
// $res = $this->jobfairoutCompanyRepository->findJob($where);
//
// foreach ($res as $key => $val) {
// $jobfairPutJob = $this->jobfairoutPutJobRepository->searchJob($jobfair_id, $keyinput, $val->company_id, $val->id);
// if ($jobfairPutJob->isNotEmpty()) {
// $val->jobfairPutJob = $jobfairPutJob;
// } else {
// unset($res[$key]);
// }
// }
//
// if ($res->isEmpty()) {
// return response()->json(['status'=>0,'msg'=>"未查找到与【{$keyinput}】相似的职位或企业"]);
// }
// return response()->json(['status'=>1,'data'=>view('app.jobfairout.ajax.ajax_jobfair_com_jobs', ['jobfairCompany'=>$res])->render()]);
// }
public function jobfairoutAppointmentJobs(Request $request)
{
$user = $this->getLoginUser();
$jid = $request->jobsfair_job_id;
$jobfair_id = $request->jobfairid;
$company_id = $request->company_id;
$resume_id = $request->resume_id?$request->resume_id:0;
$jobfair = $this->jobfairoutRepository->find($jobfair_id);
if ($jobfair->isEmpty || $jobfair->holddate_end < time()) {
return response()->json(['status'=>0, 'html'=>"招聘会已停止"]);
}
if ($resume_id) {
$this->resumeService->isOwn($resume_id,$user);
$this->jobfairoutPutJobService->isOwn($jid,$company_id);
$data['resume_id'] = $resume_id;
$data['personal_uid'] = $user->id;
$data['jobs_id'] = $jid;
$data['company_id'] = $company_id;
$data['jobfair_id'] = $jobfair_id;
if (!$jid || !$company_id || !$jobfair_id ) {
return response()->json(['status'=>2,'type'=>3,'msg'=>'参数错误!']);
}
//简历完整度
$res_complete = $this->resumeRepository->find($resume_id, ['complete_percent']);
if ($res_complete->complete_percent < config('aix.personal_set.per_set.per_set.apply_job_min_percent')) {
return response()->json(['status'=>0,'html'=>'请完善简历后再预约职位','resume_id'=>$resume_id]);
}
if ($this->jobfairoutPersonalJobsApplyRepository->findWhere(['personal_uid'=>$user->id, 'jobs_id'=>$jid, 'company_id'=>$company_id, 'jobfair_id'=>$jobfair_id])->isNotEmpty()) {
return response()->json(['status'=>0, 'html'=>"您已预约该职位,请勿重复预约!"]);
}
DB::beginTransaction();
try {
$this->jobfairoutPersonalJopApplyService->applyJob($data);
$this->companyDownResumeService->addDownResumes($company_id,$resume_id);
DB::commit();
return response()->json(['status'=>1, 'html'=>"职位预约成功!"]);
} catch (\Exception $e) {
DB::rollback();
return response()->json(['status'=>0,'type'=>0 , 'html'=>"职位预约失败!"]);
}
} else {
if (!$jid || !$company_id || !$jobfair_id) {
return response()->json(['status'=>2,'type'=>3,'msg'=>'参数错误!']);
}
$result = $this->jobfairoutPersonalJopApplyService->ifJobApply($user);
if ($result['status'] == 2) { //返回结果,让用户选择简历投递
$page_data = array('status'=>array_get($result, 'status'),'resumes'=>array_get($result, 'resumes'),'def_resume'=>array_get($result, 'def_resume'),'jobs_id'=>$jid);
$page_data['company_id'] = $company_id;
$page_data['jobfair_id'] = $jobfair_id;
$page_data['jobs_id'] = $jid;
$html = view('app.jobfairout.ajax.ajax_apply', $page_data)->render();
return response()->json(['status'=>2,'html'=>$html]);
} elseif ($result['status'] == 3) { //直接投递
$this->jobfairoutPutJobService->isOwn($jid,$company_id);
$resume = $result['resumes'][0];
$data['resume_id'] = $resume->id;
$data['personal_uid'] = $user->id;
$data['jobs_id'] = $jid;
$data['company_id'] = $company_id;
$data['jobfair_id'] = $jobfair_id;
$res_complete = $this->resumeRepository->find($resume->id, ['complete_percent']);
if ($res_complete->complete_percent < config('aix.personal_set.per_set.per_set.apply_job_min_percent')) {
return response()->json(['status'=>0,'html'=>'请完善简历后再预约职位','resume_id'=>$resume->id]);
}
if ($this->jobfairoutPersonalJobsApplyRepository->findWhere(['resume_id'=>$resume->id, 'jobs_id'=>$jid, 'company_id'=>$company_id, 'jobfair_id'=>$jobfair_id])->isNotEmpty()) {
return response()->json(['status'=>0, 'html'=>"您已预约该职位,请勿重复预约!"]);
}
DB::beginTransaction();
try {
$this->jobfairoutPersonalJopApplyService->applyJob($data);
$this->companyDownResumeService->addDownResumes($company_id,$resume->id);
DB::commit();
return response()->json(['status'=>1, 'html'=>"职位预约成功!"]);
} catch (\Exception $e) {
DB::rollback();
return response()->json(['status'=>0,'type'=>0 , 'html'=>"职位预约失败!"]);
}
}
}
}
public function personJobfairout()
{
$resume = $this->resumeService->myResumeAjax(auth('web-member')->user());
$jobApply = $this->jobfairoutPersonalJopApplyService->personJobfair();
return view('app.jobfairout.person.job_apply', ['resume' => $resume, 'interview' => $jobApply['interview']]);
}
public function personDelectout()
{
if (request()->method()=='GET') {
$html = view('app.person.ajax.resume_delete', ['tpis'=>'删除后将无法恢复,您确定要删除选择的预约职位吗?'])->render();
return $this->sendSuccessResponse($html);
} else {
$user = auth('web-member')->user();
$this->jobfairoutPersonalJopApplyService->isOwn(request()->id,$user);
$res = $this->jobfairoutPersonalJopApplyService->personDelect(request()->id, auth('web-member')->user());
if ($res) {
return $this->sendSuccessResponse('删除成功!');
} else {
return $this->sendErrorResponse('删除失败!');
}
}
}
public function jobfairoutAppointmentSave(Request $request)
{
$user = $this->getLoginUser();
if (!$user) {
$jobfair_id = $request->jobfair_id?$request->jobfair_id:0;
return response()->json(['status'=>0, 'type'=>1, 'html'=>view('app.common.ajax.com_login', ['redirect_url'=>route('jobfairout.show.com', ['id'=>$jobfair_id])])->render(),'msg'=>'您还没有登录,请先登录再预约招聘会']);
}
if ($user->utype == 2) {
return response()->json(['status'=>0,'type'=>0,'msg'=>'个人会员不允许预定招聘会!']);
}
//企业是否通过认证
if ($user->audit!=1) {
return response()->json(['status'=>0,'type'=>0,'msg'=>'企业或营业执照未通过审核!']);
}
$jobfair_id = $request->jobfair_id?$request->jobfair_id:0;
if (!$jobfair_id || !$jobfairInfo = $this->jobfairoutRepository->findOne(['id'=>$jobfair_id])) {
return response()->json(['status'=>0,'msg'=>'查无此招聘会!']);
}
if ($this->jobfairoutCompanyRepository->findCom(['jobfair_id'=>$jobfair_id, 'company_id'=>$user->id,['audit','<>', 3]])) {
return response()->json(['status'=>0,'msg'=>'很抱歉,本次招聘会已经预定了,快去发布职位吧!']);
}
if($this->jobfairoutCompanyRepository->getComCount(['jobfair_id'=>$jobfair_id,['audit','<>', 3]]) >= $jobfairInfo->number){
return response()->json(['status'=>0,'msg'=>'很抱歉,已经没有本次招聘会空余展位了!']);
}
if ($request->method()=='POST') {
return $this->jobfairoutService->jobfairAppointmentSave($jobfairInfo, $user);
}
$msg ="
在线预定审核成功后将无法退订,是否继续.
";
return response()->json(['status'=>1,'msg'=>$msg]);
}
/**填写单位信息
* return \Illuminate\Http\JsonResponse
*/
public function ajaxCompanyinfo(Request $request)
{
if ($request->method() == 'POST') {
$user = $this->getLoginUser();
$exid = $request->input('exid', '');
$jobfair_id = $request->input('jobfair_id', '');
$this->jobfairoutCompanyService->isOwn($exid,$user);
$this->jobfairoutCompanyService->isOwnJobfair($exid,$jobfair_id);
$contact = $request->input('contact', '');
$phone = $request->input('phone', '');
$tel_first = $request->input('tel_first', '-');
$tel_next = $request->input('tel_next', '-');
$tel_last = $request->input('tel_last', '-');
$email = $request->input('email', '');
$qq = $request->input('qq', '');
$address = $request->input('address', '');
$intro = $request->input('intro', '');
$url = $request->input('url', '');
$fax = $request->input('fax', '');
$id = $request->input('id', '');
$is_speech = $request->input('is_speech', '');
if (!$contact) {
$return_data = array( 'status'=>0, 'msg' => '请输入联系人信息');
return response()->json($return_data);
}
if (!$email) {
$return_data = array( 'status'=>0, 'msg' => '请输入联系邮箱');
return response()->json($return_data);
}
if (!$address) {
$return_data = array( 'status'=>0, 'msg' => '请输入联系地址');
return response()->json($return_data);
}
$landline_tel = implode('-', [$tel_first?$tel_first:'',$tel_next?$tel_next:'',$tel_last?$tel_last:'']);
$set_data = array(
'jobfair_id' => $jobfair_id,
'exid' => $exid,
'company_id' => (int)auth('web-company')->user()->id,
'contact' => $contact,
'phone' => $phone,
'landline_tel' => $landline_tel,
'email' => $email,
'qq' => $qq,
'address' => $address,
'intro' => $intro,
'url' => $url,
'fax' => $fax,
'is_speech' => $is_speech,
);
if($id){
$rst = $this->jobfairoutInfoRepository->update($set_data,$id);
}else{
$rst = $this->jobfairoutInfoRepository->create($set_data);
}
if ($rst) {
$return_data = array('status'=>1, 'msg'=>'编辑成功');
} else {
$return_data = array('status'=>0, 'msg'=>'编辑失败');
}
return response()->json($return_data);
} else {
$jobfair_id = $request->input('jobfairout_id', '');
$exid = $request->input('exid', '');
if(!$jobfair_id || !$exid){
return response()->json([ 'status'=>0, 'msg' => '缺少参数!']);
}
$user = auth('web-company')->user();
$where = [
'jobfair_id'=>(int)$jobfair_id,
'company_id'=>$user->id
];
$companyInfo = $this->jobfairoutInfoRepository->getOneInfo($where);
if(!$companyInfo){
$companyInfo = $this->companyRepository->getCompanyInfoByID($user->id);
}else{
$companyInfo->edit = true;
}
$companyInfo->exid = $exid;
$companyInfo->jobfair_id = $jobfair_id;
$html = view('app.jobfairout.ajax.add_info', ['companyInfo'=>$companyInfo])->render();
$return_data = array( 'status'=>1, 'data' => $html);
return response()->json($return_data);
}
}
/**发布职位
* return \Illuminate\Http\JsonResponse
*/
public function ajaxComJobs(Request $request)
{
if ($request->method() == 'POST') {
$user = $this->getLoginUser();
$jobs_arr= $request->input('check_jobs_id', '');
$jobfair_id = $request->input('jobfair_id', '');
$exid = $request->input('exid', '');
$jobs = $this->jobfairJobRepository->getPluck(['company_id'=>$user->id,'type'=>2,'audit'=>1],'id')->toArray();
if(array_diff($jobs_arr,$jobs)) {
throw new ResponseException('参数错误!');
}
$this->jobfairoutCompanyService->isOwn($exid,$user);
//获取列表
$where = ['exid'=>$exid];
$ids = $this->jobfairoutPutJobRepository->getJobIds($where);
DB::beginTransaction();
try {
if($ids){
if($jobs_arr){
$add_array = array_diff($jobs_arr,$ids);
if($add_array)
{
$this->jobfairoutPutJobService->addData($add_array,$exid,$jobfair_id);
}
$del_array = array_diff($ids,$jobs_arr);
$this->jobfairoutPutJobRepository->destroyArr($del_array);
}else{
$where = [
'exid'=>$exid
];
$this->jobfairoutPutJobRepository->delList($where,$ids);
}
}else{
if($jobs_arr)
{
$this->jobfairoutPutJobService->addData($jobs_arr,$exid,$jobfair_id);
}else{
throw new \Exception('请选择职位添加');
}
}
DB::commit();
$return_data = array('status'=>1, 'msg'=>'编辑成功');
return response()->json($return_data);
} catch (\Exception $e) {
DB::rollback();
$return_data = array('status'=>0, 'msg'=>$e->getMessage());
return response()->json($return_data);
}
} else {
$user = auth('web-company')->user();
$jobfair_id = $request->input('jobfairout_id', '');
$exid = $request->input('exid', '');
$jobs = $this->jobfairJobRepository->getJobs(['company_id'=>$user->id,'type'=>2,'audit'=>1]);
if($jobs->isEmpty())
{
$return_data = array( 'status'=>2, 'msg' => '没有赴外招聘会职位,请先添加职位');
return response()->json($return_data);
}else{
$join_jobs = $this->jobfairoutPutJobRepository->getJobfairJob(['exid'=>$exid]);
$html = view('app.jobfairout.ajax.add_jobs', ['jobs'=>$jobs,'jobfair_id'=>$jobfair_id,'exid'=>$exid,'join_jobs'=>$join_jobs])->render();
$return_data = array( 'status'=>1, 'data' => $html);
return response()->json($return_data);
}
}
}
/**参加人员
* return \Illuminate\Http\JsonResponse
*/
public function ajaxPerson(Request $request)
{
if ($request->method() == 'POST') {
$user = auth('web-company')->user();
$jobfair_id = $request->input('jobfair_id', '');
$exid = $request->input('exid', '');
$this->jobfairoutCompanyService->isOwn($exid,$user);
$this->jobfairoutCompanyService->isOwnJobfair($exid,$jobfair_id);
$name= $request->input('name');
$sex= $request->input('sex');
$telephone = $request->input('telephone');
$post = $request->input('post');
$idcard = $request->input('idcard');
$gentuan = $request->input('gentuan');
$star = $request->input('star');
$intro = $request->input('intro');
if(!$name)
{
$return_data = array('status'=>0, 'msg'=>'请填写姓名');
return response()->json($return_data);
}
if(!$sex)
{
$return_data = array('status'=>0, 'msg'=>'请选择性别');
return response()->json($return_data);
}
if(!$telephone)
{
$return_data = array('status'=>0, 'msg'=>'请填写手机号码');
return response()->json($return_data);
}
if(!preg_match("/^1[3456789]\d{9}$/", $telephone)){
$return_data = array('status'=>0, 'msg'=>'请填写正确的手机号码');
return response()->json($return_data);
}
if(!$post)
{
$return_data = array('status'=>0, 'msg'=>'请填写职务');
return response()->json($return_data);
}
if(!$idcard)
{
$return_data = array('status'=>0, 'msg'=>'请填写身份证号码');
return response()->json($return_data);
}
if(!isCreditNo($idcard)){
$return_data = array('status'=>0, 'msg'=>'请填写正确的身份证号码');
return response()->json($return_data);
}
$reserve_list_data = [
'name'=>$name,
'telephone'=>$telephone,
'post'=>$post,
'idcard'=>$idcard,
'sex'=>$sex,
'company_id'=>$user->id
];
$reserve_data = [
'jobfair_id'=>$jobfair_id,
'company_id'=>$user->id,
'exid'=>$exid,
'name1'=>$name,
'id1'=>$idcard,
'phone1'=>$telephone,
'sex1'=>$sex,
'departmental_position1'=>$post,
'gentuan'=>$gentuan,
'star'=>$star,
'intro'=>$intro,
];
DB::beginTransaction();
try {
if(!$this->jobfairoutReserveListRepository->getOne(['idcard'=>$idcard,'company_id'=>$user->id])){
$this->jobfairoutReserveListRepository->create($reserve_list_data);
}
$this->jobfairoutReserveRepository->create($reserve_data);
DB::commit();
$return_data = array('status'=>1, 'msg'=>'编辑成功');
return response()->json($return_data);
} catch (\Exception $e) {
DB::rollback();
$return_data = array('status'=>0, 'msg'=>$e->getMessage());
return response()->json($return_data);
}
} else {
$user = auth('web-company')->user();
$jobfair_id = $request->input('jobfairout_id', '');
$exid = $request->input('exid', '');
$reserve_list = $this->jobfairoutReserveListRepository->getReserveList(['company_id'=>$user->id]);
$reserve = $this->jobfairoutReserveRepository->getReserve(['exid'=>$exid]);
$html = view('app.jobfairout.ajax.add_person', ['reserve'=>$reserve,'reserve_list'=>$reserve_list,'jobfair_id'=>$jobfair_id,'exid'=>$exid])->render();
$return_data = array( 'status'=>1, 'data' => $html);
return response()->json($return_data);
}
}
public function ajaxPersonDel(Request $request)
{
$id = $request->id;
$user = $this->getLoginUser();
$this->jobfairoutReserveService->isOwn($id,$user);
if($this->jobfairoutReserveRepository->delete($id)){
$return_data = array( 'status'=>1, 'data' => '删除成功');
return response()->json($return_data);
}
$return_data = array( 'status'=>0, 'data' => '删除失败');
return response()->json($return_data);
}
public function ajaxPersonInfo(Request $request)
{
$id = $request->id;
if($data = $this->jobfairoutReserveListRepository->find($id)){
$return_data = array( 'status'=>1, 'data' => $data);
return response()->json($return_data);
}
$return_data = array( 'status'=>0, 'data' => '获取信息失败');
return response()->json($return_data);
}
/**反馈表
* return \Illuminate\Http\JsonResponse
*/
public function ajaxFeedback(Request $request)
{
if ($request->method() == 'POST') {
$user = auth('web-company')->user();
$jobfair_id = $request->input('jobfair_id', '');
$exid = $request->input('exid', '');
$this->jobfairoutCompanyService->isOwn($exid,$user);
$companyname = $request->input('companyname');
$phone = $request->input('phone');
$schoolname = $request->input('schoolname');
$resumeNum = $request->input('resumeNum');
$agreeNum = $request->input('agreeNum');
$signNum = $request->input('signNum');
$advice = $request->input('advice');
$id = $request->input('id');
if(!$companyname)
{
$return_data = array('status'=>0, 'msg'=>'请填写公司名称');
return response()->json($return_data);
}
if(!$phone)
{
$return_data = array('status'=>0, 'msg'=>'请填写联系电话');
return response()->json($return_data);
}
if(!preg_match("/^1[3456789]\d{9}$/", $phone)){
$return_data = array('status'=>0, 'msg'=>'请填写正确的联系电话');
return response()->json($return_data);
}
if(!$schoolname)
{
$return_data = array('status'=>0, 'msg'=>'请填写学校姓名');
return response()->json($return_data);
}
$feedback_data = [
'jobfair_id'=>$jobfair_id,
'exid'=>$exid,
'companyname'=>$companyname,
'phone'=>$phone,
'schoolname'=>$schoolname,
'advice'=>$advice,
'resumeNum'=>implode(',',$resumeNum),
'agreeNum'=>implode(',',$agreeNum),
'signNum'=>implode(',',$signNum),
'company_id'=>$user->id
];
DB::beginTransaction();
try {
if($id){
$this->jobfairoutFeedbackRepository->update($feedback_data,$id);
}else{
$this->jobfairoutFeedbackRepository->create($feedback_data);
}
DB::commit();
$return_data = array('status'=>1, 'msg'=>'保存成功');
return response()->json($return_data);
} catch (\Exception $e) {
DB::rollback();
$return_data = array('status'=>0, 'msg'=>$e->getMessage());
return response()->json($return_data);
}
} else {
$user = auth('web-company')->user();
$jobfair_id = $request->input('jobfairout_id', '');
$exid = $request->input('exid', '');
$feedback = $this->jobfairoutFeedbackRepository->getOne(['exid'=>$exid]);
$html = view('app.jobfairout.ajax.feedback', ['companyname'=>$user->companyname,'jobfair_id'=>$jobfair_id,'exid'=>$exid,'feedback'=>$feedback])->render();
$return_data = array( 'status'=>1, 'data' => $html);
return response()->json($return_data);
}
}
public function companyShow(Request $request)
{
//获取企业信息
$jobfair_id = $request->input('jobfair_id');
$company_id = $request->input('company_id');
$is_job = $request->input('is_job','');
$company_info = $this->companyService->getCompanyInfo(['id'=>$company_id]);
$this->putSeoData('company', $company_info);
//在招职位
$put_jobs_where = array(
array('company_id','=',$company_id),
array('jobfair_id','=',$jobfair_id),
);
$jobs_where = array(
array('audit','=',1),
array('display','=',1)
);
$jobs = $this->jobfairoutPutJobRepository->getWhere($jobs_where,$put_jobs_where);
$jobfair = $this->jobfairoutRepository->findOne(['id'=>$jobfair_id]);
//看过该公司的人还看过(获取相同行业的企业)
$company_where = array(
'trade' => $company_info->trade,
'except_id' =>$company_info->id
);
$other_companys = $this->companyService->getOtherCompanies($company_where, 5);
$user = getUser();
if ($user && $user->utype==2) {
//获取当前时间段内申请过的职位
$space_time = (integer)config('aix.personal_set.per_set.per_set.apply_job_space');
if ($space_time>0) {
$stime = date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-".$space_time." day"))));
$apply_where = array(array('personal_uid','=',auth('web-member')->user()->id),array('created_at','>=',$stime));
} else {
$apply_where = array(array('personal_uid','=',auth('web-member')->user()->id));
}
$applys = $this->jobfairoutPersonalJopApplyService->getApplyJobs($apply_where);
} else {
$applys = array();
}
$return_data = array(
'info'=>$company_info,
'jobs'=>$jobs,
'jobfair' => $jobfair,
'applys' => $applys,
'other_companys'=>$other_companys,
'company_img' => $company_info->img,
);
if($is_job){
return view('app.jobfairout.company.company_jobs', $return_data);
}else{
return view('app.jobfairout.company.company_show', $return_data);
}
}
}