zmw 1 долоо хоног өмнө
parent
commit
c18bf14c8a

+ 86 - 35
app/Http/Controllers/Web/Recruit/IndexController.php

@@ -374,30 +374,19 @@ class IndexController extends WebBaseController
         if ($recruit['current'] != 1 && $recruit['current'] != 2) {
             return $this->showMessage('抱歉,该项目报名通道已关闭,如有疑问,请联系客服!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
         }
-        $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $id)->first();
+        if($recruit['limit_times'] == 1){
+            $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $id)->first();
+        }else{
+            $appoint_info_id = $request->input('appoint_info_id', 0);
+            $appoint_info = null;
+            if($appoint_info_id > 0){
+                $appoint_info = RecruitAppointInfo::where('id', $appoint_info_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', ['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', ['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']);
         //查询报名表是否已有记录
@@ -700,12 +689,13 @@ class IndexController extends WebBaseController
 //                $number = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',3)->count();
 //                $post_number = $number+1;//todo
             }
-
+            $appoint_info_id = $appoint_info->id;
 
         } else {
             //实习专场
             if (in_array('internship', $forms)) {
                 $user_info = json_encode([
+                    'id' => 0,
                     'recruit_id'              => $id,
                     'operation'               => 1,
                     'realname'                => '',
@@ -798,7 +788,7 @@ class IndexController extends WebBaseController
                 $user_info['recruit_id'] = $id;
                 $user_info['operation']  = 1;
             }
-
+            $appoint_info_id = 0;
         }
 
         //招考岗位
@@ -829,6 +819,7 @@ class IndexController extends WebBaseController
         $view_data['title']                   = $recruit->company;
         $view_data['special_condition_type']  = $recruit->special_condition_type;
         $view_data['special_condition_value'] = json_decode($recruit->special_condition_value, true);
+
         return view('app.recruit.sign_up', $view_data);
 
     }
@@ -881,22 +872,51 @@ class IndexController extends WebBaseController
             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) {
-                return response()->json(['status' => 0, 'msg' => '抱歉,该项目已过报名时间!']);
+        if($recruit['limit_times'] == 1){
+            $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) {
+                    return response()->json(['status' => 0, 'msg' => '抱歉,该项目已过报名时间!']);
+                }
+                if (($time < strtotime($recruit['audit_start']) || strtotime($recruit['audit_end']) < $time)) {//过了审核时间
+                    return response()->json(['status' => 0, 'msg' => '抱歉,该项目已过审核时间,无法继续报名!']);
+                }
+                //如果有报名记录,先查询首次报名是什么时候
+                $first_post = RecruitAppointLog::where('type', 3)->where('uid', $uid)->orderBy('created_at', 'asc')->first();
+                if (!$first_post) {//没有记录代表只是暂存
+                    return response()->json(['status' => 0, 'msg' => '抱歉,该项目已过报名时间!']);
+                }
             }
-            if (($time < strtotime($recruit['audit_start']) || strtotime($recruit['audit_end']) < $time)) {//过了审核时间
-                return response()->json(['status' => 0, 'msg' => '抱歉,该项目已过审核时间,无法继续报名!']);
+        }else{
+            $time         = time();
+            $id = $request->input('id');
+            if($id > 0){
+                $appoint_info = RecruitAppointInfo::where('id', $id)->first();
+            }else{
+                $post_id = $request->input('post_id');
+                $appoint_info_post = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $recruit_id)->where('post_id',$post_id)->first();
+                if($appoint_info_post){
+                    return response()->json(['status' => 0, 'msg' => '相同岗位已存在报名记录,请检查 !']);
+                }
+                $appoint_info_count = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $recruit_id)->count();
+                if($appoint_info_count >= $recruit['limit_times']){
+                    return response()->json(['status' => 0, 'msg' => '超过报名次数上限!']);
+                }
+                $appoint_info = null;
             }
