| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318 | <?php/** * Created by PhpStorm. * User: Administrator * Date: 2019/3/26 * Time: 11:34 */namespace App\Http\Controllers\Web\Hardware\Pad;use App\Http\Controllers\Web\WebBaseController;use Illuminate\Http\Request;use App\Services\Common\SearchService;use App\Services\Person\ResumeService;use App\Services\Common\MembersSetmealService;use App\Services\Company\JobsService;use App\Services\Company\CompanyDownResumeService;use App\Services\Common\SetmealIncrementsService;use App\Services\Content\FeedbackService;use App\Services\Company\PersonalJobsApplyService;use App\Services\Jobfair\JobfairPutJobService;use App\Services\Company\CompanyService;class PadSearchResumeController extends WebBaseController{    protected $searchService;    protected $resumeService;    protected $membersSetmealService;    protected $jobsService;    protected $companyDownResumeService;    protected $setmealIncrementsService;    protected $feedbackService;    protected $personalJobsApplyService;    protected $jobsfairPutJobService;    protected $companyService;    public function __construct(SearchService $searchService,JobfairPutJobService $jobsfairPutJobService,PersonalJobsApplyService $personalJobsApplyService,ResumeService $resumeService, MembersSetmealService $membersSetmealService, JobsService $jobsService,CompanyDownResumeService $companyDownResumeService,SetmealIncrementsService $setmealIncrementsService,FeedbackService $feedbackService, CompanyService $companyService)    {        $this->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 .= "<label><input class='job' type='radio' name='job' value='".$val->id."' /> ".$val->jobs->jobs_name."</label>";            }        }        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'=>'您还没有开通服务,请<a target="_blank" href="'.route('mobile.firm.service.setmeal.add').'">开通</a>!']);            }            //判断服务是否到期            if ($member_setmeal->expire == 1) {                return response()->json(['status'=>0, 'msg'=>'您的服务已经到期,请<a target="_blank" href="'.route('mobile.firm.service.setmeal.add').'">重新开通</a>!']);            }            //后台简历下载设置判断            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'=>'您今天已下载 <span class="txt_highlight">'.$downnum.'</span> 份简历,已达到每天下载上限,请先收藏该简历,明天继续下载。']);                }            }            $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;    }}
 |