| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843 | <?php/** * Created by PhpStorm. * User: wuzhenke * Date: 2019/1/17 * Time: 16:19 */namespace App\Http\Controllers\Mobile\Jobfair;use App\Http\Controllers\Mobile\MobileBaseController;use App\Models\Subsite;use App\Repositories\CompanyRepository;use App\Repositories\Jobfair\JobfairCompanyRepository;use App\Repositories\Jobfair\JobfairFloorPlanRepository;use App\Repositories\Jobfair\JobfairFloorplanStandRepository;use App\Repositories\Jobfair\JobfairPersonalJobsApplyRepository;use App\Repositories\Jobfair\JobfairPutJobRepository;use App\Repositories\Jobfair\JobfairRepository;use App\Repositories\ResumeRepository;use App\Repositories\Jobfair\JobfairJobRepository;use App\Services\Jobfair\JobfairCompanyService;use App\Services\Jobfair\JobfairJobsService;use App\Services\Jobfair\JobfairPersonalJopApplyService;use App\Services\Jobfair\JobfairService;use App\Services\Jobfair\JobfairPutJobService;use App\Services\Person\ResumeService;use Illuminate\Http\Request;use App\Services\Company\CompanyService;use App\Services\Jobfair\JobfairPersonSignedService;use App\Repositories\Jobfair\JobfairPersonSignedRepository;class JobfairController extends MobileBaseController{    protected $jobfairJobsService;    protected $jobfairCompanyRepository;    protected $jobfairCompanyService;    protected $jobfairService;    protected $jobfairRepository;    protected $jobfairPersonalJobsApplyRepository;    protected $jobfairPersonalJopApplyService;    protected $resumeService;    protected $jobfairFloorplanStandRepository;    protected $jobfairFloorPlanRepository;    protected $jobfairPutJobRepository;    protected $companyRepository;    protected $resumeRepository;    protected $jobfairJobRepository;    protected $companyService;    protected $jobfairPersonSignedService;    protected $jobfairPersonSignedRepository;    protected $jobfairPutJobService;    /**     * JobfairController constructor.     * @param ResumeService $resumeService     * @param JobfairJobRepository $jobfairJobRepository     * @param ResumeRepository $resumeRepository     * @param CompanyRepository $companyRepository     * @param JobfairPutJobRepository $jobfairPutJobRepository     * @param JobfairJobsService $jobfairJobsService     * @param JobfairFloorPlanRepository $jobfairFloorPlanRepository     * @param JobfairFloorplanStandRepository $jobfairFloorplanStandRepository     * @param JobfairPersonalJopApplyService $jobfairPersonalJopApplyService     * @param JobfairPersonalJobsApplyRepository $jobfairPersonalJobsApplyRepository     * @param JobfairRepository $jobfairRepository     * @param JobfairService $jobfairService     * @param JobfairCompanyService $jobfairCompanyService     * @param JobfairCompanyRepository $jobfairCompanyRepository     * @param CompanyService $companyService     * @param JobfairPersonSignedRepository $jobfairPersonSignedRepository     * @param JobfairPersonSignedService $jobfairPersonSignedService     * @param JobfairPutJobService $jobfairPutJobService     */    public function __construct(ResumeService $resumeService, JobfairJobRepository $jobfairJobRepository, ResumeRepository $resumeRepository, CompanyRepository $companyRepository, JobfairPutJobRepository $jobfairPutJobRepository, JobfairJobsService $jobfairJobsService, JobfairFloorPlanRepository $jobfairFloorPlanRepository, JobfairFloorplanStandRepository $jobfairFloorplanStandRepository, JobfairPersonalJopApplyService $jobfairPersonalJopApplyService, JobfairPersonalJobsApplyRepository $jobfairPersonalJobsApplyRepository, JobfairRepository $jobfairRepository, JobfairService $jobfairService, JobfairCompanyService $jobfairCompanyService, JobfairCompanyRepository $jobfairCompanyRepository, CompanyService $companyService, JobfairPersonSignedRepository $jobfairPersonSignedRepository, JobfairPersonSignedService $jobfairPersonSignedService, JobfairPutJobService $jobfairPutJobService)    {        $this->jobfairJobsService = $jobfairJobsService;        $this->jobfairCompanyRepository = $jobfairCompanyRepository;        $this->jobfairCompanyService = $jobfairCompanyService;        $this->jobfairService = $jobfairService;        $this->jobfairRepository = $jobfairRepository;        $this->jobfairPersonalJobsApplyRepository = $jobfairPersonalJobsApplyRepository;        $this->jobfairPersonalJopApplyService = $jobfairPersonalJopApplyService;        $this->resumeService = $resumeService;        $this->jobfairFloorplanStandRepository = $jobfairFloorplanStandRepository;        $this->jobfairFloorPlanRepository = $jobfairFloorPlanRepository;        $this->jobfairPutJobRepository = $jobfairPutJobRepository;        $this->companyRepository = $companyRepository;        $this->resumeRepository = $resumeRepository;        $this->jobfairJobRepository = $jobfairJobRepository;        $this->companyService = $companyService;        $this->jobfairPersonSignedService = $jobfairPersonSignedService;        $this->jobfairPersonSignedRepository = $jobfairPersonSignedRepository;        $this->jobfairPutJobService = $jobfairPutJobService;    }    /**近期招聘会     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View     */    public function jobfairIndex(Request $request)    {        $user = auth('web-company')->user();        $res = $this->jobfairService->jobfairIndex($user);        $res['wap_title'] ="招聘会管理";        return view('mobile.app.jobfair.company.index', $res);    }    /**定展记录     * @param Request $request     * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View     * @throws \Throwable     */    public function jobfairEnact(Request $request)    {        $user = auth('web-company')->user();        $res = $this->jobfairCompanyService->jobfairEnact($user);        if ($request->ajax()) {            if ($res['enactList']->currentPage() > $res['enactList']->lastPage()) {                return response()->json(['status'=>0]);            }            return response()->json(['status'=>1, 'data'=>view('mobile.app.jobfair.ajax.ajax_enact_list', ['enactList' => $res['enactList']])->render()]);        }        $res['wap_title'] ="定展记录";        return view('mobile.app.jobfair.company.jobfair_enact', $res);    }    /**招聘会职位库管理     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View     */    public function jobfairJobsList(Request $request)    {        $res = $this->jobfairJobsService->jobfairJobsList();        if ($request->ajax()) {            if ($res['list']->currentPage() >$res['list']->lastPage()) {                return response()->json(['status'=>0]);            }            return response()->json(['status'=>1,'data'=>view('mobile.app.jobfair.ajax.ajax_jobfair_jobs_list', $res)->render()]);        }        $res['wap_title'] ="招聘会职位";        return view('mobile.app.jobfair.company.jobfair_jobs_list', $res);    }    /**招聘会职位添加     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View     */    public function jobfairJobsAdd()    {        $res = $this->jobfairJobsService->jobfairJobsAdd();        $res['wap_title'] ="发布招聘会职位";        return view('mobile.app.jobfair.company.jobfair_jobs_add', $res);    }    /**招聘会职位修改     * @param int $id     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View     */    public function jobfairJobsEdit($id)    {        $user = auth('web-company')->user();        $res = $this->jobfairJobsService->jobfairJobsEdit($id, $user);        if (!$res) {            return $this->showMessage('参数错误', route('mobile.firm.jobfair_jobs.list'), true, '上一页');        }        $res['wap_title'] ="编辑招聘会职位";        return view('mobile.app.jobfair.company.jobfair_jobs_add', $res);    }    /**招聘会职位删除     * @param Request $request     * @return \Illuminate\Http\JsonResponse     * @throws \Throwable     */    public function jobfairJobsDel(Request $request)    {        return  $this->jobfairJobsService->jobfairJobsDel($request);    }    /**招聘会职位修改和添加     * @param Request $request     * @return \Illuminate\Http\JsonResponse     */    public function jobfairJobsSave(Request $request)    {        $user = auth('web-company')->user();        $data = $request->except(['_method', '_token']);        return $this->jobfairJobsService->jobsSaveMobile($data, $user);    }    /**职位添加到招聘会中     * @param Request $request     * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View     * @throws \Throwable     */    public function jobfairJobsPutJobs(Request $request)    {        $user = auth('web-company')->user();        if ($request->method() == 'POST') {            $jids = $request->jobs_id;            $this->jobfairJobsService->isOwn($jids,$user);            $exidArr = explode(',', $request->exid);            $this->jobfairCompanyService->isOwnArr($exidArr,$user);            return $this->jobfairJobsService->jobfairJobsToJobfairMobile($request);        }        $exid = $request->id;        $enact = $this->jobfairCompanyService->jobfairEnactfind($exid);        $where = [            'audit'=>1,            'company_id'=>$user->id,            'type'=>1,        ];        $fairJobs = $this->jobfairJobRepository->getAuditJobList($where);        $map = [            'exid' => $exid,        ];        $fairJob_ids = $this->jobfairPutJobRepository->getFairJobIds($map);        $res['wap_title'] ="发布参展职位";        $res = [            'wap_title'=>'发布参展职位',            'enact'=>$enact,            'fairJobs'=>$fairJobs,            'fairJob_ids'=>$fairJob_ids,        ];        return view('mobile.app.jobfair.company.jobfair_jobs_put_jobs', $res);    }    /**收到的招聘会简历     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View     */    public function downResume()    {        $user = auth('web-company')->user();        $result = $this->jobfairPersonalJobsApplyRepository->getResume($user->id);        return  view('app.jobfair.company.down_resume', ['result'=>$result]);    }    public function downResumeDel(Request $request)    {        if ($request->method() == 'POST') {            $user = $this->getLoginUser();            return $this->jobfairPersonalJopApplyService->downResumeDel($request,$user);        }        $tip = "被删除后将无法恢复,您确定要删除选中的简历吗?";        return response()->json(['status'=>1,'data'=>['html'=>view('app.company.ajax.ajax_warning', ['tip'=>$tip])->render()]]);    }    /*     * 前台页面     * */    /**招聘会列表     * @param Request $request     * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View     * @throws \Throwable     */    public function index(Request $request)    {        $jobfairList = $this->jobfairService->index($request);        if ($request->ajax()) {            if ($jobfairList->isNotEmpty()) {                return response()->json(['status'=>1,'data'=>view('mobile.app.jobfair.ajax.ajax_jobfair_list', ['jobfairList'=>$jobfairList])->render()]);            }            return response()->json(['status'=>0]);        }        $jobfairList['wap_title'] = "招聘会列表";        return view('mobile.app.jobfair.index', $jobfairList);    }    /**招聘会详情     * @param int $id     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View     */    public function jobfairShow($id = 0)    {        $user = auth('web-company')->user()?auth('web-company')->user():auth('web-member')->user();        if (!$id) {            return $this->showMessage('参数错误!', route('jobfair'), true, '上一页');        }        $res = $this->jobfairService->jobfairShow($id);        if ($user && $user->utype == 1) {            $res['show_booth'] = 1;        } else {            $res['show_booth'] = 0;        }        if (!$res['status']) {            return $this->showMessage($res['msg'], route('jobfair'), true, '上一页');        } else {            if (array_has($res, 'jobfair')) {                $this->putSeoData('jobfair', $res['jobfair']);            }            $res['jobfair']->sitename = Subsite::where('id',$res['jobfair']->subsite_id)->value('sitename');            $res['wap_title'] = "招聘会详情";            return view('mobile.app.jobfair.jobfair_show', $res);        }    }    /**招聘会企业     * @param Request $request     * @param int $id     * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View     * @throws \Throwable     */    public function jobfairShowCom(Request $request, $id = 0)    {        if (!$id) {            return $this->showMessage('参数错误!', route('jobfair'), true, '上一页');        }        $res = $this->jobfairService->jobfairShowCom($request, $id);        if ($request->ajax()) {            if ($res['jobfairCompany']->isNotEmpty()) {                return response()->json(['status'=>1,'data'=>view('mobile.app.jobfair.ajax.ajax_jobfair_com', $res)->render()]);            }            return response()->json(['status'=>0]);        }        if (!$res['status']) {            return $this->showMessage($res['msg'], route('jobfair'), true, '上一页');        } else {            $this->putSeoData('jobfair', $res['jobfair']);            $res['wap_title'] = "招聘会企业";            return view('mobile.app.jobfair.jobfair_com', $res);        }    }    public function jobfairShowComDetail($uid, $jobfair_id, $position_id)    {        $jobfairCompany = $this->jobfairCompanyRepository->findCompany(['jobfair_companys.company_id'=>$uid,'jobfair_companys.jobfair_id'=>$jobfair_id,'jobfair_companys.position_id'=>$position_id,'jobfair_companys.audit'=>1], 0, 10);        $jobfairCompany[0]->jobfair->predetermined_ok = 0;        if ($jobfairCompany[0]->jobfair->predetermined_status == 1 && $jobfairCompany[0]->jobfair->predetermined_start && $jobfairCompany[0]->jobfair->predetermined_start < time() && $jobfairCompany[0]->jobfair->predetermined_end && $jobfairCompany[0]->jobfair->predetermined_end > time()) {            $jobfairCompany[0]->jobfair->predetermined_ok = 1;        }        $jobfairCompany[0]->jobfairPutJob = $this->jobfairPutJobRepository->getJobfairJob($jobfairCompany[0]->id, $jobfair_id);        $res = [            'jobfairCompany'=>$jobfairCompany[0],            'wap_title'=>'招聘会企业职位',        ];        return view('mobile.app.jobfair.jobfair_com_detail', $res);    }    /**招聘会职位详情     * @param $jobfair_id     * @param $job_id     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View     */    public function jobfairShowJob($id)    {        $job = $this->jobfairService->jobfairShowJob($id);        if (!$job['status']) {            return $this->showMessage($job['msg'], route('jobfair'), true, '上一页');        } else {            $this->putSeoData('jobfair_job', $job['jobInfo']);            $job['wap_title'] = "招聘会职位详情";            return view('mobile.app.jobfair.jobfair_job', $job);        }    }    public function jobfairAppointmentJobs(Request $request)    {        $user = $this->getLoginUser();        if (!$user) {            return response()->json(['status'=>3, 'type'=>1, 'html'=>view('app.common.ajax.per_login')->render(),'msg'=>'您还没有登录,请先登录再预约职位']);        }        if ($user->utype == 1) {            return response()->json(['status'=>2,'type'=>3,'msg'=>'企业会员不允许预约职位!']);        }        $jid = $request->jobsfair_job_id;        $jobfair_id = $request->jobfairid;        $position_id = $request->position_id;        $company_id = $request->company_id;        $resume_id = $request->resume_id?$request->resume_id:0;        $jobfair = $this->jobfairRepository->find($jobfair_id);        if ($jobfair->isEmpty ||  $jobfair->holddate_end < time()) {            return response()->json(['status'=>0, 'html'=>"招聘会已停止"]);        }        if ($resume_id) {            if (!$jid || !$company_id || !$jobfair_id || !$position_id) {                return response()->json(['status'=>2,'type'=>3,'msg'=>'参数错误!']);            }            $this->resumeService->isOwn($resume_id,$user);            $this->jobfairPutJobService->isOwn($jid,$company_id);            //错综复杂的关系            $this->jobfairCompanyService->isPositionOwn($position_id,$jobfair_id,$company_id,$jid);            $data['resume_id'] = $resume_id;            $data['personal_uid'] = $user->id;            $data['jobs_id'] = $jid;            $data['company_id'] = $company_id;            $data['jobfair_id'] = $jobfair_id;            $data['position_id'] = $position_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->jobfairPersonalJobsApplyRepository->findWhere(['resume_id'=>$resume_id, 'jobs_id'=>$jid, 'company_id'=>$company_id, 'jobfair_id'=>$jobfair_id, 'position_id'=>$position_id])->isNotEmpty()) {                return response()->json(['status'=>0, 'html'=>"您已预约该职位,请勿重复预约!"]);            }            if ($this->jobfairPersonalJopApplyService->applyJob($data)) {                return response()->json(['status'=>1, 'html'=>"职位预约成功!"]);            }            return response()->json(['status'=>0,'type'=>0 , 'html'=>"职位预约失败!"]);        } else {            if (!$jid || !$company_id || !$jobfair_id || !$position_id) {                return response()->json(['status'=>2,'type'=>3,'msg'=>'参数错误!']);            }            $result = $this->jobfairPersonalJopApplyService->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['position_id'] = $position_id;                $page_data['jobs_id'] = $jid;                $html = view('mobile.app.common.ajax.apply_resume', $page_data)->render();                return response()->json(['status'=>2,'html'=>$html]);            } elseif ($result['status'] == 3) { //直接投递                $this->jobfairPutJobService->isOwn($jid,$company_id);                //错综复杂的关系                $this->jobfairCompanyService->isPositionOwn($position_id,$jobfair_id,$company_id,$jid);                $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;                $data['position_id'] = $position_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->jobfairPersonalJobsApplyRepository->findWhere(['resume_id'=>$resume->id, 'jobs_id'=>$jid, 'company_id'=>$company_id, 'jobfair_id'=>$jobfair_id, 'position_id'=>$position_id])->isNotEmpty()) {                    return response()->json(['status'=>0, 'html'=>"您已预约该职位,请勿重复预约!"]);                }                if ($this->jobfairPersonalJopApplyService->applyJob($data)) {                    return response()->json(['status'=>1, 'html'=>"职位预约成功!"]);                }                return response()->json(['status'=>0,'type'=>0 , 'html'=>"职位预约失败!"]);            }        }    }    /**在线预定     * @param $id     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View     */    public function jobfairAppointment($id)    {        if (!$id) {            return $this->showMessage('参数错误!', route('jobfair'), true, '上一页');        }        $res = $this->jobfairService->jobfairAppointment($id);        if (!$res['status']) {            return $this->showMessage($res['msg'], route('jobfair'), true, '上一页');        } else {            $this->putSeoData('jobfair', $res['jobfair']);            return view('mobile.app.jobfair.jobfair_appointment', $res);        }    }    public function personJobfair()    {        $resume = $this->resumeService->myResumeAjax(auth('web-member')->user());        $jobApply = $this->jobfairPersonalJopApplyService->personJobfair();        return view('app.jobfair.person.job_apply', ['resume' => $resume, 'interview' => $jobApply['interview']]);    }    public function jobfairAppointmentSave(Request $request)    {        $user = auth('web-company')->user()?auth('web-company')->user():auth('web-member')->user();        if (!$user) {            return response()->json(['status'=>0, 'type'=>1, 'html'=>view('app.common.ajax.com_login')->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;        $position_id = $request->position_id?$request->position_id:0;        $floorplan_id = $request->floorplan_id?$request->floorplan_id:0;        if (!$jobfair_id || !$jobfairInfo = $this->jobfairRepository->findOne(['id'=>$jobfair_id])) {            return response()->json(['status'=>0,'msg'=>'查无此招聘会!']);        }        if (!$floorplan_id || !$floorplanInfo = $this->jobfairFloorPlanRepository->getOne($floorplan_id)) {            return response()->json(['status'=>0,'msg'=>'查无此招聘会展位图!']);        }        if (!$position_id || !$positionInfo =$this->jobfairFloorplanStandRepository->getOne(['id'=>$position_id])) {            return response()->json(['status'=>0,'msg'=>'查无此招聘会展位号!']);        }        if ($positionInfo->type == 2) {            return response()->json(['status'=>0,'msg'=>'预留展位不可预定!']);        }        if ($jobfairInfo->more_stand == 0 && $this->jobfairCompanyRepository->findCom(['jobfair_id'=>$jobfair_id, 'company_id'=>$user->id,['audit','<>', 3]])) {            return response()->json(['status'=>0,'msg'=>'本场招聘会不允许预定多个展位!']);        }        if($this->jobfairCompanyRepository->findCom(['jobfair_id'=>$jobfair_id, 'position_id'=>$position_id,['audit','<>', 3]])){            return response()->json(['status'=>0,'msg'=>'该展位已被抢占,请重新刷新页面再预定']);        }        if ($request->method()=='POST') {            return $this->jobfairService->jobfairAppointmentSave($jobfairInfo, $positionInfo, $user);        }        if ($jobfairInfo->is_commonweal == 3) {            $msg = "本次招聘会为公益招聘会.<br><span style='color: red;'>请勿迟到,早退,违约不到场.</span><br>招聘会开始30分钟之后到场签到视为迟到,1小时之后还未到场视为违约,招聘会结束之前30分钟退出系统视为早退.<br>迟到早退三次,违约不到场一次,之后一个月内不能再次预定招聘会.<br>";        } else {            $msg ="<br><span style='color: red;'>请勿迟到,早退,违约不到场.</span><br>招聘会开始30分钟之后到场签到视为迟到,1小时之后还未到场视为违约,招聘会结束之前30分钟退出系统视为早退.<br>迟到早退三次,违约不到场一次,之后一个月内不能再次预定招聘会.<br />预定本场招聘会将消耗企业套餐招聘会<span style='color:#FC4C4E;'>".$jobfairInfo->jobsfair_num."次</span>或者企业<span style='color:#FC4C4E;'>积分".$jobfairInfo->predetermined_point."</span><br />";        }        return response()->json(['status'=>1,'msg'=>$msg]);    }    /**页面加载展位信息     * @param Request $request     * @return \Illuminate\Http\JsonResponse     */    public function ajaxGetData(Request $request)    {        $data = $request->all();        return $this->jobfairService->ajaxGetData($data);    }    public function jobsCompanyShow(Request $request)    {        //获取企业信息        $jobfair_id = $request->input('jobfair_id');        $company_id = $request->input('company_id');        $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->jobfairPutJobRepository->getWhere($jobs_where,$put_jobs_where);        $jobfair = $this->jobfairRepository->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->jobfairPersonalJopApplyService->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,            'user'=>$user        );        return view('mobile.app.jobfair.company.comshow', $return_data);    }    //以下为微信H5招聘    public function wechatCom(Request $request)    {        $jobfair_id = $request->input('jobfair_id');        $company_id = $request->input('company_id');        $loginUser = $this->getLoginUser();        $company = $this->companyRepository->find($company_id);        $put_jobs_where = array(            array('company_id','=',$company_id),            array('jobfair_id','=',$jobfair_id),        );        $jobs_where = array(            array('audit','=',1),            array('display','=',1)        );        $res['jobs'] = $this->jobfairPutJobRepository->getWhere($jobs_where,$put_jobs_where);        $show_menu = 0;        if ($loginUser) {            if ($company->id == $loginUser->id &&  $company->utype == $loginUser->utype) {                $show_menu = 1;            }        }        $phone_error = '';        $phone_error_tit = '';        $phone_url = '';        $phone_code = 0;        $resume_error = '对不起,请登录后再投递简历';        $resume_error_tit = '登录';        $resume_url = route('mobile.login');        $resume_code = 0;        if ($loginUser && $loginUser->utype == 2) {            $resume_error = '对不起,请登录后再投递简历';            $resume_error_tit = '登录';            $resume_url = route('mobile.jobs.apply');            $resume_code = 1;        }        $resume = [];        $res['show_menu'] = $show_menu;        $res['praise'] = 0;        if ($company->telephone_show ==1) {            if (config('aix.companyset.comset.contact_set.showjobcontact') == 0) {                $phone_error='企业未填写联系方式';                $phone_error_tit='确定';                $phone_url= '';                $phone_code = 1;            } else {                if (!$loginUser) {                    $phone_error='对不起,请登录后继续查看企业联系方式';                    $phone_error_tit='登录';                    $phone_url= route('mobile.login');                    $phone_code = 0;                } else {                    $phone_code = 1;                }            }        } else {            $phone_error='该企业不接受电话咨询,请直接投递简历';            $phone_error_tit='投递';            $phone_url = route('mobile.firm.com.wzp.send.resume', ['id'=>$company->id]);            $phone_code = 0;        }        if ($loginUser && $loginUser->utype == 2) {            $resume = $this->resumeRepository->findWhere(['uid'=>$loginUser->id]);        }        $res['phone_error'] = $phone_error;        $res['phone_error_tit'] = $phone_error_tit;        $res['phone_url'] = $phone_url;        $res['phone_code'] = $phone_code;        $res['resume_error'] = $resume_error;        $res['resume_error_tit'] = $resume_error_tit;        $res['resume_url'] = $resume_url;        $res['resume_code'] = $resume_code;        $res['resume'] = $resume;        $res['user'] = $company;        $res['loginUser'] = $loginUser;        return view("mobile.app.jobfair.wzp.com", $res);    }    //是否有在开启的招聘会    public function jobfairSceneOpen()    {        $user = getUser();        $where = [            ['holddate_start', '<', strtotime("+60 minute")],            ['holddate_end', '>', time()],            ['display', '=', 1],            ['subsite_id', '=', get_subsite_id()],        ];        $compant_where = [            'company_id' => $user->id        ];        $allJobfair= $this->jobfairRepository->getCompanyOpenJobfair($where,$compant_where);        $oneJobfair = $this->jobfairRepository->getOneCompanyOpenJobfair($where,$compant_where);        if(count($allJobfair)>1){            $html = view('mobile.app.person.jobfair.ajax_open_jabfair', ['allJobfair'=>$allJobfair,'oneJobfair'=>$oneJobfair])->render();            $return_data = array('status'=>2, 'html' => $html);            return response()->json($return_data);        }elseif(count($allJobfair) == 1){            $return_data = array('status'=>1,'jobfair_id'=>$allJobfair[0]->id);            return response()->json($return_data);        }else{            $return_data = array('status'=>0,'error'=>'暂无举办中的招聘会');            return response()->json($return_data);        }    }    //现场招聘会    public function jobfairScene(Request $request)    {        $jobfair_id = $request->jobfair_id ;        $user = getUser();        $jobfairScene = $this->jobfairCompanyService->oneJobfairCompany($user,$jobfair_id);        $where = [            'jobfair_id'=>$jobfair_id,            'company_id'=>$user->id,        ];        $jobs_where = [            'display'=>1,            'audit'=>1        ];        $jobfairJob = $this->jobfairPutJobRepository->getJobfairCompanyJob($where,$jobs_where);        $jobfairJobCount = $jobfairJob->count();        //猜你喜欢 根据职位类别的中类和期望职位的中类匹配        $fitResumeCount = 0;        $category = array_pluck($jobfairJob->toArray(),'category');        if($category){            $fitResumeCount = $this->jobfairPersonSignedService->likeResumes($category,$jobfair_id)->count();        }        $where = [            'company_id'=>$user->id,            'jobfair_id'=>$jobfair_id,        ];        $interviewCount = $this->jobfairPersonalJobsApplyRepository->padApplyJobs($where)->count();        $where = [            'company_id'=>$user->id,            'jobfair_id'=>$jobfair_id,            'is_apply'=>1,        ];        $yuyueCount = $this->jobfairPersonalJobsApplyRepository->applyJobs($where)->count();        return view('mobile.app.jobfair.scene.index',[            'jobfair_id'=>$jobfair_id,            'jobfairScene'=>$jobfairScene,            'jobfairJobCount'=>$jobfairJobCount,            'interviewCount'=>$interviewCount,            'yuyueCount'=>$yuyueCount,            'fitResumeCount'=>$fitResumeCount,        ]);    }    //招聘会职位    public function jobfairSceneJobs(Request $request)    {        $jobfair_id = $request->jobfair_id ;        $user = getUser();        $where = [            'jobfair_id'=>$jobfair_id,            'company_id'=>$user->id,        ];        $jobs_where = [            'display'=>1,            'audit'=>1        ];        $jobfairJob = $this->jobfairPutJobRepository->getJobfairCompanyJob($where,$jobs_where);        $jobfair_id = $request->jobfair_id ;        $user = getUser();        $jobfairCompany = $this->jobfairCompanyService->oneJobfairCompany($user,$jobfair_id);        return view('mobile.app.jobfair.scene.jobfair_jobs',['jobfairJob'=>$jobfairJob,'jobfairCompany'=>$jobfairCompany]);    }    //推荐职位(猜你喜欢)    public function jobfairSceneResumes(Request $request)    {        $jobfair_id = $request->jobfair_id ;        $user = getUser();        $where = [            'jobfair_id'=>$jobfair_id,            'company_id'=>$user->id,        ];        $jobs_where = [            'display'=>1,            'audit'=>1        ];        $jobfairJob = $this->jobfairPutJobRepository->getJobfairCompanyJob($where,$jobs_where);        if($jobfairJob->isNotEmpty()) {            $category = array_pluck($jobfairJob->toArray(),'category');            $fitResume = $this->jobfairPersonSignedService->likeResumes($category,$jobfair_id);            foreach ($fitResume as &$value)            {                $where['personal_uid'] = $value->uid;                $value->status = $this->jobfairPersonalJopApplyService->isApply($where);            }        } else{            //如果发布职位为空,等于空对象            $fitResume = $jobfairJob;        }        $html = '';        foreach ($jobfairJob as $val){            $html .= "<label><input class='job' type='radio' name='job' value='".$val->id."' /> ".$val->jobs->jobs_name."</label>";        }        return view('mobile.app.jobfair.scene.fit_resume',['fitResume'=>$fitResume,'jobfair_id'=>$jobfair_id,'html'=>$html]);    }    public function jobfairScenePutJobsDel(Request $request)    {        $id = $request->id;        if($this->jobfairPutJobRepository->delete($id)) {            return response()->json(['status'=>1, 'msg'=>'招聘会职位删除成功!']);        }else {            return response()->json(['status'=>0, 'msg'=>'招聘会职位删除失败!']);        }    }    public function jobfairSceneInterview(Request $request)    {        $jobfair_id = $request->jobfair_id ;        $user = getUser();        $where = [            'jobfair_id'=>$jobfair_id,            'company_id'=>$user->id,        ];        $interview = $this->jobfairPersonalJobsApplyRepository->padApplyJobs($where);        return view('mobile.app.jobfair.scene.interview',['interview'=>$interview]);    }    public function jobfairSceneYuyue(Request $request)    {        $jobfair_id = $request->jobfair_id ;        $user = getUser();        $where = [            'jobfair_id'=>$jobfair_id,            'company_id'=>$user->id,            'is_apply'=>1,        ];        $yuyue = $this->jobfairPersonalJobsApplyRepository->applyJobs($where);        return view('mobile.app.jobfair.scene.yuyue',['yuyue'=>$yuyue]);    }    public function jobfairSceneInvitation(Request $request)    {        $user = getUser();        $data['resume_id'] = $request->input('resume_id');        $data['personal_uid'] = $request->input('personal_uid');        $data['jobs_id'] = $request->input('job_id');        $this->jobfairPutJobService->isOwn($data['jobs_id'],$user->id);        $data['company_id'] = $user->id;        $data['is_apply'] = 2;        $data['jobfair_id'] = $request->input('jobfair_id');        $data['position_id'] = $this->jobfairCompanyRepository->getValue(['jobfair_id'=> $data['jobfair_id'],'company_id'=>$user->id],'position_id');        $ret = $this->jobfairPersonalJobsApplyRepository->interviewAdd($data);        if($ret) {            return response()->json(array('status'=>1,'msg'=>'邀请成功!'));        }else {            return response()->json(array('status'=>0,'msg'=>'邀请失败!'));        }    }}
 |