-            //如果有报名记录,先查询首次报名是什么时候
-            $first_post = RecruitAppointLog::where('type', 3)->where('uid', $uid)->orderBy('created_at', 'asc')->first();
-            if (!$first_post) {//没有记录代表只是暂存
-                return response()->json(['status' => 0, 'msg' => '抱歉,该项目已过报名时间!']);
+            if (($time < strtotime($recruit['apply_start']) || strtotime($recruit['apply_end']) < $time)) {//过了招考时间
+                if($id == 0){
+                    return response()->json(['status' => 0, 'msg' => '抱歉,该项目已过报名时间!']);
+                }
+                $first_post = RecruitAppointLog::where('appoint_id',$id)->where('type', 3)->where('uid', $uid)->orderBy('created_at', 'asc')->first();
+                if (!$first_post) {//没有记录代表只是暂存
+                    return response()->json(['status' => 0, 'msg' => '抱歉,该项目已过报名时间!']);
+                }
             }
         }
 
+
         $data = $request->only('realname', 'sex', 'birthday', 'avatar', 'nation', 'native_place', 'political_affiliation', 'titles', 'join_time', 'work', 'house_register', 'education', 'school', 'degree', 'pro', 'address', 'card_type', 'card', 'mobile', 'email', 'concat_name', 'concat_mobile', 'resume', 'post_id', 'adjust', 'remark', 'graduation');
         if (!array_key_exists('post_id', $data)) {
             return response()->json(['status' => 0, 'msg' => '请选择报考岗位']);
@@ -1078,7 +1098,7 @@ class IndexController extends WebBaseController
             //如果已有报名记录,进入修改阶段的处理流程
             DB::beginTransaction();
             try {
-                RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $recruit_id)->update($data);
+                RecruitAppointInfo::where('id', $appoint_info->id)->update($data);
                 //分模块解析数据
                 //如果有加分模块
                 if (in_array('expand_special', $forms)) {
@@ -3029,4 +3049,35 @@ class IndexController extends WebBaseController
         }
 
     }
+
+    public function show_sign_limit(Request $request){
+        $user = $this->getUser();
+        if (!empty($user)) {
+            $uid = $user->id;
+        } else {
+            return redirect(route('login'));
+        }
+
+        //招考id
+        $id = $request->input('recruit_id', 0);
+        if (!$id) {
+            return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
+        }
+
+        $recruit = Recruit::find($id);
+        if (!$recruit['status']) {
+            return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
+        }
+
+        $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')
+            ->where('recruit_appoint_info.recruit_id','=',$id)
+            ->get();
+
+        $html = view('app.recruit.show_sign_limit')->with(['list' => $list , 'total' => count($list)])->render();
+        return response()->json(['code' => 1, 'data' => $html]);
+
+    }
 }

+ 86 - 0
public/themes/default/views/app/recruit/show.blade.php

@@ -58,11 +58,24 @@
         </div>
         <div class="content_right_nav right_nav_li" id="sidebar" style="padding-top:75px;padding-bottom:17px;">
             <ul>
+                @if($recruit->limit_times == 1)
                 <a href="javascript:void(0)" id="to_sign_up" data-id="{{$info->id}}" >
                     <li style="background: #1280dd;float: left;margin-bottom:10px;">
                         报名/查看报名
                     </li>
                 </a>
+                @else
+                    <a href="javascript:void(0)" id="to_sign_up" data-id="{{$info->id}}" >
+                        <li style="background: #1280dd;float: left;margin-bottom:10px;">
+                            报名
+                        </li>
+                    </a>
+                    <a href="javascript:void(0)" id="to_sign_up1" data-id="{{$info->id}}" >
+                        <li style="background: #1280dd;float: left;margin-bottom:10px;">
+                            查看报名
+                        </li>
+                    </a>
+                @endif
                 @if($recruit->pen_comfirm)
                     <a href="javascript:void(0)" id="pen_comfirm" data-id="{{$info->id}}" >
                         <li style="background:#ff9900;float: left;margin-bottom:10px;">确认参加笔试</li>
@@ -417,6 +430,79 @@
 
             });
 
