123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024 |
- <?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;
- use App\Services\Common\BaiduService;
- use App\Models\RecruitAppointSelect;
- class IndexController extends WebBaseController
- {
- protected $recruitService, $baiduService;
- public function __construct(RecruitService $recruitService, BaiduService $baiduService)
- {
- $this->recruitService = $recruitService;
- $this->baiduService = $baiduService;
- }
- /**
- * 招考列表页
- * @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.index.list'), true, '上一页', '2');
- }
- $recruit = Recruit::where('status',1)->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) {
- //20221115增加确认笔试功能
- if ($recruit->pen_comfirm) {
- if ($appoint_info->audit != 3) {//审核未通过,无需确认
- $appoint_info->pen_comfirm = 0;
- } else {
- $time = time();
- if (strtotime($recruit->pen_comfirm_start) > $time || strtotime($recruit->pen_comfirm_end) < $time) {
- $appoint_info->pen_comfirm = -1; //确认未开始
- } else {
- if ($appoint_info->pen_audit != -2) {
- $appoint_info->pen_comfirm = -2;//已确认无需再次确认
- } else {
- $appoint_info->pen_comfirm = 1;
- }
- }
- }
- } else {
- $appoint_info->pen_comfirm = 0;//无需确认
- }
- //笔试
- $pen_ticket = RecruitTicket::where('appoint_id', $appoint_info->id)->where('ex_type', 1)->first();
- if ($pen_ticket) {
- $pen_health = RecruitSupplement::where("appoint_id", $appoint_info->id)->where("type", "pen")->where('h_status', 1)->first();
- if (!$pen_health && $recruit->pen_epidemic) {
- $appoint_info->pen_ticket = -2;
- } else {
- $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) {
- $face_health = RecruitSupplement::where("appoint_id", $appoint_info->id)->where("type", "face")->where('h_status', 1)->first();
- if (!$face_health && $recruit->face_epidemic) {
- $appoint_info->face_ticket = -2;
- $time = time();
- if (strtotime($recruit->face_health_start) < $time && strtotime($recruit->face_health_end) > $time) {
- $appoint_info->face_ticket = -2;
- } else {
- $appoint_info->face_ticket = -3;
- }
- } else {
- $time = time();
- if (strtotime($recruit->face_health_start) < $time && strtotime($recruit->face_health_end) > $time) {
- $appoint_info->face_ticket = 1;
- } else {
- $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) {
- $reexamine_health = RecruitSupplement::where("appoint_id", $appoint_info->id)->where("type", "reexamine")->where('h_status', 1)->first();
- if (!$reexamine_health && $recruit->reexamine_epidemic) {
- $appoint_info->face_ticket = -2;
- $time = time();
- if (strtotime($recruit->reexamine_health_start) < $time && strtotime($recruit->reexamine_health_end) > $time) {
- $appoint_info->reexamine_ticket = -2;
- } else {
- $appoint_info->reexamine_ticket = -3;
- }
- } else {
- $time = time();
- if (strtotime($recruit->reexamine_health_start) < $time && strtotime($recruit->reexamine_health_end) > $time) {
- $appoint_info->reexamine_ticket = 1;
- } else {
- $appoint_info->reexamine_ticket = -1;
- }
- }
- } else {
- $appoint_info->reexamine_ticket = 0;
- }
- } else {
- $appoint_info = new \stdClass();
- $appoint_info->pen_comfirm = 0;
- $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;
- $appoint_info->adjust = 0;
- $appoint_info->adjust_limit = 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)->where('is_display', 1)->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.index.list'), true, '上一页', '2');
- }
- $recruit = Recruit::find($id);
- if (empty($recruit)) {
- return redirect(route('/recruit/list'));
- }
- if (!$recruit->show_report) {
- return $this->showMessage('抱歉,该场次不允许查看报名人数统计结果!', route('recruit.index.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.index.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,
- 'title' => $recruit->company,
- ];
- 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', ['id', $recruit['id']]), true, '上一页', '3');
- }
- 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();
- $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']);
- //查询报名表是否已有记录
- 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;
- if (json_decode($user_info['hj_certification'])) {
- $hj_certification = json_decode($user_info['hj_certification'], true);
- foreach ($hj_certification as $k => $v) {
- if (array_key_exists('response', $v)) {
- $hj_certification[$k]['url'] = $v['response']['path'];
- }
- }
- } else {
- $hj_certification = [];
- }
- $user_info['hj_certification'] = $hj_certification;
- if (json_decode($user_info['chengnuoshu'])) {
- $chengnuoshu = json_decode($user_info['chengnuoshu'], true);
- foreach ($chengnuoshu as $k => $v) {
- if (array_key_exists('response', $v)) {
- $chengnuoshu[$k]['url'] = $v['response']['path'];
- }
- }
- } else {
- $chengnuoshu = [];
- }
- $user_info['chengnuoshu'] = $chengnuoshu;
- if (json_decode($user_info['shixin'])) {
- $shixin = json_decode($user_info['shixin'], true);
- foreach ($shixin as $k => $v) {
- if (array_key_exists('response', $v)) {
- $shixin[$k]['url'] = $v['response']['path'];
- }
- }
- } else {
- $shixin = [];
- }
- $user_info['shixin'] = $shixin;
- if (json_decode($user_info['baokaoshengming'])) {
- $baokaoshengming = json_decode($user_info['baokaoshengming'], true);
- foreach ($baokaoshengming as $k => $v) {
- if (array_key_exists('response', $v)) {
- $baokaoshengming[$k]['url'] = $v['response']['path'];
- }
- }
- } else {
- $baokaoshengming = [];
- }
- $user_info['baokaoshengming'] = $baokaoshengming;
- //获取最新的报名审核信息
- $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 ($special) {
- if (strpos($special['condition'], ',') !== false) {
- $special['condition'] = explode(',', $special['condition']);
- }
- $material = json_decode($special['material'], true);
- if (is_array($material)) {
- 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 = [];
- $special = [
- 'point_apply' => '0',
- 'condition' => '',
- ];
- }
- $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;
- }
- //如果有户籍证明模块
- if (in_array('hj_certification', $forms)) {
- if (json_decode($user_info['hj_certification'])) {
- $hj_certification = json_decode($user_info['hj_certification'], true);
- foreach ($hj_certification as $k => $v) {
- if (array_key_exists('response', $v)) {
- if (array_key_exists('path', $v['response'])) {
- $hj_certification[$k]['url'] = $v['response']['path'];
- }
- }
- }
- } else {
- $hj_certification = [];
- }
- $user_info['hj_certification'] = $hj_certification;
- }
- //如果有承诺书模块
- if (in_array('chengnuoshu', $forms)) {
- if (json_decode($user_info['chengnuoshu'])) {
- $chengnuoshu = json_decode($user_info['chengnuoshu'], true);
- foreach ($chengnuoshu as $k => $v) {
- if (array_key_exists('response', $v)) {
- if (array_key_exists('path', $v['response'])) {
- $chengnuoshu[$k]['url'] = $v['response']['path'];
- }
- }
- }
- } else {
- $chengnuoshu = [];
- }
- $user_info['chengnuoshu'] = $chengnuoshu;
- }
- //如果有失信被执行人模块
- if (in_array('shixin', $forms)) {
- if (json_decode($user_info['shixin'])) {
- $shixin = json_decode($user_info['shixin'], true);
- foreach ($shixin as $k => $v) {
- if (array_key_exists('response', $v)) {
- if (array_key_exists('path', $v['response'])) {
- $shixin[$k]['url'] = $v['response']['path'];
- }
- }
- }
- } else {
- $shixin = [];
- }
- $user_info['shixin'] = $shixin;
- }
- //如果有声明书模块
- if (in_array('baokaoshengming', $forms)) {
- if (json_decode($user_info['baokaoshengming'])) {
- $baokaoshengming = json_decode($user_info['baokaoshengming'], true);
- foreach ($baokaoshengming as $k => $v) {
- if (array_key_exists('response', $v)) {
- if (array_key_exists('path', $v['response'])) {
- $baokaoshengming[$k]['url'] = $v['response']['path'];
- }
- }
- }
- } else {
- $baokaoshengming = [];
- }
- $user_info['baokaoshengming'] = $baokaoshengming;
- }
- //获取最新的报名审核信息
- $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' => [],
- 'hj_certification' => [],
- 'chengnuoshu' => [],
- 'baokaoshengming' => [],
- 'shixin' => [],
- ]);
- } else {
- //如果没有,结合基础数据及模块表单信息,制作数据对象
- $user_info = RecruitAppointBasic::where('uid', $uid)->first();
- if (!$user_info) {
- //没有基础信息跳转完善route('person.recruitInfo')
- return $this->showMessage('请先完善招考基础信息!', route('recruit.recruitInfo', ['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'] = [];
- }
- if (in_array('hj_certification', $forms)) {
- $user_info['hj_certification'] = [];
- }
- if (in_array('chengnuoshu', $forms)) {
- $user_info['chengnuoshu'] = [];
- }
- if (in_array('shixin', $forms)) {
- $user_info['shixin'] = [];
- }
- if (in_array('baokaoshengming', $forms)) {
- $user_info['baokaoshengming'] = [];
- }
- $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 = [];
- $post_special = [];
- foreach ($recruit_post as $value) {
- $item = [
- 'value' => $value['id'],
- 'label' => $value['code'] . " " . $value['name'],
- ];
- $post_limit[$value['id']] = json_decode($value['limit']);
- $post_special[$value['id']] = json_decode($value['special']);
- array_push($post, $item);
- }
- $view_data['id'] = $id;
- $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['post_special'] = json_encode($post_special);
- $view_data['formDisable'] = $formDisabled;
- $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);
- }
- 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 && $recruit['current'] != 2) {
- return response()->json(['status' => 0, 'msg' => '抱歉,该项目报名通道已关闭,如有疑问,请联系客服!']);
- }
- $card = $request->input('card');
- $appointinfo_exist = RecruitAppointInfo::where('card', $card)->where('uid', '<>', $uid)->where('recruit_id', $recruit_id)->first();
- //兆丰建设两场公告二而一例外
- if ($recruit_id == 25 || $recruit_id == 26) {
- $special = RecruitAppointInfo::where('card', $card)->where('uid', '<>', $uid)->whereIn('recruit_id', [25, 26])->first();
- $appointinfo_exist = $appointinfo_exist & $special;
- }
- if ($appointinfo_exist) {
- 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 (($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' => '抱歉,该项目已过报名时间!']);
- }
- }
- $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' => '请选择报考岗位']);
- }
- $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 {
- //基础信息的检查
- $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',
- 'graduation' => 'required',
- 'address' => 'required',
- 'mobile' => 'required',
- 'email' => 'required',
- 'card_type' => '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' => '请输入毕业院校',
- 'graduation.required' => '请填写毕业时间',
- 'address.required' => '请填写通信地址',
- 'mobile.required' => '请填写手机号码',
- 'email.required' => '请填写电子邮箱',
- 'card_type.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]]);
- }
- $data['audit'] = 1;//提交
- }
- if (strlen($data['card']) == 18) {
- //身份证判断出生日期和性别
- $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;
- }
- }
- try {
- 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;
- }
- }
- }
- }
- } catch (\Exception $e) {
- error_log(serialize($data), 3, '/data/wwwroot/jucai/sms');
- return ['status' => 0, 'msg' => '数据有误,请联系客服'];
- }
- //前置审核 判断完成,先将数据入报名信息基础表
- //解析家庭成员数据
- $familys = $request->input('family');
- $family = [];
- if (is_array($familys)) {
- foreach ($familys as $value) {
- if (!array_key_exists('relation', $value) || !array_key_exists('realname', $value) || !array_key_exists('birthday', $value) || !array_key_exists('political_affiliation', $value) || !array_key_exists('work', $value)) {
- return ['status' => 0, 'msg' => '请填写完整的家庭成员信息'];
- }
- $item = [
- 'relation' => $value['relation'],
- 'realname' => $value['realname'],
- 'birthday' => $value['birthday'],
- 'political_affiliation' => $value['political_affiliation'],
- 'work' => $value['work'],
- ];
- array_push($family, $item);
- }
- }
- $forms = explode(',', $recruit['forms']);
- if (in_array('expand_special', $forms)) {
- $special = $request->input('special');
- if ($special['point_apply'] && is_array($special['condition']) && count($special['condition']) == 0) {
- return response()->json(['status' => 0, 'msg' => '加分条件不能为空']);
- }
- if ($special['point_apply'] && ($special['condition'] == '')) {
- return response()->json(['status' => 0, 'msg' => '加分条件不能为空']);
- }
- }
- $data['family'] = json_encode($family);
- if ($appoint_info) {
- //如果已有报名记录,进入修改阶段的处理流程
- DB::beginTransaction();
- try {
- RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $recruit_id)->update($data);
- //分模块解析数据
- //如果有加分模块
- if (in_array('expand_special', $forms)) {
- $special = $request->input('special');
- if ($special['point_apply']) {//如果申请加分
- if (!array_key_exists('material', $special)) {
- return response()->json(['status' => 0, 'msg' => '加分佐证材料不能为空!']);
- }
- //删除掉没有成功返回路径的图片
- if (is_array($special['material'])) {
- foreach ($special['material'] as $k => $v) {
- if (!array_key_exists('response', $v)) {
- unset($special['material'][$k]);
- }
- }
- }
- switch ($recruit->special_condition_type) {
- case 0:
- $special['point'] = 0;
- break;
- case 1:
- $special_rule = json_decode($recruit->special_condition_value, true);
- $conditions = array_column($special_rule['list'], 'condition');
- $special['point'] = 0;
- if (array_key_exists('multi', $special_rule) && $special_rule['multi'] && is_array($special['condition'])) {
- foreach ($special['condition'] as $v) {
- $key = array_search($v, $conditions);
- $rule_info = $special_rule['list'][$key];
- $special['point'] += $rule_info['value'];
- }
- } else {
- $key = array_search($special['condition'], $conditions);
- $rule_info = $special_rule['list'][$key];
- $special['point'] += $rule_info['value'];
- }
- break;
- case 2:
- $special_rule = json_decode($post_info['special'], true);
- $conditions = array_column($special_rule['list'], 'condition');
- $special['point'] = 0;
- if (array_key_exists('multi', $special_rule) && $special_rule['multi'] && is_array($special['condition'])) {
- foreach ($special['condition'] as $v) {
- $key = array_search($v, $conditions);
- $rule_info = $special_rule['list'][$key];
- $special['point'] += $rule_info['value'];
- }
- } else {
- $key = array_search($special['condition'], $conditions);
- $rule_info = $special_rule['list'][$key];
- $special['point'] += $rule_info['value'];
- }
- break;
- }
- if (is_array($special['condition'])) {
- $special['condition'] = implode(',', $special['condition']);
- }
- $special['material'] = json_encode($special['material']);
- $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);
- }
- } else {
- RecruitAppointExpandSpecial::where('recruit_appoint_id', $appoint_info->id)->update(['point_apply' => 0, 'condition' => '', 'point' => 0, 'material' => null]);
- }
- }
- //如果有详情模块
- 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();
- }
- }
- //如果有其他证明模块
- if (in_array('hj_certification', $forms)) {
- $hj_certification = $request->input('hj_certification');
- if (is_array($hj_certification)) {
- //删除掉没有成功返回路径的图片
- foreach ($hj_certification as $k => $v) {
- if (!array_key_exists('response', $v)) {
- unset($hj_certification[$k]);
- }
- }
- }
- if ($hj_certification) {
- $appoint_info->hj_certification = json_encode($hj_certification);
- $appoint_info->save();
- }
- }
- //如果有承诺书模块
- if (in_array('chengnuoshu', $forms)) {
- $chengnuoshu = $request->input('chengnuoshu');
- if (is_array($chengnuoshu)) {
- //删除掉没有成功返回路径的图片
- foreach ($chengnuoshu as $k => $v) {
- if (!array_key_exists('response', $v)) {
- unset($chengnuoshu[$k]);
- }
- }
- }
- if ($chengnuoshu) {
- $appoint_info->chengnuoshu = json_encode($chengnuoshu);
- $appoint_info->save();
- }
- }
- //如果有失信被执行人模块
- if (in_array('shixin', $forms)) {
- $shixin = $request->input('shixin');
- if (is_array($shixin)) {
- //删除掉没有成功返回路径的图片
- foreach ($shixin as $k => $v) {
- if (!array_key_exists('response', $v)) {
- unset($shixin[$k]);
- }
- }
- }
- if ($shixin) {
- $appoint_info->shixin = json_encode($shixin);
- $appoint_info->save();
- }
- }
- //如果有声明书模块
- if (in_array('baokaoshengming', $forms)) {
- $baokaoshengming = $request->input('baokaoshengming');
- if (is_array($baokaoshengming)) {
- //删除掉没有成功返回路径的图片
- foreach ($baokaoshengming as $k => $v) {
- if (!array_key_exists('response', $v)) {
- unset($baokaoshengming[$k]);
- }
- }
- }
- if ($baokaoshengming) {
- $appoint_info->baokaoshengming = json_encode($baokaoshengming);
- $appoint_info->save();
- }
- }
- DB::commit();
- if ($operation == 2) {
- $log = [
- 'type' => 3,
- 'appoint_id' => $appoint_info->id,
- 'uid' => $uid,
- 'log' => '用户提交报名',
- ];
- RecruitAppointLog::create($log);
- if (empty($recruit->qr_code)) {
- return ['status' => 1, 'msg' => '提交成功', 'data' => $appoint_info->id, 'is_html' => 0];
- } else {
- return ['status' => 1, 'msg' => "<h3 style='text-align: center'>提交成功,添加工作人员企业微信了解后续信息</h3><p style='text-align: center'><img src='{$recruit->qr_code}' width='240' height='240' /></p>", 'data' => $appoint_info->id, 'is_html' => 1];
- }
- } else {
- return ['status' => 1, 'msg' => '资料保存成功,请尽快完善并提交', 'data' => $appoint_info->id];
- }
- } catch (\Exception $e) {
- DB::rollback();
- return ['status' => 0, 'msg' => $e->getMessage()];
- }
- } else {
- //没有报名记录,进入增加阶段的处理流程
- DB::beginTransaction();
- try {
- //20220726增加地区undefined选项处理
- if ($index = stripos($data['native_place'], ',undefined')) {
- $data['native_place'] = substr($data['native_place'], 0, $index);
- }
- if ($index = stripos($data['house_register'], ',undefined')) {
- $data['house_register'] = substr($data['house_register'], 0, $index);
- }
- $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]);
- }
- }
- }
- switch ($recruit->special_condition_type) {
- case 0:
- $special['point'] = 0;
- break;
- case 1:
- $special_rule = json_decode($recruit->special_condition_value, true);
- $conditions = array_column($special_rule['list'], 'condition');
- $special['point'] = 0;
- if (array_key_exists('multi', $special_rule) && $special_rule['multi'] && is_array($special['condition'])) {
- foreach ($special['condition'] as $v) {
- $key = array_search($v, $conditions);
- $rule_info = $special_rule['list'][$key];
- $special['point'] += $rule_info['value'];
- }
- } else {
- $key = array_search($special['condition'], $conditions);
- $rule_info = $special_rule['list'][$key];
- $special['point'] += $rule_info['value'];
- }
- break;
- case 2:
- $special_rule = json_decode($post_info['special'], true);
- $conditions = array_column($special_rule['list'], 'condition');
- $special['point'] = 0;
- if (array_key_exists('multi', $special_rule) && $special_rule['multi'] && is_array($special['condition'])) {
- foreach ($special['condition'] as $v) {
- $key = array_search($v, $conditions);
- $rule_info = $special_rule['list'][$key];
- $special['point'] += $rule_info['value'];
- }
- } else {
- $key = array_search($special['condition'], $conditions);
- $rule_info = $special_rule['list'][$key];
- $special['point'] += $rule_info['value'];
- }
- break;
- }
- if (is_array($special['condition'])) {
- $special['condition'] = implode(',', $special['condition']);
- }
- $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();
- }
- }
- //如果有户籍证明模块
- if (in_array('hj_certification', $forms)) {
- $hj_certification = $request->input('hj_certification');
- if ($hj_certification) {
- if (is_array($hj_certification)) {
- //删除掉没有成功返回路径的图片
- foreach ($hj_certification as $k => $v) {
- if (!array_key_exists('response', $v)) {
- unset($hj_certification[$k]);
- }
- }
- }
- $result->hj_certification = json_encode($hj_certification);
- $result->save();
- }
- }
- //如果有承诺书模块
- if (in_array('chengnuoshu', $forms)) {
- $chengnuoshu = $request->input('chengnuoshu');
- if ($chengnuoshu) {
- if (is_array($chengnuoshu)) {
- //删除掉没有成功返回路径的图片
- foreach ($chengnuoshu as $k => $v) {
- if (!array_key_exists('response', $v)) {
- unset($chengnuoshu[$k]);
- }
- }
- }
- $result->chengnuoshu = json_encode($chengnuoshu);
- $result->save();
- }
- }
- //如果有失信被执行人模块
- if (in_array('shixin', $forms)) {
- $shixin = $request->input('shixin');
- if ($shixin) {
- if (is_array($shixin)) {
- //删除掉没有成功返回路径的图片
- foreach ($shixin as $k => $v) {
- if (!array_key_exists('response', $v)) {
- unset($shixin[$k]);
- }
- }
- }
- $result->shixin = json_encode($shixin);
- $result->save();
- }
- }
- //如果有声明书模块
- if (in_array('baokaoshengming', $forms)) {
- $baokaoshengming = $request->input('baokaoshengming');
- if ($baokaoshengming) {
- if (is_array($baokaoshengming)) {
- //删除掉没有成功返回路径的图片
- foreach ($baokaoshengming as $k => $v) {
- if (!array_key_exists('response', $v)) {
- unset($baokaoshengming[$k]);
- }
- }
- }
- $result->baokaoshengming = json_encode($baokaoshengming);
- $result->save();
- }
- }
- DB::commit();
- if ($operation == 2) {
- $log = [
- 'type' => 3,
- 'appoint_id' => $result->id,
- 'uid' => $uid,
- 'log' => '用户首次提交报名',
- ];
- RecruitAppointLog::create($log);
- if (empty($recruit->qr_code)) {
- return ['status' => 1, 'msg' => '提交成功', 'data' => $result->id, 'is_html' => 0];
- } else {
- return ['status' => 1, 'msg' => "<h3 style='text-align: center'>提交成功,添加工作人员企业微信了解后续信息</h3><p><img src='/storage/{$recruit->qr_code}' width='240' height='240' /></p>", 'data' => $result->id, 'is_html' => 1];
- }
- //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();
- if (!empty($user)) {
- $uid = $user->id;
- } else {
- return redirect(route('login'));
- }
- $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');
- $recruit = Recruit::where('id', $recruit_id)->first();
- $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) {
- $health = RecruitSupplement::where('appoint_id', $appoint_info->id)->first();
- if ((!$health || $health->h_status == 0) && $recruit->pen_epidemic) {
- return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
- }
- $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]);
- $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];
- $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
- return view('app.recruit.recruit_ticket', [
- 'title' => "{$filename}.docx",
- 'url' => "/storage/recruit/ticket/word/{$date}/{$name}/pen/{$filename}.docx",
- ]);
- $file = base_path() . "/storage/recruit/ticket/pdf/{$date}/{$name}/pen/" . $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');
- }
- } 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');
- $recruit = Recruit::where('id', $recruit_id)->first();
- $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) {
- $health = RecruitSupplement::where('appoint_id', $appoint_info->id)->first();
- if ((!$health || $health->h_status == 0) && $recruit->pen_epidemic) {
- return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
- }
- $time = time();
- if (strtotime($check_ticket->ex_start) < $time && strtotime($check_ticket->ex_end) > $time) {
- RecruitTicket::where('id', $check_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];
- $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
- $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/computer/" . $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');
- $recruit = Recruit::where('id', $recruit_id)->first();
- $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) {
- $health = RecruitSupplement::where('appoint_id', $appoint_info->id)->first();
- if ((!$health || $health->h_status == 0) && $recruit->pen_epidemic) {
- return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
- }
- $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];
- $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
- $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 = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
- $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/reexamine/" . $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', ['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', ['id', $recruit['id']]), true, '上一页', '3');
- }
- if ($appoint_info->pen_audit != 1) {
- return $this->showMessage('抱歉,您未入闱,无需考察审核!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
- }
- $limit_time = 1726824600;
- $time = time();
- if ($time > $limit_time) {
- return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
- }
- $info = RecruitSupplement::where('appoint_id', $appoint_info->id)->where('type', 'supplement')->first();
- if (!$info) {
- $info = [
- 'appoint_id' => $appoint_info->id,
- 'identification' => '',
- //'household_register' => '',
- //'education_certification' => '',
- //'family_planning' => '',
- 'chengxin' => '',
- '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['chengxin'])) {
- $chengxin = json_decode($info['chengxin'], true);
- foreach ($chengxin as $k => $v) {
- if (array_key_exists('response', $v)) {
- $chengxin[$k]['url'] = $v['response']['path'];
- }
- }
- } else {
- $chengxin = [];
- }
- $info['chengxin'] = $chengxin;
- 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', ['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', ['id', $recruit['id']]), true, '上一页', '3');
- }
- if ($appoint_info->audit != 3) {
- return $this->showMessage('抱歉,您无需登记!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
- }
- $time = time();
- $type = $request->input('type', null);
- $where = [];
- if ($type) {
- switch ($type) {
- case 'pen':
- $start = strtotime($recruit->pen_health_start);
- $end = strtotime($recruit->pen_health_end);
- break;
- case 'computer':
- $start = strtotime($recruit->computer_health_start);
- $end = strtotime($recruit->computer_health_end);
- break;
- case 'face':
- $start = strtotime($recruit->face_health_start);
- $end = strtotime($recruit->face_health_end);
- break;
- case 'reexamine':
- $start = strtotime($recruit->reexamine_health_start);
- $end = strtotime($recruit->reexamine_health_end);
- break;
- default:
- $start = strtotime($recruit->supplement_start);
- $end = strtotime($recruit->supplement_end);
- break;
- }
- $where[] = ['type', '=', $type];
- } else {
- $start = strtotime($recruit->supplement_start);
- $end = strtotime($recruit->supplement_end);
- }
- if ($time > $end || $time < $start) {
- return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
- }
- $where[] = ['appoint_id', '=', $appoint_info->id];
- $info = RecruitSupplement::where($where)->first();
- if (!$info) {
- $info = [
- 'appoint_id' => $appoint_info->id,
- 'health_code' => '',
- 'trip_code' => '',
- 'type' => $type,
- ];
- } 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'));
- }
- $limit_time = 1726824600;
- $time = time();
- if ($time > $limit_time) {
- return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show', ['id', 38]), true, '上一页', '3');
- }
- $appoint_id = $request->input('appoint_id');
- $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', 68)->where('id', $appoint_id)->first();
- if (!$appoint_info) {
- return ['status' => 0, 'msg' => '抱歉,找不到您要补登的报名记录!'];
- }
- $info = RecruitSupplement::where('appoint_id', $appoint_id)->where('type', 'supplement')->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);
- //失信查询 情况
- $chengxin = $request->input('chengxin');
- if (is_array($chengxin)) {
- //删除掉没有成功返回路径的图片
- foreach ($chengxin as $k => $v) {
- if (!array_key_exists('response', $v)) {
- unset($chengxin[$k]);
- }
- }
- }
- $info->chengxin = json_encode($chengxin);
- //综治
- $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);
- //失信查询 情况
- $chengxin = $request->input('chengxin');
- if (is_array($chengxin)) {
- //删除掉没有成功返回路径的图片
- foreach ($chengxin as $k => $v) {
- if (!array_key_exists('response', $v)) {
- unset($chengxin[$k]);
- }
- }
- }
- $data['chengxin'] = json_encode($chengxin);
- //综治
- $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;
- $data['type'] = 'supplement';
- $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');
- $type = $request->input('type');
- $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('id', $appoint_id)->first();
- if (!$appoint_info) {
- return ['status' => 0, 'msg' => '抱歉,找不到您要登记的报名记录!'];
- }
- $recruit = Recruit::where('id', $appoint_info->recruit_id)->first();
- $info = RecruitSupplement::where('appoint_id', $appoint_id)->where('type', $type)->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->h_status = 0;
- $appoint_info->health_audit = 4;
- $appoint_info->save();
- $info->save();
- return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
- } else {
- $data['appoint_id'] = $appoint_id;
- $data['type'] = $type;
- $data['h_status'] = 0;
- $appoint_info->health_audit = 4;
- $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]);
- }
- }
- }
- $health_result = $this->baiduService->health_code(file_get_contents(base_path() . "/public" . $health_code[0]['response']['path']));
- $health_msg = ['健康码自动审核通过'];
- //$h_status = 1;
- //$appoint_info->health_audit = 1;
- if (!array_key_exists('error_msg', $health_result) && !array_key_exists('error_code', $health_result)) {
- if (array_key_exists('姓名', $health_result)) {
- if (stripos($health_result['姓名'][0]['word'], '*') > 0) {
- return ['status' => 0, 'msg' => '请打开健康码的“眼睛开关”,显示完整个人信息'];
- }
- if ($health_result['姓名'][0]['word'] != $appoint_info->realname) {
- array_push($health_msg, '抱歉,请上传您本人的健康码!');
- }
- } else {
- array_push($health_msg, '健康码错误,识别不到姓名!');
- }
- if (array_key_exists('状态', $health_result)) {
- if ($health_result['状态'][0]['word'] != '绿码') {
- array_push($health_msg, '抱歉,您的健康码非绿码!');
- }
- } else {
- array_push($health_msg, '健康码错误,识别不到状态!');
- }
- if (array_key_exists('更新时间', $health_result)) {
- $time = strtotime($health_result['更新时间'][0]['word']);
- if ($time < strtotime($recruit->pen_health_start) || $time > strtotime($recruit->pen_health_end)) {
- array_push($health_msg, '抱歉,请上传{$recruit->pen_health_start}至{$recruit->pen_health_end}之间的健康码!');
- }
- } else {
- array_push($health_msg, '健康码错误,识别不到时间!');
- }
- //$data['h_status'] = $h_status;
- $data['h_msg'] = implode(';', $health_msg);
- //$appoint_info->health_audit = $h_status == 1 ? 1 : 4;
- $data['health_code'] = json_encode($health_code);
- }
- $data['health_result'] = json_encode($health_result);
- $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]);
- }
- }
- }
- $trip_result = $this->baiduService->trip_code(file_get_contents(base_path() . "/public" . $trip_code[0]['response']['path']));
- $trip_msg = [];
- $trip_status = 0;
- if (!array_key_exists('error_msg', $trip_result) && !array_key_exists('error_code', $trip_result)) {
- if (array_key_exists('途经地', $trip_result['result'])) {
- $fangyi_area = explode("\r\n", config('aix.fangyi.fangyi_zhaokao.fangyi_zhaokao.risk_area'));
- $result = array_intersect($fangyi_area, $trip_result['result']['途经地'][0]['word']);
- if (count($result) > 0) {
- array_push($trip_msg, '抱歉,您的行程中包含系统设置中高风险地区!');
- $trip_status = 0;
- }
- }
- if (array_key_exists('风险性', $trip_result['result']) && $trip_result['result']['风险性']) {
- array_push($trip_msg, '抱歉,您的行程可能含有风险!');
- $trip_status = 0;
- }
- if (array_key_exists('更新时间', $trip_result['result'])) {
- $time = strtotime($trip_result['result']['更新时间'][0]['word'][0]);
- if ($time > strtotime($recruit->pen_health_start) || $recruit < ($recruit->pen_health_end)) {
- array_push($trip_msg, '抱歉,请上传{$recruit->pen_health_start}至{$recruit->pen_health_end}之间的行程码!');
- $trip_status = 0;
- }
- }
- $data['h_msg'] .= implode(';', $trip_msg);
- }
- $data['trip_result'] = json_encode($trip_result);
- $data['trip_code'] = json_encode($trip_code);
- $data['h_status'] = 0;
- $appoint_info->health_audit = 4;
- RecruitSupplement::create($data);
- $appoint_info->save();
- return ['status' => 1, 'msg' => '提交成功,请刷新查看审核结果', 'data' => ''];
- }
- return ['status' => 0, 'msg' => 'test', 'data' => ''];
- }
- public function post_select(Request $request)
- {
- $user = $this->getUser();
- if (!empty($user)) {
- $uid = $user->id;
- } else {
- return redirect(route('login'));
- }
- $recruit_id = $request->input('recruit_id');
- //$appoint_id = $request->input('appoint_id');
- $info = RecruitAppointSelect::where('uid', $uid)->where('recruit_id', $recruit_id)->first();
- if (!$info) {
- return $this->showMessage('抱歉,您无需择岗!', route('recruit.show', ['id', $recruit_id]), true, '上一页', '2');
- }
- //手动设置择岗时间段
- $time = time();
- if ($time > 1727150400 || $time < 1727053200) {
- //if($time > 1694491200){
- return $this->showMessage('抱歉,未到择岗时间!', route('recruit.show', ['id', $recruit_id]), true, '上一页', '2');
- }
- $option_list = [
- [
- 'id' => 1,
- 'name' => '陈埭镇',
- ],
- [
- 'id' => 2,
- 'name' => '金井镇',
- ],
- [
- 'id' => 3,
- 'name' => '深沪镇'
- ]
- ];
- $select_list = [];
- if ($info->result) {
- $result = json_decode($info->result, true);
- foreach ($result as $v) {
- $item['name'] = $v;
- array_push($select_list, $item);
- }
- }
- // $recruit_id = $request->input('recruit_id');
- // $appoint_id = $request->input('appoint_id');
- // $uid = $request->input('uid');
- // $info = RecruitAppointSelect::where('uid',$uid)->first();
- // if(!$info){
- // $info = new \stdClass();
- // $info->status = 0;
- // $info->recruit_id = 8;
- // $info->appoint_id = rand(0,999999);
- // $info->uid = rand(0,999999);
- // }else{
- // $result = json_decode($info->result,true);
- // foreach ($option_list as $k => $v){
- // if(in_array($v['name'],$result)){
- // $select_list[$k] = $v;
- // unset($option_list[$k]);
- // }
- // }
- // }
- $view_data = ['info' => $info, 'options_list' => json_encode($option_list), 'select_list' => json_encode($select_list)];
- return view('app.recruit.post_select', $view_data);
- }
- /**
- * 放弃择岗
- */
- public function give_up_post(Request $request)
- {
- //以下为测试环境
- // $recruit_id = $request->input('recruit_id');
- // $appoint_id = $request->input('appoint_id');
- // $uid = $request->input('uid');
- // $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->where('appoint_id',$appoint_id)->first();
- // if($info){
- // return ['status' => 0, 'msg' => "测试数据重复,请重新点击生成测试数据!"];
- // }
- // RecruitAppointSelect::create(['recruit_id'=>$recruit_id,'appoint_id'=>$appoint_id,'uid'=>$uid,'status'=>-1]);
- // return ['status' => 1, 'msg' => "放弃择岗成功!"];
- //以下为正式环境再放开
- $user = $this->getUser();
- if (!empty($user)) {
- $uid = $user->id;
- } else {
- return redirect(route('login'));
- }
- $recruit_id = $request->input('recruit_id');
- $appoint_id = $request->input('appoint_id');
- $info = RecruitAppointSelect::where('uid', $uid)->where('recruit_id', $recruit_id)->where('appoint_id', $appoint_id)->first();
- if ($info == null) {
- return ['status' => 0, 'msg' => "抱歉,您无需择岗!"];
- }
- if ($info->status != 0) {
- return ['status' => 0, 'msg' => "抱歉,您不是待择岗状态!"];
- }
- $info->status = -1;
- $info->save();
- return ['status' => 1, 'msg' => "放弃择岗成功!"];
- }
- public function comfirm_post(Request $request)
- {
- $user = $this->getUser();
- if (!empty($user)) {
- $uid = $user->id;
- } else {
- return redirect(route('login'));
- }
- $recruit_id = $request->input('recruit_id');
- $appoint_id = $request->input('appoint_id');
- $time = time();
- if ($time > 1727150400 || $time < 1727053200) {
- return ['status' => 0, 'msg' => "抱歉,未到择岗时间!"];
- }
- $info = RecruitAppointSelect::where('uid', $uid)->where('recruit_id', $recruit_id)->where('appoint_id', $appoint_id)->first();
- if ($info->result) {
- return ['status' => 0, 'msg' => "择岗数据已提交!"];
- }
- // $data = [
- // 'recruit_id' => $recruit_id,
- // 'appoint_id' => $recruit_id,
- // 'uid' => $uid,
- // 'status' => 1
- // ];
- $result = [];
- $select = $request->input('select');
- if (is_array($select) && count($select) > 0) {
- foreach ($select as $v) {
- array_push($result, $v['name']);
- }
- }
- $info->result = json_encode($result);
- $info->status = 1;
- $info->save();
- return ['status' => 1, 'msg' => "提交择岗意愿成功,请耐心等待结果!"];
- }
- public function select_result(Request $request)
- {
- $redis = Cache::getRedis();
- $redis->set('recruit_quota_batch5', '');
- return view('app.recruit.select_result');
- }
- public function get_select_result(Request $request)
- {
- $redis = Cache::getRedis();
- $quot_batch5 = $redis->get('recruit_quota_batch5');
- if (!$quot_batch5) {
- $quot_batch5 = [
- [
- 'name' => '陈埭镇',
- 'value' => 21,
- ],
- [
- 'name' => '金井镇',
- 'value' => 3
- ],
- [
- 'name' => '深沪镇',
- 'value' => 2
- ]
- ];
- $redis->set('recruit_quotaA', json_encode($quot_batch5));
- } else {
- $quot_batch5 = json_decode($quot_batch5, true);
- }
- $list = DB::table('recruit_appoint_select as a')->leftJoin('recruit_appoint_info as b', 'a.appoint_id', '=', 'b.id')->leftJoin('recruit_ticket as c', 'a.appoint_id', '=', 'c.appoint_id')->whereRaw('a.select_result is null and a.batch=5 and a.result is not null')->select(['b.realname', 'c.ex_number', 'a.result', 'a.select_result', 'a.id', 'a.record', 'a.record2', 'a.record3'])->orderBy('record', 'desc')->orderBy('record2', 'desc')->orderBy('record3', 'desc')->limit(2)->get()->toArray();
- $return_data = [
- 'list' => [],
- ];
- $array_column = array_column($quot_batch5, 'name');
- if (count($list) > 1) {
- $current = $list[0];
- $next = $list[1];
- } else {
- $current = $list[0];
- $next = false;
- }
- $person_select_result = json_decode($current->result, true);
- $flag = 0;//是否择岗成功
- foreach ($person_select_result as $val) {
- //寻找下标
- $index = array_search($val, $array_column);
- if ($quot_batch5[$index]['value']) {
- if ($next && $current->record == $next->record && $current->record2 == $next->record2 && $current->record3 == $next->record3 && $quot_batch5[$index]['value'] == 1) {
- //如果当前处理人员不是最后一个,且分数与下一名人员三个维度完全一样的话并且该人员欲择的岗位仅剩一位,则特殊处理
- //查找同样分数人同样志愿
- $next_select_result = json_decode($next->result, true);
- //寻找下标
- $current_index = array_search($val, $person_select_result);
- $next_index = array_search($val, $next_select_result);
- if ($current_index > $next_index) {
- //如果当前人员对当前镇街的意向排序大于下一人,调换两个指针,先排序下一个人
- $current = $next;
- }
- }
- $quota_data = [
- 'index' => $index,
- 'old_value' => $quot_batch5[$index]['value'],
- ];
- //有名额允许择岗
- DB::table('recruit_appoint_select')->where('id', $current->id)->update(['select_result' => $val, 'status' => 1]);
- $current->select_result = $val;
- $quot_batch5[$index]['value']--;
- $quota_data['new_value'] = $quot_batch5[$index]['value'];
- $redis->set('recruit_quota_batch4', json_encode($quot_batch5));
- $flag = 1;
- break;
- }
- }
- if (!$flag) {
- $quota_data = [
- 'index' => $index,
- 'old_value' => $quot_batch5[$index]['value'],
- ];
- $current->select_result = '未匹配到志愿,本轮择岗不成功!';
- DB::table('recruit_appoint_select')->where('id', $current->id)->update(['select_result' => '未匹配到志愿,本轮择岗不成功!', 'status' => -2]);
- }
- $return_data['quota'] = $quota_data;
- return ['status' => 1, 'msg' => '择岗排序成功', 'data' => $return_data];
- }
- public function select_init(Request $request)
- {
- $count = DB::table('recruit_appoint_select')->whereRaw('select_result is null and batch = 5 and type = 1 and result is not null')->count();
- $redis = Cache::getRedis();
- $quot_batch5 = $redis->get('recruit_quota_batch4');
- if (!$quot_batch5) {
- $quot_batch5 = [
- [
- 'name' => '陈埭镇',
- 'value' => 21,
- ],
- [
- 'name' => '金井镇',
- 'value' => 3
- ],
- [
- 'name' => '深沪镇',
- 'value' => 2
- ]
- ];
- $redis->set('recruit_quota_batch5', json_encode($quot_batch5));
- }
- $list = DB::table('recruit_appoint_select as a')->leftJoin('recruit_appoint_info as b', 'a.appoint_id', '=', 'b.id')->leftJoin('recruit_ticket as c', 'a.appoint_id', '=', 'c.appoint_id')->whereRaw('a.select_result is not null and a.batch=5 and type = 1')->select(['b.realname', 'c.ex_number', 'a.result', 'a.select_result', 'a.id'])->orderBy('record', 'desc')->get();
- return ['status' => 1, 'msg' => '获取初始化信息成功', 'data' => ['count' => $count, 'quota' => $quot_batch5, 'list' => $list]];
- }
- 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);
- }
- public function supplement_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']) {
- return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show', ['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', ['id', $recruit['id']]), true, '上一页', '3');
- }
- $supplement_info = DB::table("recruit_supplement_cunwu")->where('uid', $uid)->where('appoint_id', $appoint_info->id)->first();
- if ($supplement_info) {
- return $this->showMessage('您已登记信息,无需再次登记!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
- }
- $uids = [167780,168696,56609,168696,164951,169813,161935,169412,169307,169628,169331,170471,161935,170718,175771,175856,169628,56609,168696,176871,169412,169813,177014,161935,152626,176994,176703,176432,170471,177272,179103,179206,179165,179873,179863,179715,180131,161935,180616,170718,180766,175856,180810,169412,177272,167988,181121,181175,168696,182354,56609,184859,161935,176994,169813,169412,187369,159298,169628,181175,187450,167988,187572,187578,187573,179863,187753,187577,152626,187875,187815,149975,187821,180131,187934,176871,168696,186519,170718,188160,176994,169813,161935,180616,188342,188411,177014,188455,188450,177272,184859,168696,181121,189428,189446,189410,182354,182354,184859,184859,187572,190509,161935,170718,184859,182354,191077,187450,191077,169813,191538,191954,191396,152626,182354,192121,189446,192223,192271,170718,170718,192769,192798,192674,192774,192800,180131,179863,169412,192560,186519,56609,170471,188160,168696,159298,187572,192868,169628,192874,192775,192892,181175,167988,192914,192922,192925,159772,192930,192945,192752,192652,188411,192958,179715,192959,192834,192987,192739,192392,152626,188450,193038,192542,192452,193055,192788,187369,193072,176703,193079,193069,193084,192803,192668,187875,193103,187578,191396,175771,193113,193135,193132,191077,193151,191954,187381,193130,193169,188035,179103,176432,182354,180766,189410,192855,179165,175642,193202,193141,193248,193239,193244,193252,192978,192888,187753,185725,143917,177272,187821,193326,193334,193331,187573,180616,193350,192813,193357,192926,193212,187815,193361,193158,193150,176994,193389,184118,176896,193408,192811,189446,193416,193423,170718,187934,192955,169307,180810,193428,149975,187577,186473,192720,175856,161935,187935,159058,193526,187450,192271,169813,193570,193578,193225,193594,193606,181121,169331,193616,184859,190509,193640,192751,193574,167780,193695,192133,193714,192523,193718,193717,193720,189428,179873,177014,188342,193742,188455,176871,191538,193787,192223,193789,185725,182354,186519,193135];//写死用户
- if (!in_array($uid, $uids)) {
- return $this->showMessage('您无需登记信息!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
- }
- // $limit_time = 1661961599;
- // $time = time();
- // if( $time > $limit_time){
- // return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
- // }
- $view_data = [];
- //$view_data['info'] = json_encode($info);
- $view_data['title'] = $recruit->company;
- $view_data['id'] = $id;
- return view('app.recruit.supplement_info', $view_data);
- }
- public function save_supplement_info(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' => ''];
- }
- $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $id)->first();
- if (!$appoint_info) {
- return ['status' => 0, 'msg' => '抱歉,您没有报名,无需补充信息!', 'data' => ''];
- }
- if ($request->input('marriage') == '已婚') {
- if ($request->input('spouse_card_type') == '' || $request->input('spouse_card') == '' || $request->input('spouse_realname') == '' || $request->input('spouse_mobile') == '') {
- return ['status' => 0, 'msg' => '请完善配偶信息!', 'data' => ''];
- }
- }
- $data = [
- 'uid' => $uid,
- 'appoint_id' => $appoint_info->id,
- 'street' => $request->input('street'),
- 'realname' => $request->input('realname'),
- 'sex' => $request->input('sex'),
- 'house' => $request->input('house'),
- 'nation' => $request->input('nation'),
- 'native' => $request->input('native'),
- 'marriage' => $request->input('marriage'),
- 'spouse_card_type' => $request->input('spouse_card_type'),
- 'spouse_card' => $request->input('spouse_card'),
- 'spouse_realname' => $request->input('spouse_realname'),
- 'spouse_mobile' => $request->input('spouse_mobile'),
- 'political' => $request->input('political'),
- 'bank_card' => $request->input('bank_card'),
- 'bank_open' => $request->input('bank_open'),
- 'card' => $request->input('card'),
- 'card_endtime' => $request->input('card_endtime'),
- 'mobile' => $request->input('mobile'),
- 'edu' => $request->input('education'),
- 'pro' => $request->input('pro'),
- 'address' => $request->input('address'),
- 'funds' => $request->input('funds'),
- ];
- DB::table('recruit_supplement_cunwu')->insert($data);
- return ['status' => 1, 'msg' => '提交成功!', 'data' => ''];
- }
- public function comfirm_pen(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' => ''];
- }
- if (!$recruit->pen_comfirm) {
- return ['status' => 0, 'msg' => '该项目无须确认笔试考试!', 'data' => ''];
- }
- $appoint_info = RecruitAppointInfo::where('recruit_id', $id)->where('uid', $uid)->first();
- if (!$appoint_info) {
- return ['status' => 0, 'msg' => '找不到您的报名记录,请检查!', 'data' => ''];
- }
- if ($appoint_info->audit != 3) {
- return ['status' => 0, 'msg' => '您的报名未审核通过,无需确认!', 'data' => ''];
- }
- $time = time();
- if (strtotime($recruit->pen_comfirm_start) > $time || strtotime($recruit->pen_comfirm_end) < $time) {
- return ['status' => 0, 'msg' => '未在笔试确认时间段!', 'data' => ''];
- }
- if ($appoint_info->pen_audit != -2) {
- return ['status' => 0, 'msg' => '您已确认参加笔试,无需再次确认!', 'data' => ''];
- }
- $appoint_info->update(['pen_audit' => -1]);
- $log = [
- 'type' => 3,
- 'appoint_id' => $appoint_info->id,
- 'uid' => $uid,
- 'log' => '用户确认参加笔试',
- ];
- RecruitAppointLog::create($log);
- return ['status' => 1, 'msg' => '确认成功', 'data' => $appoint_info->id];
- }
- public function supplementary_entry(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' => ''];
- }
- $appoint_info = RecruitAppointInfo::where('recruit_id', $id)->where('uid', $uid)->first();
- if (!$appoint_info) {
- return ['status' => 0, 'msg' => '找不到您的报名记录,请检查!', 'data' => ''];
- }
- $time = time();
- if ($time > 1680969600) {
- return ['status' => 0, 'msg' => '已停止补充报名!', 'data' => ''];
- }
- if ($appoint_info->adjust_limit) {
- $appoint_info->update(['adjust' => 1]);
- return ['status' => 1, 'msg' => '补充报名成功!', 'data' => ''];
- } else {
- return ['status' => 0, 'msg' => '您无需补充报名!', 'data' => ''];
- }
- }
- }
|