Jelajahi Sumber

Merge branch 'master' of http://59.57.98.130:3000/jjhc/jucai

linwu 2 tahun lalu
induk
melakukan
91f37d7169

+ 7 - 1
app/Admin/Controllers/Recruit/RecruitController.php

@@ -178,7 +178,12 @@ class RecruitController extends Controller
         $grid->column('status','状态')->display(function ($status) {
             return $status ? '显示' : '隐藏';
         });
-
+        $grid->filter(function ($filter) {
+            $filter->disableIdFilter();
+            $filter->where(function ($query) {
+                $query->where('simple', '=', "{$this->input}");
+            }, '类型', 'simple')->radio([0 => '招考',1 => '招聘']);
+        });
         $grid->created_at('创建时间');
         $grid->actions(function ($actions) {
             $actions->append('<a href="/ST3IXxKlOa4eGEv0eTw0CfORI9444Mgj/recruit/appoint_list?id=' . $actions->row['id'] . '"  class="btn btn-primary btn-xs" >报名管理</a>');
@@ -211,6 +216,7 @@ class RecruitController extends Controller
             ])->setWidth(5)->setMustMark();
             $form->text('name_en', '英文标识')->setWidth(5)->help('同一个招聘单位,发布的招聘场次若不在同一天,允许一样,若为空则自动生成');
             $form->image('small_img', '缩略图')->uniqueName()->setWidth(3);
+            $form->radio('simple', '类型')->options([0 => '招聘', 1 => '招考'])->default(0)->setMustMark();
             $form->switch('status', '状态')->default(1)->setMustMark();
             $form->switch('show_report', '显示报名人数')->default(0)->setMustMark();
             $form->radio('current', '当前进展')->options([1 => '报名', 2 => '审核', 3 => '笔试', 4 => '上机测试', 5 => '面试', 6 => '复试', 7 => '体检', 8 => '政审', 9 => '公示',0 => '已结束'])->default(1)->setMustMark();

+ 1951 - 1845
app/Http/Controllers/Web/Recruit/IndexController.php