+            $("#to_sign_up1").click(function () {
+                var isVisitor = "{{$uid}}";
+                var id = $(this).data('id');
+                var isVisitorutype = "{{$utype}}";
+                var apply_start = $("#apply_start").val() + "000";
+                var apply_end = $("#apply_end").val() + "000";
+                var predetermined_status = $("#predetermined_status").val();
+                var time = new Date().getTime();
+                if ((isVisitor > 0)) {
+                    if (current > 2) {
+                        disapperTooltip("remind", "当前非报名阶段!");
+                        return false;
+                    }
+                    if (isApply != 1) {
+                        disapperTooltip("remind", "当前非报名时间!");
+                        return false;
+                    }
+                    if (isVisitorutype == '1') {
+                        disapperTooltip("remind", "只有登录个人会员才可报名!");
+                        return false;
+                    } else {
+                        if(isIE()){
+                            disapperTooltip("remind", "报名系统不支持IE浏览器,请更换浏览器!");
+                            return false;
+                        }
+                    }
+                    var qsDialog = $(this).dialog({
+                        loading: true,
+                        footer: false,
+                        title: '报考记录',
+                        border: false,
+                        backdrop: false,
+                        width:'860px',
+                        height:'400px'
+                    });
+                    qsDialog.setInnerPadding(false);
+                    $.post("{{ route('recruit.get_appoint_list') }}", {recruit_id:id},function(result){
+                        if(result.code==1){
+                            qsDialog.setContent(result.data);
+                            qsDialog.showFooter(true);
+                            qsDialogSon.setInnerPadding(false);
+                        } else {
+                            qsDialog.hide();
+                            disapperTooltip('remind','操作失败');
+                        }
+                    });
+                } else {
+                    var qsDialog = $(this).dialog({
+                        loading: true,
+                        footer: false,
+                        header: false,
+                        border: false,
+                        backdrop: false
+                    });
+                    var loginUrl = "{{route('loginDig')}}";
+                    $.post(loginUrl, {_token:"{{csrf_token()}}",type:'per','redirect_url':"{{ route('recruit.index.show',['id'=>$recruit->id]) }}"},function(result){
+                        if(result.status==1){
+                            qsDialog.hide();
+                            var qsDialogSon = $(this).dialog({
+                                title: '会员登录',
+                                content: result.html,
+                                footer: false,
+                                border: false
+                            });
+                            qsDialogSon.setInnerPadding(false);
+                        } else {
+                            qsDialog.hide();
+                            disapperTooltip('remind','操作失败');
+                        }
+                    });
+                }
+            });
+
             $("#pen_comfirm").click(function (){
                 var isVisitor = "{{$uid}}";
                 var pen_comfirm = "{{ $appoint_info->pen_comfirm }}";

+ 166 - 0
public/themes/default/views/app/recruit/show_sign_limit.blade.php

@@ -0,0 +1,166 @@
+
+    <link href="{{ theme_asset('app/css/person/common.css') }}" rel="stylesheet">
+    <link href="{{ theme_asset('app/css/person/personal_job.css') }}" rel="stylesheet">
+    <link href="{{theme_asset('app/css/element.css')}}" rel="stylesheet" type="text/css"/>
+    <style>
+        table,table tr th, table tr td { border:1px solid #ccc; padding: 0 7px}
+        table { width: 100%; min-height: 25px; line-height: 25px; text-align: center; border-collapse: collapse; padding:2px;}
+        .el-form-item{
+            margin-bottom: 0;
+        }
+        .require{
+            color: #f56c6c;
+        }
+        .avatar-uploader{
+            padding: 15px;
+        }
+        .avatar-uploader .el-upload {
+            border: 1px dashed #d9d9d9;
+            border-radius: 6px;
+            cursor: pointer;
+            position: relative;
+            overflow: hidden;
+            display: inline-block;
+            vertical-align: middle;
+        }
+        .avatar-uploader .el-upload:hover {
+            border-color: #409EFF;
+        }
+        .avatar-uploader-icon {
+            font-size: 28px;
+            color: #8c939d;
+            width: 178px;
+            height: 178px;
+            line-height: 178px;
+            text-align: center;
+        }
+        .avatar {
+            width: 178px;
+            height: 178px;
+            display: block;
+        }
+        .ticket{
+            border:3px solid #000;
+            padding:10px;
+        }
+        .ticket h2{
+            text-align:center;
+            font:normal 20px/40px "microsoft yahei";
+        }
+        .ticket h3{
+            text-align:center;
+            font:normal 24px/30px "microsoft yahei";
+        }
+        .ex_rule{
+            margin-top: 20px;
+        }
+        .ex_rule h4{
+            font-size: 20px;
+            line-height:50px;
+        }
+        .ex_rule p{
+            text-indent: 30px;
+            line-height: 25px;
+        }
+        .ticket .item{
+            line-height: 30px;
+        }
+        @page {
+            size: auto A4 landscape;
+            margin: 3mm; /* this affects the margin in the printer settings */
+        }
+    </style>
+
+        <div class="mainbox" style="background: #fff">
+            <!--职位切换卡 -->
+            <div class="tab">
+                <a class="li select">我的应招</a>
+                <div class="clear"></div>
+            </div>
+            <!--切换卡结束 -->
+            <div class="userprofile J_focus" id="vue">
+                <div style="width: 100%">
+                    <div class="interview_list_th">
+                        <div class="th1" style="width:300px;">招考场次</div>
+                        <div class="th2" style="width:200px;">申请岗位</div>
+                        <div class="th2" style="width:100px;">
+                            状态
+                        </div>
+                        <div class="th2" style="width:100px;">
+                            操作
+                        </div>
+                        <div class="clear"></div>
+                    </div>
+                    @if($total)
+                        @foreach($list as $key=>$val)
+                            <div class="interview_list J_hoverbut">
+                                <div class="td1" style="width:300px;">&nbsp;<span>{{ $val->recruit_name }}</span></div>
+                                <div class="th2" style="width:200px;">{{ $val->code }}{{ $val->name }}</div>
+                                <div class="td2" style="width:100px;">&nbsp;
+                                    @switch($val->audit)
+                                        @case(1) 审核中 @break
+                                        @case(2) 审核失败 @break
+                                        @case(3) 审核通过 @break
+                                        @default 审核中 @break
+                                    @endswitch
+                                </div>
+                                <div class="td2" style="width:100px;">&nbsp;
+                                    <a href="{{route('recruit.sign_up')}}?id={{$val->recruit_id}}&appoint_info_id={{$val->id}}">查看</a>
+                                </div>
+                                <div class="clear"></div>
+                            </div>
+                        @endforeach
+                    @else
+                        <div class="res_empty link_blue">
+                            目前没有报考记录!
+                        </div>
+                    @endif
+                </div>
+            </div>
+
+        </div>
+
+    </div>
+
+    <script src="{{theme_asset('app/js/vue.min.js')}}"></script>
+    <script src="{{theme_asset('app/js/element.js')}}"></script>
+    <script>
+        new Vue({
+            el: '#vue',
+            data: function() {
+                return {
+                    error: 0,
+                    info: 0,
+                    success: 1,
+                    error_msg: 'sfsdf',
+                    user:[],
+                    rules: '',
+                    init: 0,
+                    upload: '',
+                    post_data:[],
+                }
+            },
+            methods: {
+                beforeImageUpload(file) {
+                    const isJPG = (file.type === 'image/jpeg' || file.type === 'image/png');
+                    const isLt2M = file.size / 1024 / 1024 < 2;
+
+                    if (!isJPG) {
+                        this.$message.error('上传图片只能是 JPG、PNG 格式!');
+                    }
+                    if (!isLt2M) {
+                        this.$message.error('上传图片大小不能超过 2MB!');
+                    }
+                    return isJPG && isLt2M;
+                },
+                handleFrontCardSuccess(res, file){
+
+                },
+                handleBackCardSuccess(res, file){
+
+                }
+            }
+        })
+    </script>
+
+

+ 2 - 0
routes/web.php

@@ -129,6 +129,8 @@ Route::group([
 
     $router->post('supplementary_entry','Web\Recruit\IndexController@supplementary_entry')->name('recruit,supplementary_entry');
 
+    $router->post("get_appoint_list",'Web\Recruit\IndexController@show_sign_limit')->name('recruit.get_appoint_list');
+
     $router->any('/{route?}', function () {
         return view('recruit');
     })->where(['route' => '.*']);