@@ -1,1846 +1,1952 @@
-<?php
-namespace App\Http\Controllers\Web\Recruit;
-
-use App\Http\Controllers\Web\WebBaseController;
-use App\Models\RecruitAppointLog;
-use App\Models\RecruitTicket;
-use App\Validators\RecruitValidatorRequest;
-use Illuminate\Http\Request;
-use App\Models\Recruit;
-use App\Services\Recruit\RecruitService;
-use App\Models\RecruitAppointBasic;
-use App\Models\RecruitSupplement;
-use App\Models\RecruitPost;
-use App\Models\RecruitAppointInfo;
-use think\Route;
-use Illuminate\Support\Facades\Validator;
-use Illuminate\Support\Facades\DB;
-use App\Models\RecruitAppointExpandSpecial;
-use App\Models\RecruitAppointDetail;
-use App\Models\RecruitArticle;
-use Illuminate\Support\Facades\Cache;
-
-class IndexController extends WebBaseController
-{
-
-    protected $recruitService;
-
-    public function __construct(RecruitService $recruitService)
-    {
-        $this->recruitService = $recruitService;
-    }
-
-    /**
-     * 招考列表页
-     * @param Request $request
-     * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
-     */
-    public function index(Request $request)
-    {
-        $key = $request->input('key');
-        $list = $this->recruitService->getRecruit($key, 10);
-
-        $return_data = [
-            'list' => $list,
-            'key'  => $key,
-        ];
-
-        return view('app.recruit.index', $return_data);
-    }
-
-    /**
-     * 招考详情页
-     * @param Request $request
-     * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View|mixed|\think\response\Redirect|\think\response\View|void
-     */
-    public function show(Request $request)
-    {
-        $user = $this->getUser();
-        if($user){
-            $uid = $user->id;
-            $utype = $user->utype;
-        }else{
-            $uid = 0;
-            $utype = 0;
-        }
-        $id = $request->input('id', 0);
-        if (empty($id)) {
-            return $this->showMessage('抱歉,请输入指定的招考场次!', route('recruit.list'), true, '上一页', '2');
-        }
-        $recruit = Recruit::find($id);
-        if (empty($recruit)) {
-            return redirect(route('/recruit/list'));
-        }
-        $info = Recruit::parse_info($recruit);
-        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
-        if(!$info->isApply && $appoint_info){
-            $first_post = RecruitAppointLog::where('type',3)->where('uid',$uid)->orderBy('created_at','asc')->first();
-            if($first_post){
-                $info->isApply = 1;
-            }
-        }
-        if($appoint_info){
-            //笔试
-            $pen_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',1)->first();
-            if($pen_ticket){
-                $time = time();
-                if(strtotime($pen_ticket->ex_start) < $time && strtotime($pen_ticket->ex_end) > $time){
-                    $appoint_info->pen_ticket = 1;
-                }else{
-                    $appoint_info->pen_ticket = -1;
-                }
-            }else{
-                $appoint_info->pen_ticket = 0;
-            }
-            //考核测试
-            $check_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',2)->first();
-            if($check_ticket){
-                $time = time();
-                if(strtotime($check_ticket->ex_start) < $time && strtotime($check_ticket->ex_end) > $time){
-                    $appoint_info->check_ticket = 1;
-                }else{
-                    $appoint_info->check_ticket = -1;
-                }
-            }else{
-                $appoint_info->check_ticket = 0;
-            }
-            //面试
-            $face_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',3)->first();
-
-            if($face_ticket && $appoint_info->face_audit == -1){
-                $appoint_info->face_ticket = 1;
-            }else{
-                $appoint_info->face_ticket = 0;
-            }
-
-            //复试
-            $reexamine_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',4)->first();
-
-            if($reexamine_ticket && $appoint_info->reexamine_audit == -1){
-                $appoint_info->reexamine_ticket = 1;
-            }else{
-                $appoint_info->reexamine_ticket = 0;
-            }
-        }else{
-            $appoint_info = new \stdClass();
-            $appoint_info->pen_audit = 0;
-            $appoint_info->post_id = 0;
-            $appoint_info->pen_ticket = 0;
-            $appoint_info->computer_ticket = 0;
-            $appoint_info->face_ticket = 0;
-            $appoint_info->check_ticket = 0;
-            $appoint_info->reexamine_ticket = 0;
-            $appoint_info->realname = '';
-            $appoint_info->card = '';
-            $appoint_info->mobile = '';
-            $appoint_info->sex = 0;
-        }
-
-        $notice = $request->input('notice',0);
-        if($notice){
-            $public_notice_switch = 0;
-            $public_notice = RecruitArticle::where('id',$notice)->where('released_at','<',time())->first();
-            if (!empty($info)) {
-                $view_data = [
-                    'recruit' => $recruit,
-                    'info' => $info,
-                    'uid' => $uid,
-                    'utype' => $utype,
-                    'public_notice' => $public_notice,
-                    'public_notice_switch' => $public_notice_switch,
-                    'appoint_info' => $appoint_info
-                ];
-                return view('app.recruit.show')->with($view_data);
-            } else {
-                return back();
-            }
-        }else{
-            $list = RecruitArticle::where('recruit_id',$id)->orderBy('created_at','desc')->where('released_at','<',time())->get();
-            $public_notice_switch = 1;//有补充公告的模式
-            if (!empty($info)) {
-                $view_data = [
-                    'recruit' => $recruit,
-                    'info' => $info,
-                    'uid' => $uid,
-                    'utype' => $utype,
-                    'list' => $list,
-                    'public_notice_switch' => $public_notice_switch,
-                    'appoint_info' => $appoint_info
-                ];
-                return view('app.recruit.show')->with($view_data);
-            } else {
-                return back();
-            }
-        }
-
-    }
-
-    /**
-     * 上传文件的方法
-     * @param Request $request
-     * @return \Illuminate\Http\JsonResponse
-     */
-    public function upload(Request $request)
-    {
-        $user = $this->getUser();
-        if($user){
-            $uid = $user->id;
-            $utype = $user->utype;
-        }else{
-            $uid = 0;
-            $utype = 0;
-        }
-        $file = $request->file('file');
-        if ($file->isValid()) { //判断文件是否存在
-            //获取文件的扩展名
-            $ext = $file->getClientOriginalExtension();
-
-            if (!in_array(strtolower($ext), ['jpg', 'jpeg', 'png', 'doc', 'docx', 'pdf'])) {
-                $res['status'] = 0;
-                $res['msg']    = '文件格式不正确';
-            } else {
-                //获取文件的绝对路径
-                $path = $file->getRealPath();
-
-                $oldname = $file->getClientOriginalName();
-
-                //定义文件名
-                $filename = 'storage/recruit/' . uniqid() . mt_rand(10000, 99999) . '.' . $ext;
-
-                //存储文件。disk里面的public。总的来说,就是调用disk模块里的public配置
-                Storage::disk('public')->put($filename, file_get_contents($path));
-
-                $res['status']   = 1;
-                $res['filename'] = $oldname;
-                $res['path']     = "/storage/" . $filename;
-                $res['msg']      = '上传成功';
-            }
-        } else {
-            $res['status'] = 0;
-            $res['msg']    = '上传失败';
-        }
-        return response()->json($res);
-    }
-
-    /**
-     * 查看报名人数统计
-     * @param Request $request
-     * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View|mixed|\think\response\Redirect|\think\response\View|void
-     */
-    public function sign_up_count(Request $request)
-    {
-        $user = $this->getUser();
-        if($user){
-            $uid = $user->id;
-            $utype = $user->utype;
-        }else{
-            $uid = 0;
-            $utype = 0;
-        }
-        $id = $request->input('id', 0);
-        $refresh = $request->input('refresh', '');
-        if (empty($id)) {
-            return $this->showMessage('抱歉,请输入指定的招考场次!', route('recruit.list'), true, '上一页', '2');
-        }
-        $recruit = Recruit::find($id);
-        if (empty($recruit)) {
-            return redirect(route('/recruit/list'));
-        }
-        if(!$recruit->show_report){
-            return $this->showMessage('抱歉,该场次不允许查看报名人数统计结果!', route('recruit.list'), true, '上一页', '2');
-        }
-        if(Cache::has("sign_up_count_{$recruit->id}") && $refresh != 'jjhc2019') {
-            $cache_data = Cache::get("sign_up_count_{$recruit->id}");
-            $list = $cache_data['list'];
-            $time = $cache_data['time'];
-        }else{
-            $list = RecruitPost::where('recruit_id',$recruit->id)->where('status',1)->get();
-            if(!$list){
-                return $this->showMessage('抱歉,数据暂时未更新或更新出错!', route('recruit.list'), true, '上一页', '2');
-            }
-            foreach ($list as $k => $v){
-                $res = RecruitAppointInfo::select(DB::raw("count(case audit when 1 then 1 end) as 'checking', count(case audit when 2 then 2 end) as 'fail',count(case audit when 3 then 3 end) as 'success'"))->where('recruit_id',$recruit->id)->where('post_id',$v->id)->first();
-                $list[$k]['checking'] = $res->checking;
-                $list[$k]['fail'] = $res->fail;
-                $list[$k]['success'] = $res->success;
-            }
-            $time = date('Y-m-d H:i',time());
-            $cache_data = [
-                'list' => $list,
-                'time' => $time
-            ];
-            Cache::put("sign_up_count_{$recruit->id}",$cache_data,60);
-        }
-
-        $view_data = [
-            'list'  => $list,
-            'time' => $time
-        ];
-        return view('app.recruit.sign_up_count')->with($view_data);
-    }
-
-    /**
-     *  报名功能页
-     * @param Request $request
-     * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View|mixed|\think\response\Redirect|\think\response\View|void
-     */
-    public function sign_up(Request $request)
-    {
-        $user = $this->getUser();
-        if (!empty($user)) {
-            $uid = $user->id;
-        } else {
-            return redirect(route('login'));
-        }
-
-        //招考id
-        $id = $request->input('id', 0);
-        if (!$id) {
-            return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
-        }
-
-        //招考信息
-        $recruit = Recruit::find($id);
-        if(!$recruit['status'] && !$user->recruit_test){
-            return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
-        }
-        if($recruit['current'] != 1){
-            return $this->showMessage('抱歉,该项目报名通道已关闭,如有疑问,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
-        }
-        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
-        $time = time();
-        $formDisabled = 0;
-        if(($time < strtotime($recruit['apply_start']) || strtotime($recruit['apply_end']) < $time)){//过了招考时间
-            if(!in_array($uid,[161027,59041])){
-                if(!$appoint_info){
-                    return $this->showMessage('抱歉,该项目已过报名时间或尚未开始!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
-                }
-                if($appoint_info){
-                    //如果有报名记录,先查询首次报名是什么时候
-                    $first_post = RecruitAppointLog::where('type',3)->where('uid',$uid)->where('appoint_id',$appoint_info->id)->orderBy('created_at','asc')->first();
-                    if(!$first_post){//没有记录代表只是暂存
-                        return $this->showMessage('抱歉,该项目已过报名时间或尚未开始!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
-                    }
-//                $has_late_post = RecruitAppointLog::where('type',3)->where('uid',$uid)->where('created_at','>',$recruit['apply_end'])->first();//查找在过了报名时间后,有报名记录,且仍是审核失败的报名记录,看其是否在报名时间后是否有再次提交的记录
-//                if($has_late_post){
-//                    $formDisabled = 1;
-//                }else{
-//                    $formDisabled = 0;
-//                }
-                }
-            }
-
-        }
-
-        $view_data['module'] = $forms = explode(',', $recruit['forms']);
-        //查询报名表是否已有记录
-        if($appoint_info){
-            if(in_array('internship',$forms)) {
-                //如果已有该场次的报名记录,读取录入的数据集合
-                $user_info = $appoint_info;
-                $user_info['sex'] = (string)$user_info['sex'];
-                $user_info['adjust'] = (string)$user_info['adjust'];
-                $user_info['edu_type'] = (string)$user_info['edu_type'];
-                $user_info['family'] = json_decode($user_info['family']);
-                $detail = RecruitAppointDetail::where('recruit_appoint_id',$user_info['id'])->first();
-                if($detail){
-                    $user_info['detail'] = $detail->toArray();
-                }else{
-                    $user_info['detail'] = [
-                        'rewards_and_punishments' => '',
-                        'introduce' => ''
-                    ];
-                }
-                if(json_decode($user_info['identification'])){
-                    $identification = json_decode($user_info['identification'],true);
-                    foreach ($identification as $k => $v){
-                        if(array_key_exists('response',$v)){
-                            $identification[$k]['url'] = $v['response']['path'];
-                        }
-
-                    }
-                }else{
-                    $identification = [];
-                }
-                $user_info['identification'] = $identification;
-                if(json_decode($user_info['education_certification'])){
-                    $education_certification = json_decode($user_info['education_certification'],true);
-                    foreach ($education_certification as $k => $v){
-                        if(array_key_exists('response',$v)){
-                            $education_certification[$k]['url'] = $v['response']['path'];
-                        }
-
-                    }
-                }else{
-                    $education_certification = [];
-                }
-                $user_info['education_certification'] = $education_certification;
-
-                if(json_decode($user_info['other_certification'])){
-                    $other_certification = json_decode($user_info['other_certification'],true);
-                    foreach ($other_certification as $k => $v){
-                        if(array_key_exists('response',$v)){
-                            $other_certification[$k]['url'] = $v['response']['path'];
-                        }
-
-                    }
-                }else{
-                    $other_certification = [];
-                }
-                $user_info['other_certification'] = $other_certification;
-
-                //获取最新的报名审核信息
-                $logs = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',2)->orderBy('created_at','desc')->first();
-                if($logs){
-                    $user_info['audit_log'] = $logs->log;
-                }else{
-                    $user_info['audit_log'] = '';
-                }
-
-            }else{
-                //如果已有该场次的报名记录,读取录入的数据集合
-                $user_info = $appoint_info;
-                $user_info['sex'] = (string)$user_info['sex'];
-                $user_info['edu_type'] = (string)$user_info['edu_type'];
-                $user_info['family'] = json_decode($user_info['family']);
-                if(in_array('expand_special',$forms)){
-                    $special = RecruitAppointExpandSpecial::where('recruit_appoint_id',$user_info['id'])->first();
-                    if(json_decode($special['material'])){
-                        $material = json_decode($special['material'],true);
-                        foreach ($material as $k => $v){
-                            if(array_key_exists('response',$v)){
-                                if(array_key_exists('path',$v['response'])){
-                                    $material[$k]['url'] = $v['response']['path'];}
-
-                            }
-                        }
-                    }else{
-                        $material = [];
-                    }
-                    $user_info['special'] = [
-                        'point_apply'   =>  (string)$special['point_apply'],
-                        'condition'     =>  $special['condition'],
-                        'material'      =>  $material
-                    ];
-                }
-                if(in_array('detail',$forms)){
-                    $detail = RecruitAppointDetail::where('recruit_appoint_id',$user_info['id'])->first();
-                    if($detail){
-                        $user_info['detail'] = $detail->toArray();
-                    }else{
-                        $user_info['detail'] = [
-                            'train' =>  '',
-                            'rewards_and_punishments' => '',
-                            'introduce' => ''
-                        ];
-                    }
-                }
-                //如果有身份证明模块
-                if(in_array('identification',$forms)){
-                    if(json_decode($user_info['identification'])){
-                        $identification = json_decode($user_info['identification'],true);
-                        foreach ($identification as $k => $v){
-                            if(array_key_exists('response',$v)){
-                                if(array_key_exists('path',$v['response'])){
-                                    $identification[$k]['url'] = $v['response']['path'];
-                                }
-                            }
-
-                        }
-                    }else{
-                        $identification = [];
-                    }
-                    $user_info['identification'] = $identification;
-                }
-                //如果有教育证明模块
-                if(in_array('education_certification',$forms)){
-                    if(json_decode($user_info['education_certification'])){
-                        $education_certification = json_decode($user_info['education_certification'],true);
-                        foreach ($education_certification as $k => $v){
-                            if(array_key_exists('response',$v)){
-                                if(array_key_exists('path',$v['response'])){
-                                    $education_certification[$k]['url'] = $v['response']['path'];
-                                }
-                            }
-
-                        }
-                    }else{
-                        $education_certification = [];
-                    }
-                    $user_info['education_certification'] = $education_certification;
-                }
-                //如果有其他证明模块
-                if(in_array('other_certification',$forms)){
-                    if(json_decode($user_info['other_certification'])){
-                        $other_certification = json_decode($user_info['other_certification'],true);
-                        foreach ($other_certification as $k => $v){
-                            if(array_key_exists('response',$v)){
-                                if(array_key_exists('path',$v['response'])){
-                                    $other_certification[$k]['url'] = $v['response']['path'];
-                                }
-                            }
-
-                        }
-                    }else{
-                        $other_certification = [];
-                    }
-                    $user_info['other_certification'] = $other_certification;
-                }
-
-                //获取最新的报名审核信息
-                $logs = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',2)->orderBy('created_at','desc')->first();
-                if($logs){
-                    $user_info['audit_log'] = $logs->log;
-                }else{
-                    $user_info['audit_log'] = '';
-                }
-
-                //获取提交报名的次数
-//                $number = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',3)->count();
-//                $post_number = $number+1;//todo
-            }
-
-
-        }
-        else{
-            //实习专场
-            if(in_array('internship',$forms)){
-                $user_info = json_encode([
-                    'recruit_id' => $id,
-                    'operation' => 1,
-                    'realname' => '',
-                    'sex' => '1',
-                    'birthday' => '',
-                    'card' => '',
-                    'nation' => '',
-                    'native_place' => '',
-                    'political_affiliation' => '',
-                    'join_time' => '',
-                    'house_register' => '',
-                    'education' => '',
-                    'school' => '',
-                    'pro' => '',
-                    'adjust' => '',
-                    'mobile' => '',
-                    'email' => '',
-                    'address' => '',
-                    'post_id' => '',
-                    'concat_name' => '',
-                    'concat_mobile' => '',
-                    'resume' => '',
-                    'avatar' => '',
-                    'family' => [
-                        [
-                            'relation' => '',
-                            'realname' => '',
-                            'birthday' => '',
-                            'political_affiliation' => '',
-                            'work' => ''
-                        ]
-                    ],
-                    'detail' => [
-                        'rewards_and_punishments'   =>  '',
-                        'introduce'                 =>  ''
-                    ],
-                    'identification' => [],
-                    'education_certification' => [],
-                    'other_certification' => []
-                ]);
-            }else{
-                //如果没有,结合基础数据及模块表单信息,制作数据对象
-                $user_info = RecruitAppointBasic::where('uid',$uid)->first();
-                if(!$user_info){
-                    //没有基础信息跳转完善route('person.recruitInfo')
-                    return $this->showMessage('请先完善招考基础信息!', route('recruit.recruitInfo',array('recruit_id',$id)), true, '上一页', '3');
-                }
-                $user_info['sex'] = (string)$user_info['sex'];
-                $user_info['edu_type'] = (string)$user_info['edu_type'];
-                $user_info['family'] = json_decode($user_info['family']);
-                if(in_array('expand_special',$forms)){
-                    $user_info['special'] = [
-                        'point_apply'   =>  '0',
-                        'condition'     =>  '',
-                        'material'      =>  []
-                    ];
-                }
-                if(in_array('detail',$forms)){
-                    $user_info['detail'] = [
-                        'train'                     =>  '',
-                        'rewards_and_punishments'   =>  '',
-                        'introduce'                 =>  ''
-                    ];
-                }
-                if(in_array('identification',$forms)){
-                    $user_info['identification'] = [];
-                }
-                if(in_array('education_certification',$forms)){
-                    $user_info['education_certification'] = [];
-                }
-                if(in_array('other_certification',$forms)){
-                    $user_info['other_certification'] = [];
-                }
-                $user_info['recruit_id'] = $id;
-                $user_info['operation'] = 1;
-            }
-
-        }
-
-        //招考岗位
-        $where_post[] = ['recruit_id', '=', $id];
-        $where_post[] = ['status', '=', 1];
-        $recruit_post = RecruitPost::where($where_post)->get();
-        $post = [];
-        $post_limit = [];
-        foreach ($recruit_post as $value){
-            $item = [
-                'value' =>  $value['id'],
-                'label' =>  $value['code'] . " " . $value['name']
-            ];
-            $post_limit[$value['id']] = json_decode($value['limit']);
-            array_push($post,$item);
-        }
-
-        $view_data['appoint_info'] = $user_info;
-        $view_data['post'] = json_encode($post);
-//        $view_data['post_number'] = $post_number;
-//        $view_data['post_times'] = $recruit['post_times'];
-        $view_data['post_limit'] = json_encode($post_limit);
-        $view_data['formDisable'] = $formDisabled;
-        $view_data['title'] = $recruit->company;
-        return view('app.recruit.sign_up',$view_data);
-
-    }
-
-    /**
-     * 提交报名的处理程序
-     * @param Request $request
-     * @return array|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\think\response\Redirect|void
-     */
-    public function saveSignUp(Request $request)
-    {
-        $user = $this->getUser();
-        if (!empty($user)) {
-            $uid = $user->id;
-        } else {
-            return redirect(route('login'));
-        }
-
-        $recruit_id = $request->input('recruit_id', 0);
-        if (!$recruit_id) {
-            return response()->json(['status' => 0,'msg' => '请选择项目!']);
-        }
-        $recruit = Recruit::find($recruit_id);
-        if(!$recruit['status']){
-            return response()->json(['status' => 0,'msg' => '抱歉,该项目状态不正确,请联系客服!']);
-        }
-        if($recruit['current'] != 1){
-            return response()->json(['status' => 0,'msg' => '抱歉,该项目报名通道已关闭,如有疑问,请联系客服!']);
-        }
-        $time = time();
-        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
-        if(($time < strtotime($recruit['apply_start']) || strtotime($recruit['apply_end']) < $time)){//过了招考时间
-            if($appoint_info){
-                //如果有报名记录,先查询首次报名是什么时候
-                $first_post = RecruitAppointLog::where('type',3)->where('uid',$uid)->orderBy('created_at','asc')->first();
-                if(!$first_post){//没有记录代表只是暂存
-                    return response()->json(['status' => 0,'msg' => '抱歉,该项目已过报名时间!']);
-                }
-            }
-            if(!$appoint_info){
-                return response()->json(['status' => 0,'msg' => '抱歉,该项目已过报名时间!']);
-            }
-        }
-
-
-
-        //基础信息的检查
-        $rules = [
-            'realname' => 'required',
-            'sex' => 'required',
-            'birthday' => 'required',
-            'avatar' => 'required',
-            'nation' => 'required',
-            'native_place' => 'required',
-            'political_affiliation' => 'required',
-            'post_id'   =>  'required',
-            'house_register' => 'required',
-            //'edu_type' => 'required',
-            'education' => 'required',
-            'school' => 'required',
-            'address' => 'required',
-            'mobile' => 'required',
-            'email' => 'required',
-            'card' => 'required',
-            'concat_name' => 'required',
-            'concat_mobile' => 'required',
-            'resume' => 'required'
-        ];
-        $messages = [
-            'realname.required' => '请填写姓名',
-            'sex.required' => '请填写性别',
-            'birthday.required' => '请填写出生日期',
-            'avatar.required' => '请上传彩色免冠照',
-            'nation.required' => '请填写民族',
-            'native_place.required' => '请填写籍贯',
-            'political_affiliation.required' => '请选择政治面貌',
-            'post_id.required' => '请选择报名岗位',
-            'house_register.required' => '请填写户籍所在地',
-            //'edu_type.required' => '请选择教育类型',
-            'education.required' => '请输入学历',
-            'school.required' => '请输入毕业院校',
-            'address.required' => '请填写通信地址',
-            'mobile.required' => '请填写手机号码',
-            'email.required' => '请填写电子邮箱',
-            'card.required' => '请填写身份证号码',
-            'resume.required' => '请填写个人简历',
-            'concat_name.required' => '请填写联系人姓名',
-            'concat_mobile.required' => '请填写联系人手机号码'
-        ];
-        $create_data = $request->all();
-        $validator = Validator::make($create_data,$rules,$messages);
-        if ($validator->fails()) {
-            $msg = $validator->errors()->all();
-            return response()->json(['status' => 0,'msg' => $msg[0]]);
-        }else{
-            $data = $request->only('realname','sex','birthday','avatar','nation','native_place','political_affiliation','titles','join_time','work','house_register','education','school','degree','pro','address','card','mobile','email','concat_name','concat_mobile','resume','post_id','adjust','remark');
-            //身份证判断出生日期和性别
-            $year = substr($data['card'],6,4);
-            $month = substr($data['card'],10,2);
-            $day = substr($data['card'],12,2);
-            if($year.'-'.$month.'-'.$day != $data['birthday']){
-                $data['birthday'] = $year.'-'.$month.'-'.$day;
-            }
-            if(intval(substr($data['card'],16,1)) % 2 == 0){
-                $data['sex'] = 0;
-            }else{
-                $data['sex'] = 1;
-            }
-            $post_info = RecruitPost::where('id',$data['post_id'])->where('recruit_id',$recruit_id)->first();
-            if(!$post_info['status'] || $post_info['deleted_at'] != null){
-                return response()->json(['status' => 0,'msg' => '该岗位已失效']);
-            }
-            //获取操作符,是暂存还是提交
-            $operation = $request->input('operation');
-            if($operation == 1){
-                $data['audit'] = 0;//暂存
-            }else{
-                $data['audit'] = 1;//提交
-            }
-            if(!empty($post_info['limit']) && json_decode($post_info['limit'])){
-                //岗位限制条件的判断
-                $post_limit = json_decode($post_info['limit'],true);
-                if(is_array($post_limit)){
-                    foreach($post_limit as $k => $v){
-                        if($k == 'birthday'){
-                            $value = str_replace('-','',$data[$k]);
-                        }else{
-                            $value = $data[$k];
-                        }
-                        switch ($v['op']){
-                            case '=':
-                                if($value != $v['value']){
-                                    return response()->json(['status' => 0,'msg' => $v['msg']]);
-                                }
-                                break;
-                            case '>':
-                                if($value <= $v['value']){
-                                    return response()->json(['status' => 0,'msg' => $v['msg']]);
-                                }
-                                break;
-                            case '>=':
-                                if($value < $v['value']){
-                                    return response()->json(['status' => 0,'msg' => $v['msg']]);
-                                }
-                                break;
-                            case '<':
-                                if($value >= $v['value']){
-                                    return response()->json(['status' => 0,'msg' => $v['msg']]);
-                                }
-                                break;
-                            case '<=':
-                                if($value > $v['value']){
-                                    return response()->json(['status' => 0,'msg' => $v['msg']]);
-                                }
-                                break;
-                            case '!=':
-                                if($value == $v['value']){
-                                    return response()->json(['status' => 0,'msg' => $v['msg']]);
-                                }
-                                break;
-                            case 'like':
-                                if(strpos($value,$v['value']) === false){
-                                    return response()->json(['status' => 0,'msg' => $v['msg']]);
-                                }
-                                break;
-                            case 'in':
-                                if(strpos($v['value'],$value) === false){
-                                    return response()->json(['status' => 0,'msg' => $v['msg']]);
-                                }
-                                break;
-                        }
-                    }
-                }
-            }
-            //前置审核 判断完成,先将数据入报名信息基础表
-            //解析家庭成员数据
-            $familys = $request->input('family');
-            $family = [];
-            if(is_array($familys)){
-                foreach ($familys as $value){
-                    $item = [
-                        'relation'  =>  $value['relation'],
-                        'realname'  =>  $value['realname'],
-                        'birthday'  =>  $value['birthday'],
-                        'political_affiliation' =>  $value['political_affiliation'],
-                        'work'  =>  $value['work']
-                    ];
-                    array_push($family,$item);
-                }
-            }
-
-            $data['family'] = json_encode($family);
-            if($appoint_info){
-                //如果已有报名记录,进入修改阶段的处理流程
-                DB::beginTransaction();
-                try{
-                    RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->update($data);
-                    //分模块解析数据
-                    $forms = explode(',', $recruit['forms']);
-                    //如果有加分模块
-                    if(in_array('expand_special',$forms)){
-                        $special = $request->input('special');
-                        if($special['point_apply']){
-                            //删除掉没有成功返回路径的图片
-                            if(is_array($special['material'])){
-                                foreach ($special['material'] as $k => $v){
-                                    if(!array_key_exists('response',$v)){
-                                        unset($special['material'][$k]);
-                                    }
-                                }
-                            }
-                            $special['material'] = json_encode($special['material']);
-
-                        }else{
-                            $special['material'] = json_encode([]);
-                        }
-                        $hasRecord = RecruitAppointExpandSpecial::where('recruit_appoint_id',$appoint_info->id)->first();
-                        if($hasRecord){
-                            RecruitAppointExpandSpecial::where('recruit_appoint_id',$appoint_info->id)->update($special);
-                        }else{
-                            $special['recruit_appoint_id'] = $appoint_info->id;
-                            RecruitAppointExpandSpecial::create($special);
-                        }
-                    }
-                    //如果有详情模块
-                    if(in_array('detail',$forms) || in_array('internship',$forms)){
-                        $detail = $request->input('detail');
-                        $hasRecord = RecruitAppointDetail::where('recruit_appoint_id',$appoint_info->id)->first();
-                        if($hasRecord){
-                            RecruitAppointDetail::where('recruit_appoint_id',$appoint_info->id)->update($detail);
-                        }else{
-                            $detail['recruit_appoint_id'] = $appoint_info->id;
-                            RecruitAppointDetail::create($detail);
-                        }
-
-                    }
-                    //如果有身份证明模块
-                    if(in_array('identification',$forms) || in_array('internship',$forms)){
-                        $identification = $request->input('identification');
-                        if(is_array($identification)){
-                            //删除掉没有成功返回路径的图片
-                            foreach ($identification as $k => $v){
-                                if(!array_key_exists('response',$v)){
-                                    unset($identification[$k]);
-                                }
-                            }
-                        }
-                        $appoint_info->identification = json_encode($identification);
-                        $appoint_info->save();
-                    }
-                    //如果有教育证明模块
-                    if(in_array('education_certification',$forms) || in_array('internship',$forms)){
-                        $education_certification = $request->input('education_certification');
-                        if(is_array($education_certification)){
-                            //删除掉没有成功返回路径的图片
-                            foreach ($education_certification as $k => $v){
-                                if(!array_key_exists('response',$v)){
-                                    unset($education_certification[$k]);
-                                }
-                            }
-                        }
-                        $appoint_info->education_certification = json_encode($education_certification);
-                        $appoint_info->save();
-                    }
-                    //如果有其他证明模块
-                    if(in_array('other_certification',$forms) || in_array('internship',$forms)){
-                        $other_certification = $request->input('other_certification');
-                        if(is_array($other_certification)){
-                            //删除掉没有成功返回路径的图片
-                            foreach ($other_certification as $k => $v){
-                                if(!array_key_exists('response',$v)){
-                                    unset($other_certification[$k]);
-                                }
-                            }
-                        }
-
-                        if($other_certification){
-                            $appoint_info->other_certification = json_encode($other_certification);
-                            $appoint_info->save();
-                        }
-                    }
-                    DB::commit();
-                    if($operation == 2){
-                        $log = [
-                            'type'      =>  3,
-                            'appoint_id'=>  $appoint_info->id,
-                            'uid'       =>  $uid,
-                            'log'       =>  '用户提交报名'
-                        ];
-                        RecruitAppointLog::create($log);
-                        return ['status' => 1, 'msg' => '提交成功', 'data' => $appoint_info->id];
-                    }else{
-                        return ['status' => 1, 'msg' => '资料保存成功,请尽快完善并提交', 'data' => $appoint_info->id];
-                    }
-                } catch (\Exception $e){
-                    DB::rollback();
-                    return ['status' => 0, 'msg' => $e->getMessage()];
-                }
-            }else{
-                //没有报名记录,进入增加阶段的处理流程
-                DB::beginTransaction();
-                try{
-                    $data['uid'] = $uid;
-                    $data['recruit_id'] = $recruit_id;
-                    $result = RecruitAppointInfo::create($data);
-                    //分模块解析数据
-                    $forms = explode(',', $recruit['forms']);
-                    //如果有加分模块
-                    if(in_array('expand_special',$forms)){
-                        $special = $request->input('special');
-                        if($special['point_apply']){
-                            if(is_array($special['material'])){
-                                //删除掉没有成功返回路径的图片
-                                foreach ($special['material'] as $k => $v){
-                                    if(!array_key_exists('response',$v)){
-                                        unset($special['material'][$k]);
-                                    }
-                                }
-                            }
-                            $special['material'] = json_encode($special['material']);
-                        }
-                        $special['recruit_appoint_id'] = $result->id;
-                        RecruitAppointExpandSpecial::create($special);
-                    }
-                    //如果有详情模块
-                    if(in_array('detail',$forms)  || in_array('internship',$forms)){
-                        $detail = $request->input('detail');
-                        $detail['recruit_appoint_id'] = $result->id;
-                        RecruitAppointDetail::create($detail);
-                    }
-                    //如果有身份证明模块
-                    if(in_array('identification',$forms)  || in_array('internship',$forms)){
-                        $identification = $request->input('identification');
-                        if(is_array($identification)){
-                            //删除掉没有成功返回路径的图片
-                            foreach ($identification as $k => $v){
-                                if(!array_key_exists('response',$v)){
-                                    unset($identification[$k]);
-                                }
-                            }
-                        }
-
-                        $result->identification = json_encode($identification);
-                        $result->save();
-                    }
-                    //如果有教育证明模块
-                    if(in_array('education_certification',$forms)  || in_array('internship',$forms)){
-                        $education_certification = $request->input('education_certification');
-                        if(is_array($education_certification)){
-                            //删除掉没有成功返回路径的图片
-                            foreach ($education_certification as $k => $v){
-                                if(!array_key_exists('response',$v)){
-                                    unset($education_certification[$k]);
-                                }
-                            }
-                        }
-
-                        $result->education_certification = json_encode($education_certification);
-                        $result->save();
-                    }
-                    //如果有其他证明模块
-                    if(in_array('other_certification',$forms)  || in_array('internship',$forms)){
-                        $other_certification = $request->input('other_certification');
-
-                        if($other_certification){
-                            if(is_array($other_certification)){
-                                //删除掉没有成功返回路径的图片
-                                foreach ($other_certification as $k => $v){
-                                    if(!array_key_exists('response',$v)){
-                                        unset($other_certification[$k]);
-                                    }
-                                }
-                            }
-
-                            $result->other_certification = json_encode($other_certification);
-                            $result->save();
-                        }
-                    }
-                    DB::commit();
-                    if($operation == 2){
-                        $log = [
-                            'type'      =>  3,
-                            'appoint_id'=>  $result->id,
-                            'uid'       =>  $uid,
-                            'log'       =>  '用户首次提交报名'
-                        ];
-                        RecruitAppointLog::create($log);
-                        return ['status' => 1, 'msg' => '提交成功', 'data' => $result->id];
-                    }else{
-                        return ['status' => 1, 'msg' => '资料保存成功,请尽快完善并提交', 'data' => $result->id];
-                    }
-
-                } catch (\Exception $e){
-                    DB::rollback();
-                    return ['status' => 0, 'msg' => $e->getMessage()];
-                }
-            }
-        }
-
-    }
-
-    /**
-     * 获得当前登录的用户
-     * @return \Illuminate\Contracts\Auth\Authenticatable|null
-     */
-    public function getUser()
-    {
-        if (auth('web-member')->check()) {
-            $user = auth('web-member')->user();
-        } else {
-            $user = null;
-        }
-        return $user;
-    }
-
-    /**
-     * 检查用户基本信息
-     * @return array
-     */
-    public function checkUserBasicInfo()
-    {
-        $user = $this->getUser();
-        if (!empty($user)) {
-            $uid = $user->id;
-        } else {
-            $arr = ['status' => 401, 'msg'=>'请登录!'];
-            return $arr;
-        }
-        $info = RecruitAppointBasic::where('uid',$uid)->first();
-
-        if (empty($info)){
-            $arr = ['status'=>401,'msg'=>'请先完善招考基本信息','url'=> route('recruit.recruitInfo')];
-            return $arr;
-        }
-        return ['status' => 200, 'msg' => ''];
-
-    }
-
-    /**
-     * 个人中心招考页面
-     * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
-     */
-    public function person_recruit()
-    {
-        $user = auth('web-member')->user();
-        $list = RecruitAppointInfo::where('uid',$user->id)
-            ->join('recruit', 'recruit.id', '=', 'recruit_appoint_info.recruit_id', 'left')
-            ->join('recruit_post', 'recruit_post.id', '=', 'recruit_appoint_info.post_id', 'left')
-            ->select('recruit.name as recruit_name','recruit_appoint_info.*','recruit_post.code','recruit_post.name')
-            ->get();
-
-        return view('app.person.recruit')->with(['list' => $list,'total' => count($list)]);
-    }
-
-    /**
-     * 招考信息基础页
-     * @param Request $request
-     * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
-     */
-    public function recruit_info(Request $request)
-    {
-        $user = auth('web-member')->user();
-        $info = RecruitAppointBasic::where('uid',$user->id)->first();
-        if(!$info){
-            $info = [
-                'realname' => '',
-                'sex' => '0',
-                'birthday' => '',
-                'avatar' => '',
-                'nation' => '',
-                'native_place' => '',
-                'political_affiliation' => '',
-                'titles' => '',
-                'work' => '',
-                'house_register' => '',
-                'join_time' => '',
-                'edu_type' => '',
-                'education' => '',
-                'school' => '',
-                'degree' => '',
-                'pro' => '',
-                'address' => '',
-                'card' => '',
-                'mobile' => '',
-                'email' => '',
-                'concat_name' => '',
-                'concat_mobile' => '',
-                'resume' => '',
-                'family' => [
-                    [
-                        'relation' => '',
-                        'realname' => '',
-                        'birthday' => '',
-                        'political_affiliation' => '',
-                        'work' => ''
-                    ]
-                ],
-                'is_push' => '1'
-            ];
-        }else{
-            $info->sex = (string)$info->sex;
-            $info->edu_type = (string)$info->edu_type;
-            $info->is_push = (string)$info->is_push;
-            $info->family = empty($info->family) ? [[
-                                                        'relation' => '',
-                                                        'realname' => '',
-                                                        'birthday' => '',
-                                                        'political_affiliation' => '',
-                                                        'work' => ''
-                                                    ]] : json_decode($info->family);
-        }
-        $recruit_id = $request->input('recruit_id',0);
-        return view('app.person.recruit_info',[
-            'info'      =>  json_encode($info),
-            'recruit_id'=>  $recruit_id
-        ]);
-    }
-
-    /**
-     * 保存招考信息
-     * @param RecruitValidatorRequest $request
-     * @return \Illuminate\Http\JsonResponse
-     */
-    public function saveRecruitInfo(RecruitValidatorRequest $request)
-    {
-        $user = auth('web-member')->user();
-        $basic = RecruitAppointBasic::where('uid',$user->id)->first();
-        $data = $request->only('realname','sex','birthday','avatar','nation','native_place','political_affiliation','titles','work','house_register','join_time','education','school','degree','pro','address','card','mobile','email','concat_name','concat_mobile','resume','family','is_push');
-        if(count($data['family']) > 0){
-            $data['family'] = json_encode($data['family']);
-        }
-        if($basic){
-            //更新基础信息
-            $res = RecruitAppointBasic::where('uid',$user->id)->update($data);
-            if (!$res) {
-                return response()->json(['status'=>0,'msg'=>'保存失败,请联系客服']);
-            }else{
-                return response()->json(['status'=>1,'msg'=>'个人基础信息保存成功,快去报名吧!']);
-            }
-        }else{
-            //新增基础信息
-            $data['uid'] = $user->id;
-            $res = RecruitAppointBasic::create($data);
-            if (!$res) {
-                return response()->json(['status'=>0,'msg'=>'保存失败,请联系客服']);
-            }else{
-                return response()->json(['status'=>1,'msg'=>'个人基础信息保存成功,快去报名吧!']);
-            }
-        }
-
-
-    }
-
-    /**
-     * 笔试准考证
-     * @param Request $request
-     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
-     */
-    public function pen_ticket(Request $request)
-    {
-        $user = $this->getUser();
-        if (!empty($user)) {
-            $uid = $user->id;
-        } else {
-            return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
-        }
-        $recruit_id = $request->input('recruit_id');
-        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
-        if($appoint_info){
-            $pen_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',1)->first();
-            if($pen_ticket){
-                $time = time();
-                if(strtotime($pen_ticket->ex_start) < $time && strtotime($pen_ticket->ex_end) > $time){
-                    RecruitTicket::where('appoint_id',$appoint_info->id)->update(['ex_status' => 1]);
-                    $recruit = Recruit::where('id',$recruit_id)->first();
-                    $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
-                    $name = $recruit->name_en;
-                    $date = date("Y-m-d",strtotime($recruit->created_at));
-                    $filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
-                    $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/pen/" . $filename . '_create.pdf';
-                    if(file_exists($file)){
-                        header('Content-Description: File Transfer');
-                        header('Content-Type: application/octet-stream');
-                        header('Content-Disposition: attachment; filename='.basename($file));
-                        header('Content-Transfer-Encoding: binary');
-                        header('Expires: 0');
-                        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
-                        header('Pragma: public');
-                        header('Content-Length: ' . filesize($file));
-                        ob_clean();   //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
-                        flush();
-                        readfile($file);
-                    }
-                }else{
-                    return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
-                }
-            }else{
-                return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
-            }
-        }else{
-            return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
-        }
-    }
-
-    /**
-     * 审核准考证
-     * @param Request $request
-     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
-     */
-    public function check_ticket(Request $request)
-    {
-        $user = $this->getUser();
-        if (!empty($user)) {
-            $uid = $user->id;
-        } else {
-            return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
-        }
-        $recruit_id = $request->input('recruit_id');
-        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
-        if($appoint_info){
-            $check_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',2)->first();
-            if($check_ticket){
-                $time = time();
-                if(strtotime($check_ticket->ex_start) < $time && strtotime($check_ticket->ex_end) > $time){
-                    RecruitTicket::where('appoint_id',$appoint_info->id)->update(['ex_status' => 1]);
-                    $recruit = Recruit::where('id',$recruit_id)->first();
-                    $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
-                    $name = $recruit->name_en;
-                    $date = date("Y-m-d",strtotime($recruit->created_at));
-                    $filename = date("Y-m-18",time()) . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
-                    $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/check/" . $filename . '.pdf';
-                    if(file_exists($file)){
-                        header('Content-Description: File Transfer');
-                        header('Content-Type: application/octet-stream');
-                        header('Content-Disposition: attachment; filename='.basename($file));
-                        header('Content-Transfer-Encoding: binary');
-                        header('Expires: 0');
-                        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
-                        header('Pragma: public');
-                        header('Content-Length: ' . filesize($file));
-                        ob_clean();   //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
-                        flush();
-                        readfile($file);
-                    }
-                }else{
-                    return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
-                }
-            }else{
-                return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
-            }
-        }else{
-            return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
-        }
-    }
-
-    /**
-     * 面试准考证
-     * @param Request $request
-     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
-     */
-    public function face_ticket(Request $request)
-    {
-        $user = $this->getUser();
-        if (!empty($user)) {
-            $uid = $user->id;
-        } else {
-            return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
-        }
-        $recruit_id = $request->input('recruit_id');
-        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
-        if($appoint_info){
-            $face_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',3)->first();
-            if($face_ticket){
-                $time = time();
-                if(strtotime($face_ticket->ex_start) < $time && strtotime($face_ticket->ex_end) > $time){
-                    RecruitTicket::where('id',$face_ticket->id)->update(['ex_status' => 1]);
-                    $recruit = Recruit::where('id',$recruit_id)->first();
-                    $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
-                    $name = $recruit->name_en;
-                    $date = date("Y-m-d",strtotime($recruit->created_at));
-                    $filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id].'_create';
-                    $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/face/" . $filename . '.pdf';
-                    if(file_exists($file)){
-                        header('Content-Description: File Transfer');
-                        header('Content-Type: application/octet-stream');
-                        header('Content-Disposition: attachment; filename='.basename($file));
-                        header('Content-Transfer-Encoding: binary');
-                        header('Expires: 0');
-                        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
-                        header('Pragma: public');
-                        header('Content-Length: ' . filesize($file));
-                        ob_clean();   //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
-                        flush();
-                        readfile($file);
-                    }
-                }else{
-                    return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
-                }
-            }else{
-                return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
-            }
-
-        }else{
-            return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
-        }
-    }
-
-    /**
-     * 复试准考证
-     * @param Request $request
-     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
-     */
-    public function reexamine_ticket(Request $request)
-    {
-        $user = $this->getUser();
-        if (!empty($user)) {
-            $uid = $user->id;
-        } else {
-            return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
-        }
-        $recruit_id = $request->input('recruit_id');
-        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
-        if($appoint_info){
-            $reexamine_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',4)->first();
-            if($reexamine_ticket){
-                $time = time();
-                if(strtotime($reexamine_ticket->ex_start) < $time && strtotime($reexamine_ticket->ex_end) > $time){
-                    RecruitTicket::where('id',$reexamine_ticket->id)->update(['ex_status' => 1]);
-                    $recruit = Recruit::where('id',$recruit_id)->first();
-                    $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
-                    $name = $recruit->name_en;
-                    $date = date("Y-m-d",strtotime($recruit->created_at));
-                    $filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id].'_create';
-                    $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/face/" . $filename . '.pdf';
-                    if(file_exists($file)){
-                        header('Content-Description: File Transfer');
-                        header('Content-Type: application/octet-stream');
-                        header('Content-Disposition: attachment; filename='.basename($file));
-                        header('Content-Transfer-Encoding: binary');
-                        header('Expires: 0');
-                        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
-                        header('Pragma: public');
-                        header('Content-Length: ' . filesize($file));
-                        ob_clean();   //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
-                        flush();
-                        readfile($file);
-                    }
-                }else{
-                    return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
-                }
-            }else{
-                return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
-            }
-
-        }else{
-            return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
-        }
-    }
-
-    /**
-     * 材料补登
-     * @param Request $request
-     */
-    public function material_supplement(Request $request)
-    {
-        $user = $this->getUser();
-        if (!empty($user)) {
-            $uid = $user->id;
-        } else {
-            return redirect(route('login'));
-        }
-
-        //招考id
-        $id = $request->input('id', 0);
-        if (!$id) {
-            return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
-        }
-        $recruit = Recruit::find($id);
-        if(!$recruit['status'] && !$user->recruit_test){
-            return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
-        }
-
-        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
-        if(!$appoint_info){
-            return $this->showMessage('抱歉,您没有报名,无需考察审核!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
-        }
-        if($appoint_info->pen_audit != 1){
-            return $this->showMessage('抱歉,您未入闱,无需考察审核!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
-        }
-
-        $uids = [];
-        $limit_time = 1654075800;
-        if(in_array($uid,$uids)){
-            $limit_time = 1654162200;
-        }
-        $time = time();
-        if( $time > $limit_time){
-            return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
-        }
-
-        $info = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
-        if(!$info){
-            $info = [
-                'appoint_id' => $appoint_info->id,
-                'identification' => '',
-                'household_register' => '',
-                'education_certification' => '',
-                //'family_planning' => '',
-                'manage' => '',
-                'status' => 3
-            ];
-        }else{
-            $info = $info->toArray();
-            if(json_decode($info['identification'])){
-                $identification = json_decode($info['identification'],true);
-                foreach ($identification as $k => $v){
-                    if(array_key_exists('response',$v)){
-                        $identification[$k]['url'] = $v['response']['path'];
-                    }
-                }
-            }else{
-                $identification = [];
-            }
-            $info['identification'] = $identification;
-
-            if(json_decode($info['household_register'])){
-                $household_register = json_decode($info['household_register'],true);
-                foreach ($household_register as $k => $v){
-                    if(array_key_exists('response',$v)){
-                        $household_register[$k]['url'] = $v['response']['path'];
-                    }
-                }
-            }else{
-                $household_register = [];
-            }
-            $info['household_register'] = $household_register;
-
-            if(json_decode($info['education_certification'])){
-                $education_certification = json_decode($info['education_certification'],true);
-                foreach ($education_certification as $k => $v){
-                    if(array_key_exists('response',$v)){
-                        $education_certification[$k]['url'] = $v['response']['path'];
-                    }
-                }
-            }else{
-                $education_certification = [];
-            }
-            $info['education_certification'] = $education_certification;
-
-            if(json_decode($info['family_planning'])){
-                $family_planning = json_decode($info['family_planning'],true);
-                foreach ($family_planning as $k => $v){
-                    if(array_key_exists('response',$v)){
-                        $family_planning[$k]['url'] = $v['response']['path'];
-                    }
-                }
-            }else{
-                $family_planning = [];
-            }
-            $info['family_planning'] = $family_planning;
-
-            if(json_decode($info['manage'])){
-                $manage = json_decode($info['manage'],true);
-                foreach ($manage as $k => $v){
-                    if(array_key_exists('response',$v)){
-                        $manage[$k]['url'] = $v['response']['path'];
-                    }
-                }
-            }else{
-                $manage = [];
-            }
-            $info['manage'] = $manage;
-
-        }
-
-        $view_data['info'] = json_encode($info);
-        $view_data['title'] = $recruit->company;
-        return view('app.recruit.supplement',$view_data);
-    }
-
-    /**
-     * 健康信息登记
-     * @param Request $request
-     */
-    public function health_info(Request $request)
-    {
-        $user = $this->getUser();
-        if (!empty($user)) {
-            $uid = $user->id;
-        } else {
-            return redirect(route('login'));
-        }
-
-        //招考id
-        $id = $request->input('id', 0);
-        if (!$id) {
-            return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
-        }
-        $recruit = Recruit::find($id);
-        if(!$recruit['status'] && !$user->recruit_test){
-            return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
-        }
-
-        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
-        if(!$appoint_info){
-            return $this->showMessage('抱歉,您没有报名,无需登记!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
-        }
-        if($appoint_info->audit != 3){
-            return $this->showMessage('抱歉,您无需登记!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
-        }
-
-        $time = time();
-        if($time > 1653184800){
-            return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
-        }
-
-        $info = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
-        if(!$info){
-            $info = [
-                'appoint_id' => $appoint_info->id,
-                'health_code' => '',
-                'trip_code' => ''
-            ];
-        }else{
-            $info = $info->toArray();
-            if(json_decode($info['health_code'])){
-                $health_code = json_decode($info['health_code'],true);
-                foreach ($health_code as $k => $v){
-                    if(array_key_exists('response',$v)){
-                        $health_code[$k]['url'] = $v['response']['path'];
-                    }
-                }
-            }else{
-                $health_code = [];
-            }
-            $info['health_code'] = $health_code;
-
-            if(json_decode($info['trip_code'])){
-                $trip_code = json_decode($info['trip_code'],true);
-                foreach ($trip_code as $k => $v){
-                    if(array_key_exists('response',$v)){
-                        $trip_code[$k]['url'] = $v['response']['path'];
-                    }
-                }
-            }else{
-                $trip_code = [];
-            }
-            $info['trip_code'] = $trip_code;
-
-        }
-
-        $view_data['info'] = json_encode($info);
-        $view_data['title'] = $recruit->company;
-        return view('app.recruit.health',$view_data);
-    }
-
-    public function save_supplement(Request $request)
-    {
-        $user = $this->getUser();
-        if (!empty($user)) {
-            $uid = $user->id;
-        } else {
-            return redirect(route('login'));
-        }
-        $appoint_id = $request->input('appoint_id');
-        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',16)->where('id',$appoint_id)->first();
-        if(!$appoint_info){
-            return ['status' => 0, 'msg' => '抱歉,找不到您要补登的报名记录!'];
-        }
-        $info = RecruitSupplement::where('appoint_id',$appoint_id)->first();
-        if($info){
-            if($info->status == 1){
-                return ['status' => 0, 'msg' => '材料已审核通过,不允许修改'];
-            }
-            if($info->status == 0){
-                return ['status' => 0, 'msg' => '材料审核中,不允许修改'];
-            }
-            //身份证明
-            $identification = $request->input('identification');
-            if(is_array($identification)){
-                //删除掉没有成功返回路径的图片
-                foreach ($identification as $k => $v){
-                    if(!array_key_exists('response',$v)){
-                        unset($identification[$k]);
-                    }
-                }
-            }
-            $info->identification = json_encode($identification);
-            //户口簿
-            $household_register = $request->input('household_register');
-            if(is_array($household_register)){
-                //删除掉没有成功返回路径的图片
-                foreach ($household_register as $k => $v){
-                    if(!array_key_exists('response',$v)){
-                        unset($household_register[$k]);
-                    }
-                }
-            }
-            $info->household_register = json_encode($household_register);
-            //学信网
-            $education_certification = $request->input('education_certification');
-            if(is_array($education_certification)){
-                //删除掉没有成功返回路径的图片
-                foreach ($education_certification as $k => $v){
-                    if(!array_key_exists('response',$v)){
-                        unset($education_certification[$k]);
-                    }
-                }
-            }
-            $info->education_certification = json_encode($education_certification);
-            //计生
-//            $family_planning = $request->input('family_planning');
-//            if(is_array($family_planning)){
-//                //删除掉没有成功返回路径的图片
-//                foreach ($family_planning as $k => $v){
-//                    if(!array_key_exists('response',$v)){
-//                        unset($family_planning[$k]);
-//                    }
-//                }
-//            }
-//            $info->family_planning = json_encode($family_planning);
-            //综治
-            $manage = $request->input('manage');
-            if(is_array($manage)){
-                //删除掉没有成功返回路径的图片
-                foreach ($manage as $k => $v){
-                    if(!array_key_exists('response',$v)){
-                        unset($manage[$k]);
-                    }
-                }
-            }
-            $info->manage = json_encode($manage);
-            $info->status = 0;
-            $info->save();
-            $appoint_info->political_audit = 4;
-            $appoint_info->save();
-            return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
-        }else{
-            $data['appoint_id'] = $appoint_id;
-            //身份证明
-            $identification = $request->input('identification');
-            if(is_array($identification)){
-                //删除掉没有成功返回路径的图片
-                foreach ($identification as $k => $v){
-                    if(!array_key_exists('response',$v)){
-                        unset($identification[$k]);
-                    }
-                }
-            }
-            $data['identification'] = json_encode($identification);
-            //户口簿
-            $household_register = $request->input('household_register');
-            if(is_array($household_register)){
-                //删除掉没有成功返回路径的图片
-                foreach ($household_register as $k => $v){
-                    if(!array_key_exists('response',$v)){
-                        unset($household_register[$k]);
-                    }
-                }
-            }
-            $data['household_register'] = json_encode($household_register);
-            //学信网
-            $education_certification = $request->input('education_certification');
-            if(is_array($education_certification)){
-                //删除掉没有成功返回路径的图片
-                foreach ($education_certification as $k => $v){
-                    if(!array_key_exists('response',$v)){
-                        unset($education_certification[$k]);
-                    }
-                }
-            }
-            $data['education_certification'] = json_encode($education_certification);
-            //计生
-//            $family_planning = $request->input('family_planning');
-//            if(is_array($family_planning)){sp
-//                //删除掉没有成功返回路径的图片
-//                foreach ($family_planning as $k => $v){
-//                    if(!array_key_exists('response',$v)){
-//                        unset($family_planning[$k]);
-//                    }
-//                }
-//            }
-//            $data['family_planning'] = json_encode($family_planning);
-            //综治
-            $manage = $request->input('manage');
-            if(is_array($manage)){
-                //删除掉没有成功返回路径的图片
-                foreach ($manage as $k => $v){
-                    if(!array_key_exists('response',$v)){
-                        unset($manage[$k]);
-                    }
-                }
-            }
-            $data['manage'] = json_encode($manage);
-            $data['status'] = 0;
-            $result = RecruitSupplement::create($data);
-            $appoint_info->political_audit = 4;
-            $appoint_info->save();
-            return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
-        }
-
-        return ['status' => 0, 'msg' => 'test', 'data' => ''];
-    }
-
-    public function save_healthinfo(Request $request)
-    {
-        $user = $this->getUser();
-        if (!empty($user)) {
-            $uid = $user->id;
-        } else {
-            return redirect(route('login'));
-        }
-        $appoint_id = $request->input('appoint_id');
-        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',16)->where('id',$appoint_id)->first();
-        if(!$appoint_info){
-            return ['status' => 0, 'msg' => '抱歉,找不到您要登记的报名记录!'];
-        }
-        $info = RecruitSupplement::where('appoint_id',$appoint_id)->first();
-        if($info){
-            if($info->h_status == 1){
-                return ['status' => 0, 'msg' => '材料已审核通过,不允许修改'];
-            }
-            if($info->h_status == 0){
-                return ['status' => 0, 'msg' => '材料审核中,不允许修改'];
-            }
-            $health_code = $request->input('health_code');
-            if(is_array($health_code)){
-                //删除掉没有成功返回路径的图片
-                foreach ($health_code as $k => $v){
-                    if(!array_key_exists('response',$v)){
-                        unset($health_code[$k]);
-                    }
-                }
-            }
-            $info->health_code = json_encode($health_code);
-
-            $trip_code = $request->input('trip_code');
-            if(is_array($trip_code)){
-                //删除掉没有成功返回路径的图片
-                foreach ($trip_code as $k => $v){
-                    if(!array_key_exists('response',$v)){
-                        unset($trip_code[$k]);
-                    }
-                }
-            }
-            $info->trip_code = json_encode($trip_code);
-
-            $info->save();
-            return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
-        }else{
-            $data['appoint_id'] = $appoint_id;
-            $health_code = $request->input('health_code');
-            if(is_array($health_code)){
-                //删除掉没有成功返回路径的图片
-                foreach ($health_code as $k => $v){
-                    if(!array_key_exists('response',$v)){
-                        unset($health_code[$k]);
-                    }
-                }
-            }
-            $data['health_code'] = json_encode($health_code);
-
-            $trip_code = $request->input('trip_code');
-            if(is_array($trip_code)){
-                //删除掉没有成功返回路径的图片
-                foreach ($trip_code as $k => $v){
-                    if(!array_key_exists('response',$v)){
-                        unset($trip_code[$k]);
-                    }
-                }
-            }
-            $data['trip_code'] = json_encode($trip_code);
-
-            $data['h_status'] = 0;
-            RecruitSupplement::create($data);
-            $appoint_info->health_audit = 4;
-            $appoint_info->save();
-            return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
-        }
-
-        return ['status' => 0, 'msg' => 'test', 'data' => ''];
-    }
-
-    public function interviewer_random(Request $request)
-    {
-        $model = $request->input('model',1);
-        $number1 = $request->input('number1',5);//考官人数
-        $number2 = $request->input('number2',1);//替补人数
-        $where[] = ['id','>',0];
-        switch ($model){
-            case '0':
-                $list = DB::table('recruit_interviewer')->get()->toArray();
-                shuffle($list);
-                $result = array_slice($list, 0, $number1+$number2);
-                break;
-            case '1':
-                $list = DB::table('recruit_interviewer')->get()->toArray();
-                shuffle($list);
-                $count = $number1;
-                for ($i = 0; $i < $count; $i++){
-                    if(!$list[$i]->status){
-                        $list[] = $list[$i];
-                        unset($list[$i]);
-                        $count++;
-                    }
-                }
-                $result = array_slice($list, 0, $number1+$number2);
-                break;
-            case '2':
-                $list = DB::table('recruit_interviewer')->where('status',1)->get()->toArray();
-                shuffle($list);
-                $result = array_slice($list, 0, $number1+$number2);
-                break;
-            default:
-                $list = DB::table('recruit_interviewer')->get()->toArray();
-                shuffle($list);
-                for ($i = 0; $i < $number1; $i++){
-                    dd($list[$i]);
-                    if(!$list[$i]->status){
-                        $list[] = $list[$i];
-                        unset($list[$i]);
-                    }
-                }
-                $result = array_slice($list, 0, $number1+$number2);
-                break;
-        }
-
-        $return_data = [
-            'list' => $result,
-            'number1'  => $number1,
-            'number2' => $number2
-        ];
-
-        return view('app.recruit.interviewer', $return_data);
-    }
-
+<?php
+namespace App\Http\Controllers\Web\Recruit;
+
+use App\Http\Controllers\Web\WebBaseController;
+use App\Models\RecruitAppointLog;
+use App\Models\RecruitTicket;
+use App\Validators\RecruitValidatorRequest;
+use Illuminate\Http\Request;
+use App\Models\Recruit;
+use App\Services\Recruit\RecruitService;
+use App\Models\RecruitAppointBasic;
+use App\Models\RecruitSupplement;
+use App\Models\RecruitPost;
+use App\Models\RecruitAppointInfo;
+use think\Route;
+use Illuminate\Support\Facades\Validator;
+use Illuminate\Support\Facades\DB;
+use App\Models\RecruitAppointExpandSpecial;
+use App\Models\RecruitAppointDetail;
+use App\Models\RecruitArticle;
+use Illuminate\Support\Facades\Cache;
+
+class IndexController extends WebBaseController
+{
+
+    protected $recruitService;
+
+    public function __construct(RecruitService $recruitService)
+    {
+        $this->recruitService = $recruitService;
+    }
+
+    /**
+     * 招考列表页
+     * @param Request $request
+     * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
+     */
+    public function index(Request $request)
+    {
+        $key = $request->input('key');
+        $list = $this->recruitService->getRecruit($key, 10);
+
+        $return_data = [
+            'list' => $list,
+            'key'  => $key,
+        ];
+
+        return view('app.recruit.index', $return_data);
+    }
+
+    /**
+     * 招考详情页
+     * @param Request $request
+     * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View|mixed|\think\response\Redirect|\think\response\View|void
+     */
+    public function show(Request $request)
+    {
+        $user = $this->getUser();
+        if($user){
+            $uid = $user->id;
+            $utype = $user->utype;
+        }else{
+            $uid = 0;
+            $utype = 0;
+        }
+        $id = $request->input('id', 0);
+        if (empty($id)) {
+            return $this->showMessage('抱歉,请输入指定的招考场次!', route('recruit.list'), true, '上一页', '2');
+        }
+        $recruit = Recruit::find($id);
+        if (empty($recruit)) {
+            return redirect(route('/recruit/list'));
+        }
+        $info = Recruit::parse_info($recruit);
+        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
+        if(!$info->isApply && $appoint_info){
+            $first_post = RecruitAppointLog::where('type',3)->where('uid',$uid)->orderBy('created_at','asc')->first();
+            if($first_post){
+                $info->isApply = 1;
+            }
+        }
+        if($appoint_info){
+            //笔试
+            $pen_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',1)->first();
+            if($pen_ticket){
+                $time = time();
+                if(strtotime($pen_ticket->ex_start) < $time && strtotime($pen_ticket->ex_end) > $time){
+                    $appoint_info->pen_ticket = 1;
+                }else{
+                    $appoint_info->pen_ticket = -1;
+                }
+            }else{
+                $appoint_info->pen_ticket = 0;
+            }
+            //考核测试
+            $check_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',2)->first();
+            if($check_ticket){
+                $time = time();
+                if(strtotime($check_ticket->ex_start) < $time && strtotime($check_ticket->ex_end) > $time){
+                    $appoint_info->check_ticket = 1;
+                }else{
+                    $appoint_info->check_ticket = -1;
+                }
+            }else{
+                $appoint_info->check_ticket = 0;
+            }
+            //面试
+            $face_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',3)->first();
+
+            if($face_ticket && $appoint_info->face_audit == -1){
+                $appoint_info->face_ticket = 1;
+            }else{
+                $appoint_info->face_ticket = 0;
+            }
+
+            //复试
+            $reexamine_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',4)->first();
+
+            if($reexamine_ticket && $appoint_info->reexamine_audit == -1){
+                $appoint_info->reexamine_ticket = 1;
+            }else{
+                $appoint_info->reexamine_ticket = 0;
+            }
+        }else{
+            $appoint_info = new \stdClass();
+            $appoint_info->pen_audit = 0;
+            $appoint_info->post_id = 0;
+            $appoint_info->pen_ticket = 0;
+            $appoint_info->computer_ticket = 0;
+            $appoint_info->face_ticket = 0;
+            $appoint_info->check_ticket = 0;
+            $appoint_info->reexamine_ticket = 0;
+            $appoint_info->realname = '';
+            $appoint_info->card = '';
+            $appoint_info->mobile = '';
+            $appoint_info->sex = 0;
+        }
+
+        $notice = $request->input('notice',0);
+        if($notice){
+            $public_notice_switch = 0;
+            $public_notice = RecruitArticle::where('id',$notice)->where('released_at','<',time())->first();
+            if (!empty($info)) {
+                $view_data = [
+                    'recruit' => $recruit,
+                    'info' => $info,
+                    'uid' => $uid,
+                    'utype' => $utype,
+                    'public_notice' => $public_notice,
+                    'public_notice_switch' => $public_notice_switch,
+                    'appoint_info' => $appoint_info
+                ];
+                return view('app.recruit.show')->with($view_data);
+            } else {
+                return back();
+            }
+        }else{
+            $list = RecruitArticle::where('recruit_id',$id)->orderBy('created_at','desc')->where('released_at','<',time())->get();
+            $public_notice_switch = 1;//有补充公告的模式
+            if (!empty($info)) {
+                $view_data = [
+                    'recruit' => $recruit,
+                    'info' => $info,
+                    'uid' => $uid,
+                    'utype' => $utype,
+                    'list' => $list,
+                    'public_notice_switch' => $public_notice_switch,
+                    'appoint_info' => $appoint_info
+                ];
+                return view('app.recruit.show')->with($view_data);
+            } else {
+                return back();
+            }
+        }
+
+    }
+
+    /**
+     * 上传文件的方法
+     * @param Request $request
+     * @return \Illuminate\Http\JsonResponse
+     */
+    public function upload(Request $request)
+    {
+        $user = $this->getUser();
+        if($user){
+            $uid = $user->id;
+            $utype = $user->utype;
+        }else{
+            $uid = 0;
+            $utype = 0;
+        }
+        $file = $request->file('file');
+        if ($file->isValid()) { //判断文件是否存在
+            //获取文件的扩展名
+            $ext = $file->getClientOriginalExtension();
+
+            if (!in_array(strtolower($ext), ['jpg', 'jpeg', 'png', 'doc', 'docx', 'pdf'])) {
+                $res['status'] = 0;
+                $res['msg']    = '文件格式不正确';
+            } else {
+                //获取文件的绝对路径
+                $path = $file->getRealPath();
+
+                $oldname = $file->getClientOriginalName();
+
+                //定义文件名
+                $filename = 'storage/recruit/' . uniqid() . mt_rand(10000, 99999) . '.' . $ext;
+
+                //存储文件。disk里面的public。总的来说,就是调用disk模块里的public配置
+                Storage::disk('public')->put($filename, file_get_contents($path));
+
+                $res['status']   = 1;
+                $res['filename'] = $oldname;
+                $res['path']     = "/storage/" . $filename;
+                $res['msg']      = '上传成功';
+            }
+        } else {
+            $res['status'] = 0;
+            $res['msg']    = '上传失败';
+        }
+        return response()->json($res);
+    }
+
+    /**
+     * 查看报名人数统计
+     * @param Request $request
+     * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View|mixed|\think\response\Redirect|\think\response\View|void
+     */
+    public function sign_up_count(Request $request)
+    {
+        $user = $this->getUser();
+        if($user){
+            $uid = $user->id;
+            $utype = $user->utype;
+        }else{
+            $uid = 0;
+            $utype = 0;
+        }
+        $id = $request->input('id', 0);
+        $refresh = $request->input('refresh', '');
+        if (empty($id)) {
+            return $this->showMessage('抱歉,请输入指定的招考场次!', route('recruit.list'), true, '上一页', '2');
+        }
+        $recruit = Recruit::find($id);
+        if (empty($recruit)) {
+            return redirect(route('/recruit/list'));
+        }
+        if(!$recruit->show_report){
+            return $this->showMessage('抱歉,该场次不允许查看报名人数统计结果!', route('recruit.list'), true, '上一页', '2');
+        }
+        if(Cache::has("sign_up_count_{$recruit->id}") && $refresh != 'jjhc2019') {
+            $cache_data = Cache::get("sign_up_count_{$recruit->id}");
+            $list = $cache_data['list'];
+            $time = $cache_data['time'];
+        }else{
+            $list = RecruitPost::where('recruit_id',$recruit->id)->where('status',1)->get();
+            if(!$list){
+                return $this->showMessage('抱歉,数据暂时未更新或更新出错!', route('recruit.list'), true, '上一页', '2');
+            }
+            foreach ($list as $k => $v){
+                $res = RecruitAppointInfo::select(DB::raw("count(case audit when 1 then 1 end) as 'checking', count(case audit when 2 then 2 end) as 'fail',count(case audit when 3 then 3 end) as 'success'"))->where('recruit_id',$recruit->id)->where('post_id',$v->id)->first();
+                $list[$k]['checking'] = $res->checking;
+                $list[$k]['fail'] = $res->fail;
+                $list[$k]['success'] = $res->success;
+            }
+            $time = date('Y-m-d H:i',time());
+            $cache_data = [
+                'list' => $list,
+                'time' => $time
+            ];
+            Cache::put("sign_up_count_{$recruit->id}",$cache_data,60);
+        }
+
+        $view_data = [
+            'list'  => $list,
+            'time' => $time
+        ];
+        return view('app.recruit.sign_up_count')->with($view_data);
+    }
+
+    /**
+     *  报名功能页
+     * @param Request $request
+     * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View|mixed|\think\response\Redirect|\think\response\View|void
+     */
+    public function sign_up(Request $request)
+    {
+        $user = $this->getUser();
+        if (!empty($user)) {
+            $uid = $user->id;
+        } else {
+            return redirect(route('login'));
+        }
+
+        //招考id
+        $id = $request->input('id', 0);
+        if (!$id) {
+            return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
+        }
+
+        //招考信息
+        $recruit = Recruit::find($id);
+        if(!$recruit['status'] && !$user->recruit_test){
+            return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
+        }
+        if($recruit['current'] != 1){
+            return $this->showMessage('抱歉,该项目报名通道已关闭,如有疑问,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
+        }
+        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
+        $time = time();
+        $formDisabled = 0;
+        if(($time < strtotime($recruit['apply_start']) || strtotime($recruit['apply_end']) < $time)){//过了招考时间
+            if(!in_array($uid,[161027,59041])){
+                if(!$appoint_info){
+                    return $this->showMessage('抱歉,该项目已过报名时间或尚未开始!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
+                }
+                if($appoint_info){
+                    //如果有报名记录,先查询首次报名是什么时候
+                    $first_post = RecruitAppointLog::where('type',3)->where('uid',$uid)->where('appoint_id',$appoint_info->id)->orderBy('created_at','asc')->first();
+                    if(!$first_post){//没有记录代表只是暂存
+                        return $this->showMessage('抱歉,该项目已过报名时间或尚未开始!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
+                    }
+//                $has_late_post = RecruitAppointLog::where('type',3)->where('uid',$uid)->where('created_at','>',$recruit['apply_end'])->first();//查找在过了报名时间后,有报名记录,且仍是审核失败的报名记录,看其是否在报名时间后是否有再次提交的记录
+//                if($has_late_post){
+//                    $formDisabled = 1;
+//                }else{
+//                    $formDisabled = 0;
+//                }
+                }
+            }
+
+        }
+
+        $view_data['module'] = $forms = explode(',', $recruit['forms']);
+        //查询报名表是否已有记录
+        if($appoint_info){
+            if(in_array('internship',$forms)) {
+                //如果已有该场次的报名记录,读取录入的数据集合
+                $user_info = $appoint_info;
+                $user_info['sex'] = (string)$user_info['sex'];
+                $user_info['adjust'] = (string)$user_info['adjust'];
+                $user_info['edu_type'] = (string)$user_info['edu_type'];
+                $user_info['family'] = json_decode($user_info['family']);
+                $detail = RecruitAppointDetail::where('recruit_appoint_id',$user_info['id'])->first();
+                if($detail){
+                    $user_info['detail'] = $detail->toArray();
+                }else{
+                    $user_info['detail'] = [
+                        'rewards_and_punishments' => '',
+                        'introduce' => ''
+                    ];
+                }
+                if(json_decode($user_info['identification'])){
+                    $identification = json_decode($user_info['identification'],true);
+                    foreach ($identification as $k => $v){
+                        if(array_key_exists('response',$v)){
+                            $identification[$k]['url'] = $v['response']['path'];
+                        }
+
+                    }
+                }else{
+                    $identification = [];
+                }
+                $user_info['identification'] = $identification;
+                if(json_decode($user_info['education_certification'])){
+                    $education_certification = json_decode($user_info['education_certification'],true);
+                    foreach ($education_certification as $k => $v){
+                        if(array_key_exists('response',$v)){
+                            $education_certification[$k]['url'] = $v['response']['path'];
+                        }
+
+                    }
+                }else{
+                    $education_certification = [];
+                }
+                $user_info['education_certification'] = $education_certification;
+
+                if(json_decode($user_info['other_certification'])){
+                    $other_certification = json_decode($user_info['other_certification'],true);
+                    foreach ($other_certification as $k => $v){
+                        if(array_key_exists('response',$v)){
+                            $other_certification[$k]['url'] = $v['response']['path'];
+                        }
+
+                    }
+                }else{
+                    $other_certification = [];
+                }
+                $user_info['other_certification'] = $other_certification;
+
+                //获取最新的报名审核信息
+                $logs = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',2)->orderBy('created_at','desc')->first();
+                if($logs){
+                    $user_info['audit_log'] = $logs->log;
+                }else{
+                    $user_info['audit_log'] = '';
+                }
+
+            }else{
+                //如果已有该场次的报名记录,读取录入的数据集合
+                $user_info = $appoint_info;
+                $user_info['sex'] = (string)$user_info['sex'];
+                $user_info['edu_type'] = (string)$user_info['edu_type'];
+                $user_info['family'] = json_decode($user_info['family']);
+                if(in_array('expand_special',$forms)){
+                    $special = RecruitAppointExpandSpecial::where('recruit_appoint_id',$user_info['id'])->first();
+                    if(json_decode($special['material'])){
+                        $material = json_decode($special['material'],true);
+                        foreach ($material as $k => $v){
+                            if(array_key_exists('response',$v)){
+                                if(array_key_exists('path',$v['response'])){
+                                    $material[$k]['url'] = $v['response']['path'];}
+
+                            }
+                        }
+                    }else{
+                        $material = [];
+                    }
+                    $user_info['special'] = [
+                        'point_apply'   =>  (string)$special['point_apply'],
+                        'condition'     =>  $special['condition'],
+                        'material'      =>  $material
+                    ];
+                }
+                if(in_array('detail',$forms)){
+                    $detail = RecruitAppointDetail::where('recruit_appoint_id',$user_info['id'])->first();
+                    if($detail){
+                        $user_info['detail'] = $detail->toArray();
+                    }else{
+                        $user_info['detail'] = [
+                            'train' =>  '',
+                            'rewards_and_punishments' => '',
+                            'introduce' => ''
+                        ];
+                    }
+                }
+                //如果有身份证明模块
+                if(in_array('identification',$forms)){
+                    if(json_decode($user_info['identification'])){
+                        $identification = json_decode($user_info['identification'],true);
+                        foreach ($identification as $k => $v){
+                            if(array_key_exists('response',$v)){
+                                if(array_key_exists('path',$v['response'])){
+                                    $identification[$k]['url'] = $v['response']['path'];
+                                }
+                            }
+
+                        }
+                    }else{
+                        $identification = [];
+                    }
+                    $user_info['identification'] = $identification;
+                }
+                //如果有教育证明模块
+                if(in_array('education_certification',$forms)){
+                    if(json_decode($user_info['education_certification'])){
+                        $education_certification = json_decode($user_info['education_certification'],true);
+                        foreach ($education_certification as $k => $v){
+                            if(array_key_exists('response',$v)){
+                                if(array_key_exists('path',$v['response'])){
+                                    $education_certification[$k]['url'] = $v['response']['path'];
+                                }
+                            }
+
+                        }
+                    }else{
+                        $education_certification = [];
+                    }
+                    $user_info['education_certification'] = $education_certification;
+                }
+                //如果有其他证明模块
+                if(in_array('other_certification',$forms)){
+                    if(json_decode($user_info['other_certification'])){
+                        $other_certification = json_decode($user_info['other_certification'],true);
+                        foreach ($other_certification as $k => $v){
+                            if(array_key_exists('response',$v)){
+                                if(array_key_exists('path',$v['response'])){
+                                    $other_certification[$k]['url'] = $v['response']['path'];
+                                }
+                            }
+
+                        }
+                    }else{
+                        $other_certification = [];
+                    }
+                    $user_info['other_certification'] = $other_certification;
+                }
+
+                //获取最新的报名审核信息
+                $logs = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',2)->orderBy('created_at','desc')->first();
+                if($logs){
+                    $user_info['audit_log'] = $logs->log;
+                }else{
+                    $user_info['audit_log'] = '';
+                }
+
+                //获取提交报名的次数
+//                $number = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',3)->count();
+//                $post_number = $number+1;//todo
+            }
+
+
+        }
+        else{
+            //实习专场
+            if(in_array('internship',$forms)){
+                $user_info = json_encode([
+                    'recruit_id' => $id,
+                    'operation' => 1,
+                    'realname' => '',
+                    'sex' => '1',
+                    'birthday' => '',
+                    'card' => '',
+                    'nation' => '',
+                    'native_place' => '',
+                    'political_affiliation' => '',
+                    'join_time' => '',
+                    'house_register' => '',
+                    'education' => '',
+                    'school' => '',
+                    'pro' => '',
+                    'adjust' => '',
+                    'mobile' => '',
+                    'email' => '',
+                    'address' => '',
+                    'post_id' => '',
+                    'concat_name' => '',
+                    'concat_mobile' => '',
+                    'resume' => '',
+                    'avatar' => '',
+                    'family' => [
+                        [
+                            'relation' => '',
+                            'realname' => '',
+                            'birthday' => '',
+                            'political_affiliation' => '',
+                            'work' => ''
+                        ]
+                    ],
+                    'detail' => [
+                        'rewards_and_punishments'   =>  '',
+                        'introduce'                 =>  ''
+                    ],
+                    'identification' => [],
+                    'education_certification' => [],
+                    'other_certification' => []
+                ]);
+            }else{
+                //如果没有,结合基础数据及模块表单信息,制作数据对象
+                $user_info = RecruitAppointBasic::where('uid',$uid)->first();
+                if(!$user_info){
+                    //没有基础信息跳转完善route('person.recruitInfo')
+                    return $this->showMessage('请先完善招考基础信息!', route('recruit.recruitInfo',array('recruit_id',$id)), true, '上一页', '3');
+                }
+                $user_info['sex'] = (string)$user_info['sex'];
+                $user_info['edu_type'] = (string)$user_info['edu_type'];
+                $user_info['family'] = json_decode($user_info['family']);
+                if(in_array('expand_special',$forms)){
+                    $user_info['special'] = [
+                        'point_apply'   =>  '0',
+                        'condition'     =>  '',
+                        'material'      =>  []
+                    ];
+                }
+                if(in_array('detail',$forms)){
+                    $user_info['detail'] = [
+                        'train'                     =>  '',
+                        'rewards_and_punishments'   =>  '',
+                        'introduce'                 =>  ''
+                    ];
+                }
+                if(in_array('identification',$forms)){
+                    $user_info['identification'] = [];
+                }
+                if(in_array('education_certification',$forms)){
+                    $user_info['education_certification'] = [];
+                }
+                if(in_array('other_certification',$forms)){
+                    $user_info['other_certification'] = [];
+                }
+                $user_info['recruit_id'] = $id;
+                $user_info['operation'] = 1;
+            }
+
+        }
+
+        //招考岗位
+        $where_post[] = ['recruit_id', '=', $id];
+        $where_post[] = ['status', '=', 1];
+        $recruit_post = RecruitPost::where($where_post)->get();
+        $post = [];
+        $post_limit = [];
+        foreach ($recruit_post as $value){
+            $item = [
+                'value' =>  $value['id'],
+                'label' =>  $value['code'] . " " . $value['name']
+            ];
+            $post_limit[$value['id']] = json_decode($value['limit']);
+            array_push($post,$item);
+        }
+
+        $view_data['appoint_info'] = $user_info;
+        $view_data['post'] = json_encode($post);
+//        $view_data['post_number'] = $post_number;
+//        $view_data['post_times'] = $recruit['post_times'];
+        $view_data['post_limit'] = json_encode($post_limit);
+        $view_data['formDisable'] = $formDisabled;
+        $view_data['title'] = $recruit->company;
+        return view('app.recruit.sign_up',$view_data);
+
+    }
+
+    public function preview(Request $request)
+    {
+        $modules = $request->input('modules');
+        $view_data['module'] = $forms = explode(',', $modules);
+
+        return view('app.recruit.preview',$view_data);
+    }
+
+    /**
+     * 提交报名的处理程序
+     * @param Request $request
+     * @return array|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\think\response\Redirect|void
+     */
+    public function saveSignUp(Request $request)
+    {
+        $user = $this->getUser();
+        if (!empty($user)) {
+            $uid = $user->id;
+        } else {
+            return redirect(route('login'));
+        }
+
+        $recruit_id = $request->input('recruit_id', 0);
+        if (!$recruit_id) {
+            return response()->json(['status' => 0,'msg' => '请选择项目!']);
+        }
+        $recruit = Recruit::find($recruit_id);
+        if(!$recruit['status']){
+            return response()->json(['status' => 0,'msg' => '抱歉,该项目状态不正确,请联系客服!']);
+        }
+        if($recruit['current'] != 1){
+            return response()->json(['status' => 0,'msg' => '抱歉,该项目报名通道已关闭,如有疑问,请联系客服!']);
+        }
+        $time = time();
+        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
+        if(($time < strtotime($recruit['apply_start']) || strtotime($recruit['apply_end']) < $time)){//过了招考时间
+            if($appoint_info){
+                //如果有报名记录,先查询首次报名是什么时候
+                $first_post = RecruitAppointLog::where('type',3)->where('uid',$uid)->orderBy('created_at','asc')->first();
+                if(!$first_post){//没有记录代表只是暂存
+                    return response()->json(['status' => 0,'msg' => '抱歉,该项目已过报名时间!']);
+                }
+            }
+            if(!$appoint_info){
+                return response()->json(['status' => 0,'msg' => '抱歉,该项目已过报名时间!']);
+            }
+        }
+
+
+
+        //基础信息的检查
+        $rules = [
+            'realname' => 'required',
+            'sex' => 'required',
+            'birthday' => 'required',
+            'avatar' => 'required',
+            'nation' => 'required',
+            'native_place' => 'required',
+            'political_affiliation' => 'required',
+            'post_id'   =>  'required',
+            'house_register' => 'required',
+            //'edu_type' => 'required',
+            'education' => 'required',
+            'school' => 'required',
+            'address' => 'required',
+            'mobile' => 'required',
+            'email' => 'required',
+            'card' => 'required',
+            'concat_name' => 'required',
+            'concat_mobile' => 'required',
+            'resume' => 'required'
+        ];
+        $messages = [
+            'realname.required' => '请填写姓名',
+            'sex.required' => '请填写性别',
+            'birthday.required' => '请填写出生日期',
+            'avatar.required' => '请上传彩色免冠照',
+            'nation.required' => '请填写民族',
+            'native_place.required' => '请填写籍贯',
+            'political_affiliation.required' => '请选择政治面貌',
+            'post_id.required' => '请选择报名岗位',
+            'house_register.required' => '请填写户籍所在地',
+            //'edu_type.required' => '请选择教育类型',
+            'education.required' => '请输入学历',
+            'school.required' => '请输入毕业院校',
+            'address.required' => '请填写通信地址',
+            'mobile.required' => '请填写手机号码',
+            'email.required' => '请填写电子邮箱',
+            'card.required' => '请填写身份证号码',
+            'resume.required' => '请填写个人简历',
+            'concat_name.required' => '请填写联系人姓名',
+            'concat_mobile.required' => '请填写联系人手机号码'
+        ];
+        $create_data = $request->all();
+        $validator = Validator::make($create_data,$rules,$messages);
+        if ($validator->fails()) {
+            $msg = $validator->errors()->all();
+            return response()->json(['status' => 0,'msg' => $msg[0]]);
+        }else{
+            $data = $request->only('realname','sex','birthday','avatar','nation','native_place','political_affiliation','titles','join_time','work','house_register','education','school','degree','pro','address','card','mobile','email','concat_name','concat_mobile','resume','post_id','adjust','remark');
+            //身份证判断出生日期和性别
+            $year = substr($data['card'],6,4);
+            $month = substr($data['card'],10,2);
+            $day = substr($data['card'],12,2);
+            if($year.'-'.$month.'-'.$day != $data['birthday']){
+                $data['birthday'] = $year.'-'.$month.'-'.$day;
+            }
+            if(intval(substr($data['card'],16,1)) % 2 == 0){
+                $data['sex'] = 0;
+            }else{
+                $data['sex'] = 1;
+            }
+            $post_info = RecruitPost::where('id',$data['post_id'])->where('recruit_id',$recruit_id)->first();
+            if(!$post_info['status'] || $post_info['deleted_at'] != null){
+                return response()->json(['status' => 0,'msg' => '该岗位已失效']);
+            }
+            //获取操作符,是暂存还是提交
+            $operation = $request->input('operation');
+            if($operation == 1){
+                $data['audit'] = 0;//暂存
+            }else{
+                $data['audit'] = 1;//提交
+            }
+            if(!empty($post_info['limit']) && json_decode($post_info['limit'])){
+                //岗位限制条件的判断
+                $post_limit = json_decode($post_info['limit'],true);
+                if(is_array($post_limit)){
+                    foreach($post_limit as $k => $v){
+                        if($k == 'birthday'){
+                            $value = str_replace('-','',$data[$k]);
+                        }else{
+                            $value = $data[$k];
+                        }
+                        switch ($v['op']){
+                            case '=':
+                                if($value != $v['value']){
+                                    return response()->json(['status' => 0,'msg' => $v['msg']]);
+                                }
+                                break;
+                            case '>':
+                                if($value <= $v['value']){
+                                    return response()->json(['status' => 0,'msg' => $v['msg']]);
+                                }
+                                break;
+                            case '>=':
+                                if($value < $v['value']){
+                                    return response()->json(['status' => 0,'msg' => $v['msg']]);
+                                }
+                                break;
+                            case '<':
+                                if($value >= $v['value']){
+                                    return response()->json(['status' => 0,'msg' => $v['msg']]);
+                                }
+                                break;
+                            case '<=':
+                                if($value > $v['value']){
+                                    return response()->json(['status' => 0,'msg' => $v['msg']]);
+                                }
+                                break;
+                            case '!=':
+                                if($value == $v['value']){
+                                    return response()->json(['status' => 0,'msg' => $v['msg']]);
+                                }
+                                break;
+                            case 'like':
+                                if(strpos($value,$v['value']) === false){
+                                    return response()->json(['status' => 0,'msg' => $v['msg']]);
+                                }
+                                break;
+                            case 'in':
+                                if(strpos($v['value'],$value) === false){
+                                    return response()->json(['status' => 0,'msg' => $v['msg']]);
+                                }
+                                break;
+                        }
+                    }
+                }
+            }
+            //前置审核 判断完成,先将数据入报名信息基础表
+            //解析家庭成员数据
+            $familys = $request->input('family');
+            $family = [];
+            if(is_array($familys)){
+                foreach ($familys as $value){
+                    $item = [
+                        'relation'  =>  $value['relation'],
+                        'realname'  =>  $value['realname'],
+                        'birthday'  =>  $value['birthday'],
+                        'political_affiliation' =>  $value['political_affiliation'],
+                        'work'  =>  $value['work']
+                    ];
+                    array_push($family,$item);
+                }
+            }
+
+            $data['family'] = json_encode($family);
+            if($appoint_info){
+                //如果已有报名记录,进入修改阶段的处理流程
+                DB::beginTransaction();
+                try{
+                    RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->update($data);
+                    //分模块解析数据
+                    $forms = explode(',', $recruit['forms']);
+                    //如果有加分模块
+                    if(in_array('expand_special',$forms)){
+                        $special = $request->input('special');
+                        if($special['point_apply']){
+                            //删除掉没有成功返回路径的图片
+                            if(is_array($special['material'])){
+                                foreach ($special['material'] as $k => $v){
+                                    if(!array_key_exists('response',$v)){
+                                        unset($special['material'][$k]);
+                                    }
+                                }
+                            }
+                            $special['material'] = json_encode($special['material']);
+
+                        }else{
+                            $special['material'] = json_encode([]);
+                        }
+                        $hasRecord = RecruitAppointExpandSpecial::where('recruit_appoint_id',$appoint_info->id)->first();
+                        if($hasRecord){
+                            RecruitAppointExpandSpecial::where('recruit_appoint_id',$appoint_info->id)->update($special);
+                        }else{
+                            $special['recruit_appoint_id'] = $appoint_info->id;
+                            RecruitAppointExpandSpecial::create($special);
+                        }
+                    }
+                    //如果有详情模块
+                    if(in_array('detail',$forms) || in_array('internship',$forms)){
+                        $detail = $request->input('detail');
+                        $hasRecord = RecruitAppointDetail::where('recruit_appoint_id',$appoint_info->id)->first();
+                        if($hasRecord){
+                            RecruitAppointDetail::where('recruit_appoint_id',$appoint_info->id)->update($detail);
+                        }else{
+                            $detail['recruit_appoint_id'] = $appoint_info->id;
+                            RecruitAppointDetail::create($detail);
+                        }
+
+                    }
+                    //如果有身份证明模块
+                    if(in_array('identification',$forms) || in_array('internship',$forms)){
+                        $identification = $request->input('identification');
+                        if(is_array($identification)){
+                            //删除掉没有成功返回路径的图片
+                            foreach ($identification as $k => $v){
+                                if(!array_key_exists('response',$v)){
+                                    unset($identification[$k]);
+                                }
+                            }
+                        }
+                        $appoint_info->identification = json_encode($identification);
+                        $appoint_info->save();
+                    }
+                    //如果有教育证明模块
+                    if(in_array('education_certification',$forms) || in_array('internship',$forms)){
+                        $education_certification = $request->input('education_certification');
+                        if(is_array($education_certification)){
+                            //删除掉没有成功返回路径的图片
+                            foreach ($education_certification as $k => $v){
+                                if(!array_key_exists('response',$v)){
+                                    unset($education_certification[$k]);
+                                }
+                            }
+                        }
+                        $appoint_info->education_certification = json_encode($education_certification);
+                        $appoint_info->save();
+                    }
+                    //如果有其他证明模块
+                    if(in_array('other_certification',$forms) || in_array('internship',$forms)){
+                        $other_certification = $request->input('other_certification');
+                        if(is_array($other_certification)){
+                            //删除掉没有成功返回路径的图片
+                            foreach ($other_certification as $k => $v){
+                                if(!array_key_exists('response',$v)){
+                                    unset($other_certification[$k]);
+                                }
+                            }
+                        }
+
+                        if($other_certification){
+                            $appoint_info->other_certification = json_encode($other_certification);
+                            $appoint_info->save();
+                        }
+                    }
+                    DB::commit();
+                    if($operation == 2){
+                        $log = [
+                            'type'      =>  3,
+                            'appoint_id'=>  $appoint_info->id,
+                            'uid'       =>  $uid,
+                            'log'       =>  '用户提交报名'
+                        ];
+                        RecruitAppointLog::create($log);
+                        return ['status' => 1, 'msg' => '提交成功', 'data' => $appoint_info->id];
+                    }else{
+                        return ['status' => 1, 'msg' => '资料保存成功,请尽快完善并提交', 'data' => $appoint_info->id];
+                    }
+                } catch (\Exception $e){
+                    DB::rollback();
+                    return ['status' => 0, 'msg' => $e->getMessage()];
+                }
+            }else{
+                //没有报名记录,进入增加阶段的处理流程
+                DB::beginTransaction();
+                try{
+                    $data['uid'] = $uid;
+                    $data['recruit_id'] = $recruit_id;
+                    $result = RecruitAppointInfo::create($data);
+                    //分模块解析数据
+                    $forms = explode(',', $recruit['forms']);
+                    //如果有加分模块
+                    if(in_array('expand_special',$forms)){
+                        $special = $request->input('special');
+                        if($special['point_apply']){
+                            if(is_array($special['material'])){
+                                //删除掉没有成功返回路径的图片
+                                foreach ($special['material'] as $k => $v){
+                                    if(!array_key_exists('response',$v)){
+                                        unset($special['material'][$k]);
+                                    }
+                                }
+                            }
+                            $special['material'] = json_encode($special['material']);
+                        }
+                        $special['recruit_appoint_id'] = $result->id;
+                        RecruitAppointExpandSpecial::create($special);
+                    }
+                    //如果有详情模块
+                    if(in_array('detail',$forms)  || in_array('internship',$forms)){
+                        $detail = $request->input('detail');
+                        $detail['recruit_appoint_id'] = $result->id;
+                        RecruitAppointDetail::create($detail);
+                    }
+                    //如果有身份证明模块
+                    if(in_array('identification',$forms)  || in_array('internship',$forms)){
+                        $identification = $request->input('identification');
+                        if(is_array($identification)){
+                            //删除掉没有成功返回路径的图片
+                            foreach ($identification as $k => $v){
+                                if(!array_key_exists('response',$v)){
+                                    unset($identification[$k]);
+                                }
+                            }
+                        }
+
+                        $result->identification = json_encode($identification);
+                        $result->save();
+                    }
+                    //如果有教育证明模块
+                    if(in_array('education_certification',$forms)  || in_array('internship',$forms)){
+                        $education_certification = $request->input('education_certification');
+                        if(is_array($education_certification)){
+                            //删除掉没有成功返回路径的图片
+                            foreach ($education_certification as $k => $v){
+                                if(!array_key_exists('response',$v)){
+                                    unset($education_certification[$k]);
+                                }
+                            }
+                        }
+
+                        $result->education_certification = json_encode($education_certification);
+                        $result->save();
+                    }
+                    //如果有其他证明模块
+                    if(in_array('other_certification',$forms)  || in_array('internship',$forms)){
+                        $other_certification = $request->input('other_certification');
+
+                        if($other_certification){
+                            if(is_array($other_certification)){
+                                //删除掉没有成功返回路径的图片
+                                foreach ($other_certification as $k => $v){
+                                    if(!array_key_exists('response',$v)){
+                                        unset($other_certification[$k]);
+                                    }
+                                }
+                            }
+
+                            $result->other_certification = json_encode($other_certification);
+                            $result->save();
+                        }
+                    }
+                    DB::commit();
+                    if($operation == 2){
+                        $log = [
+                            'type'      =>  3,
+                            'appoint_id'=>  $result->id,
+                            'uid'       =>  $uid,
+                            'log'       =>  '用户首次提交报名'
+                        ];
+                        RecruitAppointLog::create($log);
+                        return ['status' => 1, 'msg' => '提交成功', 'data' => $result->id];
+                    }else{
+                        return ['status' => 1, 'msg' => '资料保存成功,请尽快完善并提交', 'data' => $result->id];
+                    }
+
+                } catch (\Exception $e){
+                    DB::rollback();
+                    return ['status' => 0, 'msg' => $e->getMessage()];
+                }
+            }
+        }
+
+    }
+
+    /**
+     * 获得当前登录的用户
+     * @return \Illuminate\Contracts\Auth\Authenticatable|null
+     */
+    public function getUser()
+    {
+        if (auth('web-member')->check()) {
+            $user = auth('web-member')->user();
+        } else {
+            $user = null;
+        }
+        return $user;
+    }
+
+    /**
+     * 检查用户基本信息
+     * @return array
+     */
+    public function checkUserBasicInfo()
+    {
+        $user = $this->getUser();
+        if (!empty($user)) {
+            $uid = $user->id;
+        } else {
+            $arr = ['status' => 401, 'msg'=>'请登录!'];
+            return $arr;
+        }
+        $info = RecruitAppointBasic::where('uid',$uid)->first();
+
+        if (empty($info)){
+            $arr = ['status'=>401,'msg'=>'请先完善招考基本信息','url'=> route('recruit.recruitInfo')];
+            return $arr;
+        }
+        return ['status' => 200, 'msg' => ''];
+
+    }
+
+    /**
+     * 个人中心招考页面
+     * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
+     */
+    public function person_recruit()
+    {
+        $user = auth('web-member')->user();
+        $list = RecruitAppointInfo::where('uid',$user->id)
+            ->join('recruit', 'recruit.id', '=', 'recruit_appoint_info.recruit_id', 'left')
+            ->join('recruit_post', 'recruit_post.id', '=', 'recruit_appoint_info.post_id', 'left')
+            ->select('recruit.name as recruit_name','recruit_appoint_info.*','recruit_post.code','recruit_post.name')
+            ->get();
+
+        return view('app.person.recruit')->with(['list' => $list,'total' => count($list)]);
+    }
+
+    /**
+     * 招考信息基础页
+     * @param Request $request
+     * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
+     */
+    public function recruit_info(Request $request)
+    {
+        $user = auth('web-member')->user();
+        $info = RecruitAppointBasic::where('uid',$user->id)->first();
+        if(!$info){
+            $info = [
+                'realname' => '',
+                'sex' => '0',
+                'birthday' => '',
+                'avatar' => '',
+                'nation' => '',
+                'native_place' => '',
+                'political_affiliation' => '',
+                'titles' => '',
+                'work' => '',
+                'house_register' => '',
+                'join_time' => '',
+                'edu_type' => '',
+                'education' => '',
+                'school' => '',
+                'degree' => '',
+                'pro' => '',
+                'address' => '',
+                'card' => '',
+                'mobile' => '',
+                'email' => '',
+                'concat_name' => '',
+                'concat_mobile' => '',
+                'resume' => '',
+                'family' => [
+                    [
+                        'relation' => '',
+                        'realname' => '',
+                        'birthday' => '',
+                        'political_affiliation' => '',
+                        'work' => ''
+                    ]
+                ],
+                'is_push' => '1'
+            ];
+        }else{
+            $info->sex = (string)$info->sex;
+            $info->edu_type = (string)$info->edu_type;
+            $info->is_push = (string)$info->is_push;
+            $info->family = empty($info->family) ? [[
+                                                        'relation' => '',
+                                                        'realname' => '',
+                                                        'birthday' => '',
+                                                        'political_affiliation' => '',
+                                                        'work' => ''
+                                                    ]] : json_decode($info->family);
+        }
+        $recruit_id = $request->input('recruit_id',0);
+        return view('app.person.recruit_info',[
+            'info'      =>  json_encode($info),
+            'recruit_id'=>  $recruit_id
+        ]);
+    }
+
+    /**
+     * 保存招考信息
+     * @param RecruitValidatorRequest $request
+     * @return \Illuminate\Http\JsonResponse
+     */
+    public function saveRecruitInfo(RecruitValidatorRequest $request)
+    {
+        $user = auth('web-member')->user();
+        $basic = RecruitAppointBasic::where('uid',$user->id)->first();
+        $data = $request->only('realname','sex','birthday','avatar','nation','native_place','political_affiliation','titles','work','house_register','join_time','education','school','degree','pro','address','card','mobile','email','concat_name','concat_mobile','resume','family','is_push');
+        if(count($data['family']) > 0){
+            $data['family'] = json_encode($data['family']);
+        }
+        if($basic){
+            //更新基础信息
+            $res = RecruitAppointBasic::where('uid',$user->id)->update($data);
+            if (!$res) {
+                return response()->json(['status'=>0,'msg'=>'保存失败,请联系客服']);
+            }else{
+                return response()->json(['status'=>1,'msg'=>'个人基础信息保存成功,快去报名吧!']);
+            }
+        }else{
+            //新增基础信息
+            $data['uid'] = $user->id;
+            $res = RecruitAppointBasic::create($data);
+            if (!$res) {
+                return response()->json(['status'=>0,'msg'=>'保存失败,请联系客服']);
+            }else{
+                return response()->json(['status'=>1,'msg'=>'个人基础信息保存成功,快去报名吧!']);
+            }
+        }
+
+
+    }
+
+    /**
+     * 笔试准考证
+     * @param Request $request
+     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
+     */
+    public function pen_ticket(Request $request)
+    {
+        $user = $this->getUser();
+        if (!empty($user)) {
+            $uid = $user->id;
+        } else {
+            return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
+        }
+        $recruit_id = $request->input('recruit_id');
+        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
+        if($appoint_info){
+            $pen_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',1)->first();
+            if($pen_ticket){
+                $time = time();
+                if(strtotime($pen_ticket->ex_start) < $time && strtotime($pen_ticket->ex_end) > $time){
+                    RecruitTicket::where('appoint_id',$appoint_info->id)->update(['ex_status' => 1]);
+                    $recruit = Recruit::where('id',$recruit_id)->first();
+                    $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
+                    $name = $recruit->name_en;
+                    $date = date("Y-m-d",strtotime($recruit->created_at));
+                    $filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
+                    $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/pen/" . $filename . '_create.pdf';
+                    if(file_exists($file)){
+                        header('Content-Description: File Transfer');
+                        header('Content-Type: application/octet-stream');
+                        header('Content-Disposition: attachment; filename='.basename($file));
+                        header('Content-Transfer-Encoding: binary');
+                        header('Expires: 0');
+                        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+                        header('Pragma: public');
+                        header('Content-Length: ' . filesize($file));
+                        ob_clean();   //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
+                        flush();
+                        readfile($file);
+                    }
+                }else{
+                    return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
+                }
+            }else{
+                return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
+            }
+        }else{
+            return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
+        }
+    }
+
+    /**
+     * 审核准考证
+     * @param Request $request
+     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
+     */
+    public function check_ticket(Request $request)
+    {
+        $user = $this->getUser();
+        if (!empty($user)) {
+            $uid = $user->id;
+        } else {
+            return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
+        }
+        $recruit_id = $request->input('recruit_id');
+        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
+        if($appoint_info){
+            $check_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',2)->first();
+            if($check_ticket){
+                $time = time();
+                if(strtotime($check_ticket->ex_start) < $time && strtotime($check_ticket->ex_end) > $time){
+                    RecruitTicket::where('appoint_id',$appoint_info->id)->update(['ex_status' => 1]);
+                    $recruit = Recruit::where('id',$recruit_id)->first();
+                    $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
+                    $name = $recruit->name_en;
+                    $date = date("Y-m-d",strtotime($recruit->created_at));
+                    $filename = date("Y-m-18",time()) . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
+                    $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/check/" . $filename . '.pdf';
+                    if(file_exists($file)){
+                        header('Content-Description: File Transfer');
+                        header('Content-Type: application/octet-stream');
+                        header('Content-Disposition: attachment; filename='.basename($file));
+                        header('Content-Transfer-Encoding: binary');
+                        header('Expires: 0');
+                        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+                        header('Pragma: public');
+                        header('Content-Length: ' . filesize($file));
+                        ob_clean();   //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
+                        flush();
+                        readfile($file);
+                    }
+                }else{
+                    return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
+                }
+            }else{
+                return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
+            }
+        }else{
+            return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
+        }
+    }
+
+    /**
+     * 面试准考证
+     * @param Request $request
+     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
+     */
+    public function face_ticket(Request $request)
+    {
+        $user = $this->getUser();
+        if (!empty($user)) {
+            $uid = $user->id;
+        } else {
+            return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
+        }
+        $recruit_id = $request->input('recruit_id');
+        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
+        if($appoint_info){
+            $face_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',3)->first();
+            if($face_ticket){
+                $time = time();
+                if(strtotime($face_ticket->ex_start) < $time && strtotime($face_ticket->ex_end) > $time){
+                    RecruitTicket::where('id',$face_ticket->id)->update(['ex_status' => 1]);
+                    $recruit = Recruit::where('id',$recruit_id)->first();
+                    $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
+                    $name = $recruit->name_en;
+                    $date = date("Y-m-d",strtotime($recruit->created_at));
+                    $filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id].'_create';
+                    $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/face/" . $filename . '.pdf';
+                    if(file_exists($file)){
+                        header('Content-Description: File Transfer');
+                        header('Content-Type: application/octet-stream');
+                        header('Content-Disposition: attachment; filename='.basename($file));
+                        header('Content-Transfer-Encoding: binary');
+                        header('Expires: 0');
+                        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+                        header('Pragma: public');
+                        header('Content-Length: ' . filesize($file));
+                        ob_clean();   //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
+                        flush();
+                        readfile($file);
+                    }
+                }else{
+                    return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
+                }
+            }else{
+                return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
+            }
+
+        }else{
+            return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
+        }
+    }
+
+    /**
+     * 复试准考证
+     * @param Request $request
+     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
+     */
+    public function reexamine_ticket(Request $request)
+    {
+        $user = $this->getUser();
+        if (!empty($user)) {
+            $uid = $user->id;
+        } else {
+            return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
+        }
+        $recruit_id = $request->input('recruit_id');
+        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
+        if($appoint_info){
+            $reexamine_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',4)->first();
+            if($reexamine_ticket){
+                $time = time();
+                if(strtotime($reexamine_ticket->ex_start) < $time && strtotime($reexamine_ticket->ex_end) > $time){
+                    RecruitTicket::where('id',$reexamine_ticket->id)->update(['ex_status' => 1]);
+                    $recruit = Recruit::where('id',$recruit_id)->first();
+                    $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
+                    $name = $recruit->name_en;
+                    $date = date("Y-m-d",strtotime($recruit->created_at));
+                    $filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id].'_create';
+                    $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/face/" . $filename . '.pdf';
+                    if(file_exists($file)){
+                        header('Content-Description: File Transfer');
+                        header('Content-Type: application/octet-stream');
+                        header('Content-Disposition: attachment; filename='.basename($file));
+                        header('Content-Transfer-Encoding: binary');
+                        header('Expires: 0');
+                        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+                        header('Pragma: public');
+                        header('Content-Length: ' . filesize($file));
+                        ob_clean();   //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
+                        flush();
+                        readfile($file);
+                    }
+                }else{
+                    return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
+                }
+            }else{
+                return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
+            }
+
+        }else{
+            return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
+        }
+    }
+
+    /**
+     * 材料补登
+     * @param Request $request
+     */
+    public function material_supplement(Request $request)
+    {
+        $user = $this->getUser();
+        if (!empty($user)) {
+            $uid = $user->id;
+        } else {
+            return redirect(route('login'));
+        }
+
+        //招考id
+        $id = $request->input('id', 0);
+        if (!$id) {
+            return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
+        }
+        $recruit = Recruit::find($id);
+        if(!$recruit['status'] && !$user->recruit_test){
+            return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
+        }
+
+        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
+        if(!$appoint_info){
+            return $this->showMessage('抱歉,您没有报名,无需考察审核!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
+        }
+        if($appoint_info->pen_audit != 1){
+            return $this->showMessage('抱歉,您未入闱,无需考察审核!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
+        }
+
+        $uids = array (
+            0 => '175624',
+            1 => '175637',
+            2 => '173543',
+            3 => '175663',
+            4 => '175628',
+            5 => '159629',
+            6 => '170066',
+            7 => '175826',
+            8 => '175629',
+            9 => '175620',
+            10 => '175738',
+            11 => '175854',
+            12 => '164974',
+            13 => '167931',
+            14 => '175757',
+            15 => '175951',
+            16 => '175893',
+            17 => '175995',
+            18 => '176024',
+            19 => '176044',
+            20 => '169828',
+            21 => '152230',
+            22 => '176147',
+            23 => '176144',
+            24 => '176189',
+            25 => '169518',
+            26 => '175925',
+            27 => '176327',
+            28 => '176347',
+            29 => '176349',
+            30 => '176407',
+            31 => '170378',
+            32 => '176463',
+            33 => '176457',
+            34 => '169219',
+            35 => '169285',
+            36 => '163039',
+            37 => '176545',
+            38 => '176551',
+            39 => '169814',
+            40 => '175847',
+            41 => '175755',
+            42 => '169240',
+            43 => '176669',
+            44 => '176605',
+            45 => '176807',
+            46 => '169917',
+            47 => '176888',
+            48 => '176578',
+            49 => '176681',
+            50 => '148287',
+            51 => '176511',
+            52 => '176946',
+            53 => '176922',
+            54 => '176955',
+            55 => '167385',
+            56 => '176971',
+            57 => '176969',
+            58 => '176984',
+            59 => '169932',
+            60 => '176250',
+            61 => '149243',
+            62 => '177026',
+            63 => '169607',
+            64 => '150162',
+            65 => '177055',
+            66 => '177061',
+            67 => '177056',
+            68 => '169761',
+            69 => '177096',
+            70 => '177118',
+            71 => '177102',
+            72 => '159073',
+            73 => '177119',
+            74 => '169641',
+            75 => '177158',
+            76 => '177128',
+            77 => '170175',
+            78 => '170822',
+            79 => '177193',
+            80 => '177234',
+            81 => '177251',
+            82 => '168964',
+            83 => '176034',
+            84 => '150532',
+            85 => '168487',
+            86 => '177304',
+            87 => '170441',
+            88 => '177262',
+            89 => '177342',
+            90 => '177356',
+            91 => '170376',
+            92 => '177316',
+            93 => '177361',
+            94 => '177170',
+            95 => '171720',
+            96 => '176736',
+        );
+        $limit_time = 1654078200;
+        if(in_array($uid,$uids)){
+            $limit_time = 1654164000;
+        }
+        $time = time();
+        if( $time > $limit_time){
+            return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
+        }
+
+        $info = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
+        if(!$info){
+            $info = [
+                'appoint_id' => $appoint_info->id,
+                'identification' => '',
+                'household_register' => '',
+                'education_certification' => '',
+                //'family_planning' => '',
+                'manage' => '',
+                'status' => 3
+            ];
+        }else{
+            $info = $info->toArray();
+            if(json_decode($info['identification'])){
+                $identification = json_decode($info['identification'],true);
+                foreach ($identification as $k => $v){
+                    if(array_key_exists('response',$v)){
+                        $identification[$k]['url'] = $v['response']['path'];
+                    }
+                }
+            }else{
+                $identification = [];
+            }
+            $info['identification'] = $identification;
+
+            if(json_decode($info['household_register'])){
+                $household_register = json_decode($info['household_register'],true);
+                foreach ($household_register as $k => $v){
+                    if(array_key_exists('response',$v)){
+                        $household_register[$k]['url'] = $v['response']['path'];
+                    }
+                }
+            }else{
+                $household_register = [];
+            }
+            $info['household_register'] = $household_register;
+
+            if(json_decode($info['education_certification'])){
+                $education_certification = json_decode($info['education_certification'],true);
+                foreach ($education_certification as $k => $v){
+                    if(array_key_exists('response',$v)){
+                        $education_certification[$k]['url'] = $v['response']['path'];
+                    }
+                }
+            }else{
+                $education_certification = [];
+            }
+            $info['education_certification'] = $education_certification;
+
+            if(json_decode($info['family_planning'])){
+                $family_planning = json_decode($info['family_planning'],true);
+                foreach ($family_planning as $k => $v){
+                    if(array_key_exists('response',$v)){
+                        $family_planning[$k]['url'] = $v['response']['path'];
+                    }
+                }
+            }else{
+                $family_planning = [];
+            }
+            $info['family_planning'] = $family_planning;
+
+            if(json_decode($info['manage'])){
+                $manage = json_decode($info['manage'],true);
+                foreach ($manage as $k => $v){
+                    if(array_key_exists('response',$v)){
+                        $manage[$k]['url'] = $v['response']['path'];
+                    }
+                }
+            }else{
+                $manage = [];
+            }
+            $info['manage'] = $manage;
+
+        }
+
+        $view_data['info'] = json_encode($info);
+        $view_data['title'] = $recruit->company;
+        return view('app.recruit.supplement',$view_data);
+    }
+
+    /**
+     * 健康信息登记
+     * @param Request $request
+     */
+    public function health_info(Request $request)
+    {
+        $user = $this->getUser();
+        if (!empty($user)) {
+            $uid = $user->id;
+        } else {
+            return redirect(route('login'));
+        }
+
+        //招考id
+        $id = $request->input('id', 0);
+        if (!$id) {
+            return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
+        }
+        $recruit = Recruit::find($id);
+        if(!$recruit['status'] && !$user->recruit_test){
+            return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
+        }
+
+        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
+        if(!$appoint_info){
+            return $this->showMessage('抱歉,您没有报名,无需登记!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
+        }
+        if($appoint_info->audit != 3){
+            return $this->showMessage('抱歉,您无需登记!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
+        }
+
+        $time = time();
+        if($time > 1654078200){
+            return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
+        }
+
+        $info = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
+        if(!$info){
+            $info = [
+                'appoint_id' => $appoint_info->id,
+                'health_code' => '',
+                'trip_code' => ''
+            ];
+        }else{
+            $info = $info->toArray();
+            if(json_decode($info['health_code'])){
+                $health_code = json_decode($info['health_code'],true);
+                foreach ($health_code as $k => $v){
+                    if(array_key_exists('response',$v)){
+                        $health_code[$k]['url'] = $v['response']['path'];
+                    }
+                }
+            }else{
+                $health_code = [];
+            }
+            $info['health_code'] = $health_code;
+
+            if(json_decode($info['trip_code'])){
+                $trip_code = json_decode($info['trip_code'],true);
+                foreach ($trip_code as $k => $v){
+                    if(array_key_exists('response',$v)){
+                        $trip_code[$k]['url'] = $v['response']['path'];
+                    }
+                }
+            }else{
+                $trip_code = [];
+            }
+            $info['trip_code'] = $trip_code;
+
+        }
+
+        $view_data['info'] = json_encode($info);
+        $view_data['title'] = $recruit->company;
+        return view('app.recruit.health',$view_data);
+    }
+
+    public function save_supplement(Request $request)
+    {
+        $user = $this->getUser();
+        if (!empty($user)) {
+            $uid = $user->id;
+        } else {
+            return redirect(route('login'));
+        }
+        $appoint_id = $request->input('appoint_id');
+        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',16)->where('id',$appoint_id)->first();
+        if(!$appoint_info){
+            return ['status' => 0, 'msg' => '抱歉,找不到您要补登的报名记录!'];
+        }
+        $info = RecruitSupplement::where('appoint_id',$appoint_id)->first();
+        if($info){
+            if($info->status == 1){
+                return ['status' => 0, 'msg' => '材料已审核通过,不允许修改'];
+            }
+            if($info->status == 0){
+                return ['status' => 0, 'msg' => '材料审核中,不允许修改'];
+            }
+            //身份证明
+            $identification = $request->input('identification');
+            if(is_array($identification)){
+                //删除掉没有成功返回路径的图片
+                foreach ($identification as $k => $v){
+                    if(!array_key_exists('response',$v)){
+                        unset($identification[$k]);
+                    }
+                }
+            }
+            $info->identification = json_encode($identification);
+            //户口簿
+            $household_register = $request->input('household_register');
+            if(is_array($household_register)){
+                //删除掉没有成功返回路径的图片
+                foreach ($household_register as $k => $v){
+                    if(!array_key_exists('response',$v)){
+                        unset($household_register[$k]);
+                    }
+                }
+            }
+            $info->household_register = json_encode($household_register);
+            //学信网
+            $education_certification = $request->input('education_certification');
+            if(is_array($education_certification)){
+                //删除掉没有成功返回路径的图片
+                foreach ($education_certification as $k => $v){
+                    if(!array_key_exists('response',$v)){
+                        unset($education_certification[$k]);
+                    }
+                }
+            }
+            $info->education_certification = json_encode($education_certification);
+            //计生
+//            $family_planning = $request->input('family_planning');
+//            if(is_array($family_planning)){
+//                //删除掉没有成功返回路径的图片
+//                foreach ($family_planning as $k => $v){
+//                    if(!array_key_exists('response',$v)){
+//                        unset($family_planning[$k]);
+//                    }
+//                }
+//            }
+//            $info->family_planning = json_encode($family_planning);
+            //综治
+            $manage = $request->input('manage');
+            if(is_array($manage)){
+                //删除掉没有成功返回路径的图片
+                foreach ($manage as $k => $v){
+                    if(!array_key_exists('response',$v)){
+                        unset($manage[$k]);
+                    }
+                }
+            }
+            $info->manage = json_encode($manage);
+            $info->status = 0;
+            $info->save();
+            $appoint_info->political_audit = 4;
+            $appoint_info->save();
+            return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
+        }else{
+            $data['appoint_id'] = $appoint_id;
+            //身份证明
+            $identification = $request->input('identification');
+            if(is_array($identification)){
+                //删除掉没有成功返回路径的图片
+                foreach ($identification as $k => $v){
+                    if(!array_key_exists('response',$v)){
+                        unset($identification[$k]);
+                    }
+                }
+            }
+            $data['identification'] = json_encode($identification);
+            //户口簿
+            $household_register = $request->input('household_register');
+            if(is_array($household_register)){
+                //删除掉没有成功返回路径的图片
+                foreach ($household_register as $k => $v){
+                    if(!array_key_exists('response',$v)){
+                        unset($household_register[$k]);
+                    }
+                }
+            }
+            $data['household_register'] = json_encode($household_register);
+            //学信网
+            $education_certification = $request->input('education_certification');
+            if(is_array($education_certification)){
+                //删除掉没有成功返回路径的图片
+                foreach ($education_certification as $k => $v){
+                    if(!array_key_exists('response',$v)){
+                        unset($education_certification[$k]);
+                    }
+                }
+            }
+            $data['education_certification'] = json_encode($education_certification);
+            //计生
+//            $family_planning = $request->input('family_planning');
+//            if(is_array($family_planning)){sp
+//                //删除掉没有成功返回路径的图片
+//                foreach ($family_planning as $k => $v){
+//                    if(!array_key_exists('response',$v)){
+//                        unset($family_planning[$k]);
+//                    }
+//                }
+//            }
+//            $data['family_planning'] = json_encode($family_planning);
+            //综治
+            $manage = $request->input('manage');
+            if(is_array($manage)){
+                //删除掉没有成功返回路径的图片
+                foreach ($manage as $k => $v){
+                    if(!array_key_exists('response',$v)){
+                        unset($manage[$k]);
+                    }
+                }
+            }
+            $data['manage'] = json_encode($manage);
+            $data['status'] = 0;
+            $result = RecruitSupplement::create($data);
+            $appoint_info->political_audit = 4;
+            $appoint_info->save();
+            return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
+        }
+
+        return ['status' => 0, 'msg' => 'test', 'data' => ''];
+    }
+
+    public function save_healthinfo(Request $request)
+    {
+        $user = $this->getUser();
+        if (!empty($user)) {
+            $uid = $user->id;
+        } else {
+            return redirect(route('login'));
+        }
+        $appoint_id = $request->input('appoint_id');
+        $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',16)->where('id',$appoint_id)->first();
+        if(!$appoint_info){
+            return ['status' => 0, 'msg' => '抱歉,找不到您要登记的报名记录!'];
+        }
+        $info = RecruitSupplement::where('appoint_id',$appoint_id)->first();
+        if($info){
+            if($info->h_status == 1){
+                return ['status' => 0, 'msg' => '材料已审核通过,不允许修改'];
+            }
+            if($info->h_status == 0){
+                return ['status' => 0, 'msg' => '材料审核中,不允许修改'];
+            }
+            $health_code = $request->input('health_code');
+            if(is_array($health_code)){
+                //删除掉没有成功返回路径的图片
+                foreach ($health_code as $k => $v){
+                    if(!array_key_exists('response',$v)){
+                        unset($health_code[$k]);
+                    }
+                }
+            }
+            $info->health_code = json_encode($health_code);
+
+            $trip_code = $request->input('trip_code');
+            if(is_array($trip_code)){
+                //删除掉没有成功返回路径的图片
+                foreach ($trip_code as $k => $v){
+                    if(!array_key_exists('response',$v)){
+                        unset($trip_code[$k]);
+                    }
+                }
+            }
+            $info->trip_code = json_encode($trip_code);
+
+            $info->save();
+            return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
+        }else{
+            $data['appoint_id'] = $appoint_id;
+            $health_code = $request->input('health_code');
+            if(is_array($health_code)){
+                //删除掉没有成功返回路径的图片
+                foreach ($health_code as $k => $v){
+                    if(!array_key_exists('response',$v)){
+                        unset($health_code[$k]);
+                    }
+                }
+            }
+            $data['health_code'] = json_encode($health_code);
+
+            $trip_code = $request->input('trip_code');
+            if(is_array($trip_code)){
+                //删除掉没有成功返回路径的图片
+                foreach ($trip_code as $k => $v){
+                    if(!array_key_exists('response',$v)){
+                        unset($trip_code[$k]);
+                    }
+                }
+            }
+            $data['trip_code'] = json_encode($trip_code);
+
+            $data['h_status'] = 0;
+            RecruitSupplement::create($data);
+            $appoint_info->health_audit = 4;
+            $appoint_info->save();
+            return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
+        }
+
+        return ['status' => 0, 'msg' => 'test', 'data' => ''];
+    }
+
+    public function interviewer_random(Request $request)
+    {
+        $model = $request->input('model',1);
+        $number1 = $request->input('number1',5);//考官人数
+        $number2 = $request->input('number2',1);//替补人数
+        $where[] = ['id','>',0];
+        switch ($model){
+            case '0':
+                $list = DB::table('recruit_interviewer')->get()->toArray();
+                shuffle($list);
+                $result = array_slice($list, 0, $number1+$number2);
+                break;
+            case '1':
+                $list = DB::table('recruit_interviewer')->get()->toArray();
+                shuffle($list);
+                $count = $number1;
+                for ($i = 0; $i < $count; $i++){
+                    if(!$list[$i]->status){
+                        $list[] = $list[$i];
+                        unset($list[$i]);
+                        $count++;
+                    }
+                }
+                $result = array_slice($list, 0, $number1+$number2);
+                break;
+            case '2':
+                $list = DB::table('recruit_interviewer')->where('status',1)->get()->toArray();
+                shuffle($list);
+                $result = array_slice($list, 0, $number1+$number2);
+                break;
+            default:
+                $list = DB::table('recruit_interviewer')->get()->toArray();
+                shuffle($list);
+                for ($i = 0; $i < $number1; $i++){
+                    dd($list[$i]);
+                    if(!$list[$i]->status){
+                        $list[] = $list[$i];
+                        unset($list[$i]);
+                    }
+                }
+                $result = array_slice($list, 0, $number1+$number2);
+                break;
+        }
+
+        $return_data = [
+            'list' => $result,
+            'number1'  => $number1,
+            'number2' => $number2
+        ];
+
+        return view('app.recruit.interviewer', $return_data);
+    }
+
 }

File diff ditekan karena terlalu besar
+ 1052 - 0
public/themes/default/views/app/recruit/preview.blade.php


+ 40 - 0
resources/views/admin/recruit/index.blade.php

@@ -5,6 +5,44 @@
     //报名审核必选
     $("input[name='flow_path[]']").eq(0).attr("disabled", true);
     $("input[name='flow_path[]']").eq(1).attr("disabled", true);
+    $(document).ready(function () {
+        $($("#tab-form-2").children("div").get(0)).after("<div class=\"form-group  \">\n" +
+            "\n" +
+            "    <label for=\"limit_times\" class=\"col-sm-2  control-label\">报名表单预览</label>\n" +
+            "\n" +
+            "    <div class=\"col-sm-8\">\n" +
+            "\n" +
+            "        \n" +
+            "        <div class=\"input-group\">\n" +
+            "\n" +
+            "            <button class=\"btn btn-warning\" id=\"preview\">勾选对应模块后点击我</button>\n" +
+            "\n" +
+            "            \n" +
+            "        </div>\n" +
+            "\n" +
+            "        <span class=\"help-block\">\n" +
+            "</span>\n" +
+            "\n" +
+            "    </div>\n" +
+            "</div>");
+
+
+
+        $("#preview").on('click',function () {
+            let num = $("#forms").find(".checked").length;
+            if(num == 0){
+                alert("未选中报名表单模块");
+                return false;
+            }
+            let modules = new Array();
+            $.each($("#forms").find(".checked"),function(index,item){
+                modules.push($(item).children("input").val())
+            });
+            window.open("https://www.jucai.gov.cn/recruit/preview?modules="+modules.join(','));
+
+            return false;
+        });
+    });
 
 
     var admin = null;
@@ -114,6 +152,8 @@
         tables.append(trtd);
     }
 
+
+
     function deltr(obj) {
         $(obj).parent().parent().remove();
     }

+ 3 - 0
routes/web.php

@@ -89,6 +89,7 @@ Route::group([
     $router->get('list','Web\Recruit\IndexController@index')->name('recruit.index.list');
     $router->get('show','Web\Recruit\IndexController@show')->name('recruit.index.show');
     $router->get('sign_up','Web\Recruit\IndexController@sign_up')->name('recruit.sign_up');
+    $router->get('preview','Web\Recruit\IndexController@preview')->name('recruit.preview');
     $router->get('sign_up_count','Web\Recruit\IndexController@sign_up_count')->name('recruit.sign_up_count');
     $router->get('public_notice','Web\Recruit\IndexController@public_notice')->name('recruit.public_notice');
     $router->get('pen_ticket','Web\Recruit\IndexController@pen_ticket')->name('recruit.pen_ticket');
@@ -901,4 +902,6 @@ Route::group([
 ], function (Router $router){
     $router->get('/talent','Web\Talent\ShuoboController@talent')->name('shuobo.talent');
     $router->any('/getTalentData','Web\Talent\ShuoboController@getTalentData')->name('shuobo.getTalentData');
+    $router->any('/getCompanyToShuobo','Web\Talent\ShuoboController@getCompanyToShuobo')->name('shuobo.getCompanyToShuobo');
+    $router->any('/getTalentInfo','Web\Talent\ShuoboController@getTalentInfo')->name('shuobo.getTalentInfo');
 });

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini