IndexController.php 126 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901
  1. <?php
  2. namespace App\Http\Controllers\Web\Recruit;
  3. use App\Http\Controllers\Web\WebBaseController;
  4. use App\Models\RecruitAppointLog;
  5. use App\Models\RecruitTicket;
  6. use App\Validators\RecruitValidatorRequest;
  7. use Illuminate\Http\Request;
  8. use App\Models\Recruit;
  9. use App\Services\Recruit\RecruitService;
  10. use App\Models\RecruitAppointBasic;
  11. use App\Models\RecruitSupplement;
  12. use App\Models\RecruitPost;
  13. use App\Models\RecruitAppointInfo;
  14. use think\Route;
  15. use Illuminate\Support\Facades\Validator;
  16. use Illuminate\Support\Facades\DB;
  17. use App\Models\RecruitAppointExpandSpecial;
  18. use App\Models\RecruitAppointDetail;
  19. use App\Models\RecruitArticle;
  20. use Illuminate\Support\Facades\Cache;
  21. use App\Services\Common\BaiduService;
  22. use App\Models\RecruitAppointSelect;
  23. class IndexController extends WebBaseController
  24. {
  25. protected $recruitService,$baiduService;
  26. public function __construct(RecruitService $recruitService,BaiduService $baiduService)
  27. {
  28. $this->recruitService = $recruitService;
  29. $this->baiduService = $baiduService;
  30. }
  31. /**
  32. * 招考列表页
  33. * @param Request $request
  34. * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
  35. */
  36. public function index(Request $request)
  37. {
  38. $key = $request->input('key');
  39. $list = $this->recruitService->getRecruit($key, 10);
  40. $return_data = [
  41. 'list' => $list,
  42. 'key' => $key,
  43. ];
  44. return view('app.recruit.index', $return_data);
  45. }
  46. /**
  47. * 招考详情页
  48. * @param Request $request
  49. * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View|mixed|\think\response\Redirect|\think\response\View|void
  50. */
  51. public function show(Request $request)
  52. {
  53. $user = $this->getUser();
  54. if($user){
  55. $uid = $user->id;
  56. $utype = $user->utype;
  57. }else{
  58. $uid = 0;
  59. $utype = 0;
  60. }
  61. $id = $request->input('id', 0);
  62. if (empty($id)) {
  63. return $this->showMessage('抱歉,请输入指定的招考场次!', route('recruit.index.list'), true, '上一页', '2');
  64. }
  65. $recruit = Recruit::find($id);
  66. if (empty($recruit)) {
  67. return redirect(route('/recruit/list'));
  68. }
  69. $info = Recruit::parse_info($recruit);
  70. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  71. if($info->isApply && $appoint_info){
  72. $first_post = RecruitAppointLog::where('type',3)->where('uid',$uid)->orderBy('created_at','asc')->first();
  73. if($first_post){
  74. $info->isApply = 1;
  75. }
  76. }
  77. if($appoint_info){
  78. //20221115增加确认笔试功能
  79. if($recruit->pen_comfirm){
  80. if($appoint_info->audit != 3){//审核未通过,无需确认
  81. $appoint_info->pen_comfirm = 0;
  82. }else{
  83. $time = time();
  84. if(strtotime($recruit->pen_comfirm_start) > $time || strtotime($recruit->pen_comfirm_end) < $time){
  85. $appoint_info->pen_comfirm = -1; //确认未开始
  86. }else{
  87. if($appoint_info->pen_audit != -2){
  88. $appoint_info->pen_comfirm = -2;//已确认无需再次确认
  89. }else{
  90. $appoint_info->pen_comfirm = 1;
  91. }
  92. }
  93. }
  94. }else{
  95. $appoint_info->pen_comfirm = 0;//无需确认
  96. }
  97. //笔试
  98. $pen_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',1)->first();
  99. if($pen_ticket){
  100. $pen_health = RecruitSupplement::where("appoint_id",$appoint_info->id)->where("type","pen")->where('h_status',1)->first();
  101. if(!$pen_health && $recruit->pen_epidemic){
  102. $appoint_info->pen_ticket = -2;
  103. }else{
  104. $time = time();
  105. if(strtotime($pen_ticket->ex_start) < $time && strtotime($pen_ticket->ex_end) > $time){
  106. $appoint_info->pen_ticket = 1;
  107. }else{
  108. $appoint_info->pen_ticket = -1;
  109. }
  110. }
  111. }else{
  112. $appoint_info->pen_ticket = 0;
  113. }
  114. //考核测试
  115. $check_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',2)->first();
  116. if($check_ticket){
  117. $time = time();
  118. if(strtotime($check_ticket->ex_start) < $time && strtotime($check_ticket->ex_end) > $time){
  119. $appoint_info->check_ticket = 1;
  120. }else{
  121. $appoint_info->check_ticket = -1;
  122. }
  123. }else{
  124. $appoint_info->check_ticket = 0;
  125. }
  126. //面试
  127. $face_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',3)->first();
  128. if($face_ticket && $appoint_info->face_audit == -1){
  129. $face_health = RecruitSupplement::where("appoint_id",$appoint_info->id)->where("type","face")->where('h_status',1)->first();
  130. if(!$face_health && $recruit->face_epidemic){
  131. $appoint_info->face_ticket = -2;
  132. $time = time();
  133. if(strtotime($recruit->face_health_start) < $time && strtotime($recruit->face_health_end) > $time){
  134. $appoint_info->face_ticket = -2;
  135. }else{
  136. $appoint_info->face_ticket = -3;
  137. }
  138. }else{
  139. $time = time();
  140. if(strtotime($recruit->face_health_start) < $time && strtotime($recruit->face_health_end) > $time){
  141. $appoint_info->face_ticket = 1;
  142. }else{
  143. $appoint_info->face_ticket = -1;
  144. }
  145. }
  146. }else{
  147. $appoint_info->face_ticket = 0;
  148. }
  149. //复试
  150. $reexamine_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',4)->first();
  151. if($reexamine_ticket && $appoint_info->reexamine_audit == -1){
  152. $reexamine_health = RecruitSupplement::where("appoint_id",$appoint_info->id)->where("type","reexamine")->where('h_status',1)->first();
  153. if(!$reexamine_health && $recruit->reexamine_epidemic){
  154. $appoint_info->face_ticket = -2;
  155. $time = time();
  156. if(strtotime($recruit->reexamine_health_start) < $time && strtotime($recruit->reexamine_health_end) > $time){
  157. $appoint_info->reexamine_ticket = -2;
  158. }else{
  159. $appoint_info->reexamine_ticket = -3;
  160. }
  161. }else{
  162. $time = time();
  163. if(strtotime($recruit->reexamine_health_start) < $time && strtotime($recruit->reexamine_health_end) > $time){
  164. $appoint_info->reexamine_ticket = 1;
  165. }else{
  166. $appoint_info->reexamine_ticket = -1;
  167. }
  168. }
  169. }else{
  170. $appoint_info->reexamine_ticket = 0;
  171. }
  172. }else{
  173. $appoint_info = new \stdClass();
  174. $appoint_info->pen_comfirm = 0;
  175. $appoint_info->pen_audit = 0;
  176. $appoint_info->post_id = 0;
  177. $appoint_info->pen_ticket = 0;
  178. $appoint_info->computer_ticket = 0;
  179. $appoint_info->face_ticket = 0;
  180. $appoint_info->check_ticket = 0;
  181. $appoint_info->reexamine_ticket = 0;
  182. $appoint_info->realname = '';
  183. $appoint_info->card = '';
  184. $appoint_info->mobile = '';
  185. $appoint_info->sex = 0;
  186. $appoint_info->adjust = 0;
  187. $appoint_info->adjust_limit = 0;
  188. }
  189. $notice = $request->input('notice',0);
  190. if($notice){
  191. $public_notice_switch = 0;
  192. $public_notice = RecruitArticle::where('id',$notice)->where('released_at','<',time())->first();
  193. if (!empty($info)) {
  194. $view_data = [
  195. 'recruit' => $recruit,
  196. 'info' => $info,
  197. 'uid' => $uid,
  198. 'utype' => $utype,
  199. 'public_notice' => $public_notice,
  200. 'public_notice_switch' => $public_notice_switch,
  201. 'appoint_info' => $appoint_info
  202. ];
  203. return view('app.recruit.show')->with($view_data);
  204. } else {
  205. return back();
  206. }
  207. }else{
  208. $list = RecruitArticle::where('recruit_id',$id)->where('is_display',1)->orderBy('created_at','desc')->where('released_at','<',time())->get();
  209. $public_notice_switch = 1;//有补充公告的模式
  210. if (!empty($info)) {
  211. $view_data = [
  212. 'recruit' => $recruit,
  213. 'info' => $info,
  214. 'uid' => $uid,
  215. 'utype' => $utype,
  216. 'list' => $list,
  217. 'public_notice_switch' => $public_notice_switch,
  218. 'appoint_info' => $appoint_info
  219. ];
  220. return view('app.recruit.show')->with($view_data);
  221. } else {
  222. return back();
  223. }
  224. }
  225. }
  226. /**
  227. * 上传文件的方法
  228. * @param Request $request
  229. * @return \Illuminate\Http\JsonResponse
  230. */
  231. public function upload(Request $request)
  232. {
  233. $user = $this->getUser();
  234. if($user){
  235. $uid = $user->id;
  236. $utype = $user->utype;
  237. }else{
  238. $uid = 0;
  239. $utype = 0;
  240. }
  241. $file = $request->file('file');
  242. if ($file->isValid()) { //判断文件是否存在
  243. //获取文件的扩展名
  244. $ext = $file->getClientOriginalExtension();
  245. if (!in_array(strtolower($ext), ['jpg', 'jpeg', 'png', 'doc', 'docx', 'pdf'])) {
  246. $res['status'] = 0;
  247. $res['msg'] = '文件格式不正确';
  248. } else {
  249. //获取文件的绝对路径
  250. $path = $file->getRealPath();
  251. $oldname = $file->getClientOriginalName();
  252. //定义文件名
  253. $filename = 'storage/recruit/' . uniqid() . mt_rand(10000, 99999) . '.' . $ext;
  254. //存储文件。disk里面的public。总的来说,就是调用disk模块里的public配置
  255. Storage::disk('public')->put($filename, file_get_contents($path));
  256. $res['status'] = 1;
  257. $res['filename'] = $oldname;
  258. $res['path'] = "/storage/" . $filename;
  259. $res['msg'] = '上传成功';
  260. }
  261. } else {
  262. $res['status'] = 0;
  263. $res['msg'] = '上传失败';
  264. }
  265. return response()->json($res);
  266. }
  267. /**
  268. * 查看报名人数统计
  269. * @param Request $request
  270. * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View|mixed|\think\response\Redirect|\think\response\View|void
  271. */
  272. public function sign_up_count(Request $request)
  273. {
  274. $user = $this->getUser();
  275. if($user){
  276. $uid = $user->id;
  277. $utype = $user->utype;
  278. }else{
  279. $uid = 0;
  280. $utype = 0;
  281. }
  282. $id = $request->input('id', 0);
  283. $refresh = $request->input('refresh', '');
  284. if (empty($id)) {
  285. return $this->showMessage('抱歉,请输入指定的招考场次!', route('recruit.index.list'), true, '上一页', '2');
  286. }
  287. $recruit = Recruit::find($id);
  288. if (empty($recruit)) {
  289. return redirect(route('/recruit/list'));
  290. }
  291. if(!$recruit->show_report){
  292. return $this->showMessage('抱歉,该场次不允许查看报名人数统计结果!', route('recruit.index.list'), true, '上一页', '2');
  293. }
  294. if(Cache::has("sign_up_count_{$recruit->id}") && $refresh != 'jjhc2019') {
  295. $cache_data = Cache::get("sign_up_count_{$recruit->id}");
  296. $list = $cache_data['list'];
  297. $time = $cache_data['time'];
  298. }else{
  299. $list = RecruitPost::where('recruit_id',$recruit->id)->where('status',1)->get();
  300. if(!$list){
  301. return $this->showMessage('抱歉,数据暂时未更新或更新出错!', route('recruit.index.list'), true, '上一页', '2');
  302. }
  303. foreach ($list as $k => $v){
  304. $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();
  305. $list[$k]['checking'] = $res->checking;
  306. $list[$k]['fail'] = $res->fail;
  307. $list[$k]['success'] = $res->success;
  308. }
  309. $time = date('Y-m-d H:i',time());
  310. $cache_data = [
  311. 'list' => $list,
  312. 'time' => $time
  313. ];
  314. Cache::put("sign_up_count_{$recruit->id}",$cache_data,60);
  315. }
  316. $view_data = [
  317. 'list' => $list,
  318. 'time' => $time,
  319. 'title' => $recruit->company
  320. ];
  321. return view('app.recruit.sign_up_count')->with($view_data);
  322. }
  323. /**
  324. * 报名功能页
  325. * @param Request $request
  326. * @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
  327. */
  328. public function sign_up(Request $request)
  329. {
  330. $user = $this->getUser();
  331. if (!empty($user)) {
  332. $uid = $user->id;
  333. } else {
  334. return redirect(route('login'));
  335. }
  336. //招考id
  337. $id = $request->input('id', 0);
  338. if (!$id) {
  339. return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
  340. }
  341. //招考信息
  342. $recruit = Recruit::find($id);
  343. if(!$recruit['status'] && !$user->recruit_test){
  344. return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  345. }
  346. if($recruit['current'] != 1 && $recruit['current'] != 2){
  347. return $this->showMessage('抱歉,该项目报名通道已关闭,如有疑问,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  348. }
  349. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  350. $time = time();
  351. $formDisabled = 0;
  352. if(($time < strtotime($recruit['apply_start']) || strtotime($recruit['apply_end']) < $time)){//过了招考时间
  353. if(!in_array($uid,[161027,59041])){
  354. if(!$appoint_info){
  355. return $this->showMessage('抱歉,该项目已过报名时间或尚未开始!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  356. }
  357. if($appoint_info){
  358. //如果有报名记录,先查询首次报名是什么时候
  359. $first_post = RecruitAppointLog::where('type',3)->where('uid',$uid)->where('appoint_id',$appoint_info->id)->orderBy('created_at','asc')->first();
  360. if(!$first_post){//没有记录代表只是暂存
  361. return $this->showMessage('抱歉,该项目已过报名时间或尚未开始!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  362. }
  363. // $has_late_post = RecruitAppointLog::where('type',3)->where('uid',$uid)->where('created_at','>',$recruit['apply_end'])->first();//查找在过了报名时间后,有报名记录,且仍是审核失败的报名记录,看其是否在报名时间后是否有再次提交的记录
  364. // if($has_late_post){
  365. // $formDisabled = 1;
  366. // }else{
  367. // $formDisabled = 0;
  368. // }
  369. }
  370. }
  371. }
  372. $view_data['module'] = $forms = explode(',', $recruit['forms']);
  373. //查询报名表是否已有记录
  374. if($appoint_info){
  375. if(in_array('internship',$forms)) {
  376. //如果已有该场次的报名记录,读取录入的数据集合
  377. $user_info = $appoint_info;
  378. $user_info['sex'] = (string)$user_info['sex'];
  379. $user_info['adjust'] = (string)$user_info['adjust'];
  380. $user_info['edu_type'] = (string)$user_info['edu_type'];
  381. $user_info['family'] = json_decode($user_info['family']);
  382. $detail = RecruitAppointDetail::where('recruit_appoint_id',$user_info['id'])->first();
  383. if($detail){
  384. $user_info['detail'] = $detail->toArray();
  385. }else{
  386. $user_info['detail'] = [
  387. 'rewards_and_punishments' => '',
  388. 'introduce' => ''
  389. ];
  390. }
  391. if(json_decode($user_info['identification'])){
  392. $identification = json_decode($user_info['identification'],true);
  393. foreach ($identification as $k => $v){
  394. if(array_key_exists('response',$v)){
  395. $identification[$k]['url'] = $v['response']['path'];
  396. }
  397. }
  398. }else{
  399. $identification = [];
  400. }
  401. $user_info['identification'] = $identification;
  402. if(json_decode($user_info['education_certification'])){
  403. $education_certification = json_decode($user_info['education_certification'],true);
  404. foreach ($education_certification as $k => $v){
  405. if(array_key_exists('response',$v)){
  406. $education_certification[$k]['url'] = $v['response']['path'];
  407. }
  408. }
  409. }else{
  410. $education_certification = [];
  411. }
  412. $user_info['education_certification'] = $education_certification;
  413. if(json_decode($user_info['other_certification'])){
  414. $other_certification = json_decode($user_info['other_certification'],true);
  415. foreach ($other_certification as $k => $v){
  416. if(array_key_exists('response',$v)){
  417. $other_certification[$k]['url'] = $v['response']['path'];
  418. }
  419. }
  420. }else{
  421. $other_certification = [];
  422. }
  423. $user_info['other_certification'] = $other_certification;
  424. if(json_decode($user_info['chengnuoshu'])){
  425. $chengnuoshu = json_decode($user_info['chengnuoshu'],true);
  426. foreach ($chengnuoshu as $k => $v){
  427. if(array_key_exists('response',$v)){
  428. $chengnuoshu[$k]['url'] = $v['response']['path'];
  429. }
  430. }
  431. }else{
  432. $chengnuoshu = [];
  433. }
  434. $user_info['chengnuoshu'] = $chengnuoshu;
  435. if(json_decode($user_info['shixin'])){
  436. $shixin = json_decode($user_info['shixin'],true);
  437. foreach ($shixin as $k => $v){
  438. if(array_key_exists('response',$v)){
  439. $shixin[$k]['url'] = $v['response']['path'];
  440. }
  441. }
  442. }else{
  443. $shixin = [];
  444. }
  445. $user_info['shixin'] = $shixin;
  446. if(json_decode($user_info['baokaoshengming'])){
  447. $baokaoshengming = json_decode($user_info['baokaoshengming'],true);
  448. foreach ($baokaoshengming as $k => $v){
  449. if(array_key_exists('response',$v)){
  450. $baokaoshengming[$k]['url'] = $v['response']['path'];
  451. }
  452. }
  453. }else{
  454. $baokaoshengming = [];
  455. }
  456. $user_info['baokaoshengming'] = $baokaoshengming;
  457. //获取最新的报名审核信息
  458. $logs = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',2)->orderBy('created_at','desc')->first();
  459. if($logs){
  460. $user_info['audit_log'] = $logs->log;
  461. }else{
  462. $user_info['audit_log'] = '';
  463. }
  464. }else{
  465. //如果已有该场次的报名记录,读取录入的数据集合
  466. $user_info = $appoint_info;
  467. $user_info['sex'] = (string)$user_info['sex'];
  468. $user_info['edu_type'] = (string)$user_info['edu_type'];
  469. $user_info['family'] = json_decode($user_info['family']);
  470. if(in_array('expand_special',$forms)){
  471. $special = RecruitAppointExpandSpecial::where('recruit_appoint_id',$user_info['id'])->first();
  472. if($special){
  473. $material = json_decode($special['material'],true);
  474. if(is_array($material)){
  475. foreach ($material as $k => $v){
  476. if(array_key_exists('response',$v)){
  477. if(array_key_exists('path',$v['response'])){
  478. $material[$k]['url'] = $v['response']['path'];
  479. }
  480. }
  481. }
  482. }
  483. }else{
  484. $material = [];
  485. $special = [
  486. 'point_apply' => '0',
  487. 'condition' => ''
  488. ];
  489. }
  490. $user_info['special'] = [
  491. 'point_apply' => (string)$special['point_apply'],
  492. 'condition' => $special['condition'],
  493. 'material' => $material
  494. ];
  495. }
  496. if(in_array('detail',$forms)){
  497. $detail = RecruitAppointDetail::where('recruit_appoint_id',$user_info['id'])->first();
  498. if($detail){
  499. $user_info['detail'] = $detail->toArray();
  500. }else{
  501. $user_info['detail'] = [
  502. 'train' => '',
  503. 'rewards_and_punishments' => '',
  504. 'introduce' => ''
  505. ];
  506. }
  507. }
  508. //如果有身份证明模块
  509. if(in_array('identification',$forms)){
  510. if(json_decode($user_info['identification'])){
  511. $identification = json_decode($user_info['identification'],true);
  512. foreach ($identification as $k => $v){
  513. if(array_key_exists('response',$v)){
  514. if(array_key_exists('path',$v['response'])){
  515. $identification[$k]['url'] = $v['response']['path'];
  516. }
  517. }
  518. }
  519. }else{
  520. $identification = [];
  521. }
  522. $user_info['identification'] = $identification;
  523. }
  524. //如果有教育证明模块
  525. if(in_array('education_certification',$forms)){
  526. if(json_decode($user_info['education_certification'])){
  527. $education_certification = json_decode($user_info['education_certification'],true);
  528. foreach ($education_certification as $k => $v){
  529. if(array_key_exists('response',$v)){
  530. if(array_key_exists('path',$v['response'])){
  531. $education_certification[$k]['url'] = $v['response']['path'];
  532. }
  533. }
  534. }
  535. }else{
  536. $education_certification = [];
  537. }
  538. $user_info['education_certification'] = $education_certification;
  539. }
  540. //如果有其他证明模块
  541. if(in_array('other_certification',$forms)){
  542. if(json_decode($user_info['other_certification'])){
  543. $other_certification = json_decode($user_info['other_certification'],true);
  544. foreach ($other_certification as $k => $v){
  545. if(array_key_exists('response',$v)){
  546. if(array_key_exists('path',$v['response'])){
  547. $other_certification[$k]['url'] = $v['response']['path'];
  548. }
  549. }
  550. }
  551. }else{
  552. $other_certification = [];
  553. }
  554. $user_info['other_certification'] = $other_certification;
  555. }
  556. //如果有承诺书模块
  557. if(in_array('chengnuoshu',$forms)){
  558. if(json_decode($user_info['chengnuoshu'])){
  559. $chengnuoshu = json_decode($user_info['chengnuoshu'],true);
  560. foreach ($chengnuoshu as $k => $v){
  561. if(array_key_exists('response',$v)){
  562. if(array_key_exists('path',$v['response'])){
  563. $chengnuoshu[$k]['url'] = $v['response']['path'];
  564. }
  565. }
  566. }
  567. }else{
  568. $chengnuoshu = [];
  569. }
  570. $user_info['chengnuoshu'] = $chengnuoshu;
  571. }
  572. //如果有失信被执行人模块
  573. if(in_array('shixin',$forms)){
  574. if(json_decode($user_info['shixin'])){
  575. $shixin = json_decode($user_info['shixin'],true);
  576. foreach ($shixin as $k => $v){
  577. if(array_key_exists('response',$v)){
  578. if(array_key_exists('path',$v['response'])){
  579. $shixin[$k]['url'] = $v['response']['path'];
  580. }
  581. }
  582. }
  583. }else{
  584. $shixin = [];
  585. }
  586. $user_info['shixin'] = $shixin;
  587. }
  588. //如果有声明书模块
  589. if(in_array('baokaoshengming',$forms)){
  590. if(json_decode($user_info['baokaoshengming'])){
  591. $baokaoshengming = json_decode($user_info['baokaoshengming'],true);
  592. foreach ($baokaoshengming as $k => $v){
  593. if(array_key_exists('response',$v)){
  594. if(array_key_exists('path',$v['response'])){
  595. $baokaoshengming[$k]['url'] = $v['response']['path'];
  596. }
  597. }
  598. }
  599. }else{
  600. $baokaoshengming = [];
  601. }
  602. $user_info['baokaoshengming'] = $baokaoshengming;
  603. }
  604. //获取最新的报名审核信息
  605. $logs = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',2)->orderBy('created_at','desc')->first();
  606. if($logs){
  607. $user_info['audit_log'] = $logs->log;
  608. }else{
  609. $user_info['audit_log'] = '';
  610. }
  611. //获取提交报名的次数
  612. // $number = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',3)->count();
  613. // $post_number = $number+1;//todo
  614. }
  615. }
  616. else{
  617. //实习专场
  618. if(in_array('internship',$forms)){
  619. $user_info = json_encode([
  620. 'recruit_id' => $id,
  621. 'operation' => 1,
  622. 'realname' => '',
  623. 'sex' => '1',
  624. 'birthday' => '',
  625. 'card' => '',
  626. 'nation' => '',
  627. 'native_place' => '',
  628. 'political_affiliation' => '',
  629. 'join_time' => '',
  630. 'house_register' => '',
  631. 'education' => '',
  632. 'school' => '',
  633. 'pro' => '',
  634. 'adjust' => '',
  635. 'mobile' => '',
  636. 'email' => '',
  637. 'address' => '',
  638. 'post_id' => '',
  639. 'concat_name' => '',
  640. 'concat_mobile' => '',
  641. 'resume' => '',
  642. 'avatar' => '',
  643. 'family' => [
  644. [
  645. 'relation' => '',
  646. 'realname' => '',
  647. 'birthday' => '',
  648. 'political_affiliation' => '',
  649. 'work' => ''
  650. ]
  651. ],
  652. 'detail' => [
  653. 'rewards_and_punishments' => '',
  654. 'introduce' => ''
  655. ],
  656. 'identification' => [],
  657. 'education_certification' => [],
  658. 'other_certification' => [],
  659. 'chengnuoshu' => [],
  660. 'baokaoshengming' => [],
  661. 'shixin' => []
  662. ]);
  663. }else{
  664. //如果没有,结合基础数据及模块表单信息,制作数据对象
  665. $user_info = RecruitAppointBasic::where('uid',$uid)->first();
  666. if(!$user_info){
  667. //没有基础信息跳转完善route('person.recruitInfo')
  668. return $this->showMessage('请先完善招考基础信息!', route('recruit.recruitInfo',array('recruit_id',$id)), true, '上一页', '3');
  669. }
  670. $user_info['sex'] = (string)$user_info['sex'];
  671. $user_info['edu_type'] = (string)$user_info['edu_type'];
  672. $user_info['family'] = json_decode($user_info['family']);
  673. if(in_array('expand_special',$forms)){
  674. $user_info['special'] = [
  675. 'point_apply' => '0',
  676. 'condition' => '',
  677. 'material' => []
  678. ];
  679. }
  680. if(in_array('detail',$forms)){
  681. $user_info['detail'] = [
  682. 'train' => '',
  683. 'rewards_and_punishments' => '',
  684. 'introduce' => ''
  685. ];
  686. }
  687. if(in_array('identification',$forms)){
  688. $user_info['identification'] = [];
  689. }
  690. if(in_array('education_certification',$forms)){
  691. $user_info['education_certification'] = [];
  692. }
  693. if(in_array('other_certification',$forms)){
  694. $user_info['other_certification'] = [];
  695. }
  696. if(in_array('chengnuoshu',$forms)){
  697. $user_info['chengnuoshu'] = [];
  698. }
  699. if(in_array('shixin',$forms)){
  700. $user_info['shixin'] = [];
  701. }
  702. if(in_array('baokaoshengming',$forms)){
  703. $user_info['baokaoshengming'] = [];
  704. }
  705. $user_info['recruit_id'] = $id;
  706. $user_info['operation'] = 1;
  707. }
  708. }
  709. //招考岗位
  710. $where_post[] = ['recruit_id', '=', $id];
  711. $where_post[] = ['status', '=', 1];
  712. $recruit_post = RecruitPost::where($where_post)->get();
  713. $post = [];
  714. $post_limit = [];
  715. $post_special = [];
  716. foreach ($recruit_post as $value){
  717. $item = [
  718. 'value' => $value['id'],
  719. 'label' => $value['code'] . " " . $value['name']
  720. ];
  721. $post_limit[$value['id']] = json_decode($value['limit']);
  722. $post_special[$value['id']] = explode(',',$value['special']);
  723. array_push($post,$item);
  724. }
  725. $view_data['appoint_info'] = $user_info;
  726. $view_data['post'] = json_encode($post);
  727. // $view_data['post_number'] = $post_number;
  728. // $view_data['post_times'] = $recruit['post_times'];
  729. $view_data['post_limit'] = json_encode($post_limit);
  730. $view_data['post_special'] = json_encode($post_special);
  731. $view_data['formDisable'] = $formDisabled;
  732. $view_data['title'] = $recruit->company;
  733. $view_data['special_condition_type'] = $recruit->special_condition_type;
  734. $view_data['special_condition_value'] = explode(',',$recruit->special_condition_value);
  735. return view('app.recruit.sign_up',$view_data);
  736. }
  737. public function preview(Request $request)
  738. {
  739. $modules = $request->input('modules');
  740. $view_data['module'] = $forms = explode(',', $modules);
  741. return view('app.recruit.preview',$view_data);
  742. }
  743. /**
  744. * 提交报名的处理程序
  745. * @param Request $request
  746. * @return array|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\think\response\Redirect|void
  747. */
  748. public function saveSignUp(Request $request)
  749. {
  750. $user = $this->getUser();
  751. if (!empty($user)) {
  752. $uid = $user->id;
  753. } else {
  754. return redirect(route('login'));
  755. }
  756. $recruit_id = $request->input('recruit_id', 0);
  757. if (!$recruit_id) {
  758. return response()->json(['status' => 0,'msg' => '请选择项目!']);
  759. }
  760. $recruit = Recruit::find($recruit_id);
  761. if(!$recruit['status']){
  762. return response()->json(['status' => 0,'msg' => '抱歉,该项目状态不正确,请联系客服!']);
  763. }
  764. if($recruit['current'] != 1 && $recruit['current'] != 2){
  765. return response()->json(['status' => 0,'msg' => '抱歉,该项目报名通道已关闭,如有疑问,请联系客服!']);
  766. }
  767. $card = $request->input('card');
  768. $appointinfo_exist = RecruitAppointInfo::where('card',$card)->where('uid','<>',$uid)->where('recruit_id',$recruit_id)->first();
  769. //兆丰建设两场公告二而一例外
  770. if($recruit_id == 25 || $recruit_id == 26){
  771. $special = RecruitAppointInfo::where('card',$card)->where('uid','<>',$uid)->whereIn('recruit_id',[25,26])->first();
  772. $appointinfo_exist = $appointinfo_exist & $special;
  773. }
  774. if($appointinfo_exist){
  775. return response()->json(['status' => 0,'msg' => '您的证件已有其他账号的报名记录,请检查!']);
  776. }
  777. $time = time();
  778. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  779. if(($time < strtotime($recruit['apply_start']) || strtotime($recruit['apply_end']) < $time)){//过了招考时间
  780. if(!$appoint_info){
  781. return response()->json(['status' => 0,'msg' => '抱歉,该项目已过报名时间!']);
  782. }
  783. if(($time < strtotime($recruit['audit_start']) || strtotime($recruit['audit_end']) < $time)){//过了审核时间
  784. return response()->json(['status' => 0,'msg' => '抱歉,该项目已过审核时间,无法继续报名!']);
  785. }
  786. //如果有报名记录,先查询首次报名是什么时候
  787. $first_post = RecruitAppointLog::where('type',3)->where('uid',$uid)->orderBy('created_at','asc')->first();
  788. if(!$first_post){//没有记录代表只是暂存
  789. return response()->json(['status' => 0,'msg' => '抱歉,该项目已过报名时间!']);
  790. }
  791. }
  792. $data = $request->only('realname','sex','birthday','avatar','nation','native_place','political_affiliation','titles','join_time','work','house_register','education','school','degree','pro','address','card','mobile','email','concat_name','concat_mobile','resume','post_id','adjust','remark','graduation');
  793. if(!array_key_exists('post_id',$data)){
  794. return response()->json(['status' => 0,'msg' => '请选择报考岗位']);
  795. }
  796. $post_info = RecruitPost::where('id',$data['post_id'])->where('recruit_id',$recruit_id)->first();
  797. if(!$post_info['status'] || $post_info['deleted_at'] != null){
  798. return response()->json(['status' => 0,'msg' => '该岗位已失效']);
  799. }
  800. //获取操作符,是暂存还是提交
  801. $operation = $request->input('operation');
  802. if($operation == 1){
  803. $data['audit'] = 0;//暂存
  804. }else{
  805. //基础信息的检查
  806. $rules = [
  807. 'realname' => 'required',
  808. 'sex' => 'required',
  809. 'birthday' => 'required',
  810. 'avatar' => 'required',
  811. 'nation' => 'required',
  812. 'native_place' => 'required',
  813. 'political_affiliation' => 'required',
  814. 'post_id' => 'required',
  815. 'house_register' => 'required',
  816. //'edu_type' => 'required',
  817. 'education' => 'required',
  818. 'school' => 'required',
  819. 'graduation' => 'required',
  820. 'address' => 'required',
  821. 'mobile' => 'required',
  822. 'email' => 'required',
  823. 'card' => 'required',
  824. 'concat_name' => 'required',
  825. 'concat_mobile' => 'required',
  826. 'resume' => 'required'
  827. ];
  828. $messages = [
  829. 'realname.required' => '请填写姓名',
  830. 'sex.required' => '请填写性别',
  831. 'birthday.required' => '请填写出生日期',
  832. 'avatar.required' => '请上传彩色免冠照',
  833. 'nation.required' => '请填写民族',
  834. 'native_place.required' => '请填写籍贯',
  835. 'political_affiliation.required' => '请选择政治面貌',
  836. 'post_id.required' => '请选择报名岗位',
  837. 'house_register.required' => '请填写户籍所在地',
  838. //'edu_type.required' => '请选择教育类型',
  839. 'education.required' => '请输入学历',
  840. 'school.required' => '请输入毕业院校',
  841. 'graduation.required' => '请填写毕业时间',
  842. 'address.required' => '请填写通信地址',
  843. 'mobile.required' => '请填写手机号码',
  844. 'email.required' => '请填写电子邮箱',
  845. 'card.required' => '请填写身份证号码',
  846. 'resume.required' => '请填写个人简历',
  847. 'concat_name.required' => '请填写联系人姓名',
  848. 'concat_mobile.required' => '请填写联系人手机号码'
  849. ];
  850. $create_data = $request->all();
  851. $validator = Validator::make($create_data,$rules,$messages);
  852. if ($validator->fails()) {
  853. $msg = $validator->errors()->all();
  854. return response()->json(['status' => 0,'msg' => $msg[0]]);
  855. }
  856. $data['audit'] = 1;//提交
  857. }
  858. if(strlen($data['card']) == 18){
  859. //身份证判断出生日期和性别
  860. $year = substr($data['card'],6,4);
  861. $month = substr($data['card'],10,2);
  862. $day = substr($data['card'],12,2);
  863. if($year.'-'.$month.'-'.$day != $data['birthday']){
  864. $data['birthday'] = $year.'-'.$month.'-'.$day;
  865. }
  866. if(intval(substr($data['card'],16,1)) % 2 == 0){
  867. $data['sex'] = 0;
  868. }else{
  869. $data['sex'] = 1;
  870. }
  871. }
  872. if(!empty($post_info['limit']) && json_decode($post_info['limit'])){
  873. //岗位限制条件的判断
  874. $post_limit = json_decode($post_info['limit'],true);
  875. if(is_array($post_limit)){
  876. foreach($post_limit as $k => $v){
  877. if($k == 'birthday'){
  878. $value = str_replace('-','',$data[$k]);
  879. }else{
  880. $value = $data[$k];
  881. }
  882. switch ($v['op']){
  883. case '=':
  884. if($value != $v['value']){
  885. return response()->json(['status' => 0,'msg' => $v['msg']]);
  886. }
  887. break;
  888. case '>':
  889. if($value <= $v['value']){
  890. return response()->json(['status' => 0,'msg' => $v['msg']]);
  891. }
  892. break;
  893. case '>=':
  894. if($value < $v['value']){
  895. return response()->json(['status' => 0,'msg' => $v['msg']]);
  896. }
  897. break;
  898. case '<':
  899. if($value >= $v['value']){
  900. return response()->json(['status' => 0,'msg' => $v['msg']]);
  901. }
  902. break;
  903. case '<=':
  904. if($value > $v['value']){
  905. return response()->json(['status' => 0,'msg' => $v['msg']]);
  906. }
  907. break;
  908. case '!=':
  909. if($value == $v['value']){
  910. return response()->json(['status' => 0,'msg' => $v['msg']]);
  911. }
  912. break;
  913. case 'like':
  914. if(strpos($value,$v['value']) === false){
  915. return response()->json(['status' => 0,'msg' => $v['msg']]);
  916. }
  917. break;
  918. case 'in':
  919. if(strpos($v['value'],$value) === false){
  920. return response()->json(['status' => 0,'msg' => $v['msg']]);
  921. }
  922. break;
  923. }
  924. }
  925. }
  926. }
  927. //前置审核 判断完成,先将数据入报名信息基础表
  928. //解析家庭成员数据
  929. $familys = $request->input('family');
  930. $family = [];
  931. if(is_array($familys)){
  932. foreach ($familys as $value){
  933. $item = [
  934. 'relation' => $value['relation'],
  935. 'realname' => $value['realname'],
  936. 'birthday' => $value['birthday'],
  937. 'political_affiliation' => $value['political_affiliation'],
  938. 'work' => $value['work']
  939. ];
  940. array_push($family,$item);
  941. }
  942. }
  943. $forms = explode(',', $recruit['forms']);
  944. if(in_array('expand_special',$forms)){
  945. $special = $request->input('special');
  946. if($special['point_apply'] && $special['condition'] == ''){
  947. return response()->json(['status' => 0,'msg' => '加分条件不能为空']);
  948. }
  949. }
  950. $data['family'] = json_encode($family);
  951. if($appoint_info){
  952. //如果已有报名记录,进入修改阶段的处理流程
  953. DB::beginTransaction();
  954. try{
  955. RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->update($data);
  956. //分模块解析数据
  957. //如果有加分模块
  958. if(in_array('expand_special',$forms)){
  959. $special = $request->input('special');
  960. if($special['point_apply']){
  961. //删除掉没有成功返回路径的图片
  962. if(is_array($special['material'])){
  963. foreach ($special['material'] as $k => $v){
  964. if(!array_key_exists('response',$v)){
  965. unset($special['material'][$k]);
  966. }
  967. }
  968. }
  969. $special['material'] = json_encode($special['material']);
  970. }else{
  971. $special['condition'] = '';
  972. $special['material'] = json_encode([]);
  973. }
  974. $hasRecord = RecruitAppointExpandSpecial::where('recruit_appoint_id',$appoint_info->id)->first();
  975. if($hasRecord){
  976. RecruitAppointExpandSpecial::where('recruit_appoint_id',$appoint_info->id)->update($special);
  977. }else{
  978. $special['recruit_appoint_id'] = $appoint_info->id;
  979. RecruitAppointExpandSpecial::create($special);
  980. }
  981. }
  982. //如果有详情模块
  983. if(in_array('detail',$forms) || in_array('internship',$forms)){
  984. $detail = $request->input('detail');
  985. $hasRecord = RecruitAppointDetail::where('recruit_appoint_id',$appoint_info->id)->first();
  986. if($hasRecord){
  987. RecruitAppointDetail::where('recruit_appoint_id',$appoint_info->id)->update($detail);
  988. }else{
  989. $detail['recruit_appoint_id'] = $appoint_info->id;
  990. RecruitAppointDetail::create($detail);
  991. }
  992. }
  993. //如果有身份证明模块
  994. if(in_array('identification',$forms) || in_array('internship',$forms)){
  995. $identification = $request->input('identification');
  996. if(is_array($identification)){
  997. //删除掉没有成功返回路径的图片
  998. foreach ($identification as $k => $v){
  999. if(!array_key_exists('response',$v)){
  1000. unset($identification[$k]);
  1001. }
  1002. }
  1003. }
  1004. $appoint_info->identification = json_encode($identification);
  1005. $appoint_info->save();
  1006. }
  1007. //如果有教育证明模块
  1008. if(in_array('education_certification',$forms) || in_array('internship',$forms)){
  1009. $education_certification = $request->input('education_certification');
  1010. if(is_array($education_certification)){
  1011. //删除掉没有成功返回路径的图片
  1012. foreach ($education_certification as $k => $v){
  1013. if(!array_key_exists('response',$v)){
  1014. unset($education_certification[$k]);
  1015. }
  1016. }
  1017. }
  1018. $appoint_info->education_certification = json_encode($education_certification);
  1019. $appoint_info->save();
  1020. }
  1021. //如果有其他证明模块
  1022. if(in_array('other_certification',$forms) || in_array('internship',$forms)){
  1023. $other_certification = $request->input('other_certification');
  1024. if(is_array($other_certification)){
  1025. //删除掉没有成功返回路径的图片
  1026. foreach ($other_certification as $k => $v){
  1027. if(!array_key_exists('response',$v)){
  1028. unset($other_certification[$k]);
  1029. }
  1030. }
  1031. }
  1032. if($other_certification){
  1033. $appoint_info->other_certification = json_encode($other_certification);
  1034. $appoint_info->save();
  1035. }
  1036. }
  1037. //如果有承诺书模块
  1038. if(in_array('chengnuoshu',$forms)){
  1039. $chengnuoshu = $request->input('chengnuoshu');
  1040. if(is_array($chengnuoshu)){
  1041. //删除掉没有成功返回路径的图片
  1042. foreach ($chengnuoshu as $k => $v){
  1043. if(!array_key_exists('response',$v)){
  1044. unset($chengnuoshu[$k]);
  1045. }
  1046. }
  1047. }
  1048. if($chengnuoshu){
  1049. $appoint_info->chengnuoshu = json_encode($chengnuoshu);
  1050. $appoint_info->save();
  1051. }
  1052. }
  1053. //如果有失信被执行人模块
  1054. if(in_array('shixin',$forms)){
  1055. $shixin = $request->input('shixin');
  1056. if(is_array($shixin)){
  1057. //删除掉没有成功返回路径的图片
  1058. foreach ($shixin as $k => $v){
  1059. if(!array_key_exists('response',$v)){
  1060. unset($shixin[$k]);
  1061. }
  1062. }
  1063. }
  1064. if($shixin){
  1065. $appoint_info->shixin = json_encode($shixin);
  1066. $appoint_info->save();
  1067. }
  1068. }
  1069. //如果有声明书模块
  1070. if(in_array('baokaoshengming',$forms)){
  1071. $baokaoshengming = $request->input('baokaoshengming');
  1072. if(is_array($baokaoshengming)){
  1073. //删除掉没有成功返回路径的图片
  1074. foreach ($baokaoshengming as $k => $v){
  1075. if(!array_key_exists('response',$v)){
  1076. unset($baokaoshengming[$k]);
  1077. }
  1078. }
  1079. }
  1080. if($baokaoshengming){
  1081. $appoint_info->baokaoshengming = json_encode($baokaoshengming);
  1082. $appoint_info->save();
  1083. }
  1084. }
  1085. DB::commit();
  1086. if($operation == 2){
  1087. $log = [
  1088. 'type' => 3,
  1089. 'appoint_id'=> $appoint_info->id,
  1090. 'uid' => $uid,
  1091. 'log' => '用户提交报名'
  1092. ];
  1093. RecruitAppointLog::create($log);
  1094. return ['status' => 1, 'msg' => '提交成功', 'data' => $appoint_info->id];
  1095. }else{
  1096. return ['status' => 1, 'msg' => '资料保存成功,请尽快完善并提交', 'data' => $appoint_info->id];
  1097. }
  1098. } catch (\Exception $e){
  1099. DB::rollback();
  1100. return ['status' => 0, 'msg' => $e->getMessage()];
  1101. }
  1102. }else{
  1103. //没有报名记录,进入增加阶段的处理流程
  1104. DB::beginTransaction();
  1105. try{
  1106. //20220726增加地区undefined选项处理
  1107. if($index = stripos($data['native_place'],',undefined')){
  1108. $data['native_place'] = substr($data['native_place'],0,$index);
  1109. }
  1110. if($index = stripos($data['house_register'],',undefined')){
  1111. $data['house_register'] = substr($data['house_register'],0,$index);
  1112. }
  1113. $data['uid'] = $uid;
  1114. $data['recruit_id'] = $recruit_id;
  1115. $result = RecruitAppointInfo::create($data);
  1116. //分模块解析数据
  1117. $forms = explode(',', $recruit['forms']);
  1118. //如果有加分模块
  1119. if(in_array('expand_special',$forms)){
  1120. $special = $request->input('special');
  1121. if($special['point_apply']){
  1122. if(is_array($special['material'])){
  1123. //删除掉没有成功返回路径的图片
  1124. foreach ($special['material'] as $k => $v){
  1125. if(!array_key_exists('response',$v)){
  1126. unset($special['material'][$k]);
  1127. }
  1128. }
  1129. }
  1130. $special['material'] = json_encode($special['material']);
  1131. }
  1132. $special['recruit_appoint_id'] = $result->id;
  1133. RecruitAppointExpandSpecial::create($special);
  1134. }
  1135. //如果有详情模块
  1136. if(in_array('detail',$forms) || in_array('internship',$forms)){
  1137. $detail = $request->input('detail');
  1138. $detail['recruit_appoint_id'] = $result->id;
  1139. RecruitAppointDetail::create($detail);
  1140. }
  1141. //如果有身份证明模块
  1142. if(in_array('identification',$forms) || in_array('internship',$forms)){
  1143. $identification = $request->input('identification');
  1144. if(is_array($identification)){
  1145. //删除掉没有成功返回路径的图片
  1146. foreach ($identification as $k => $v){
  1147. if(!array_key_exists('response',$v)){
  1148. unset($identification[$k]);
  1149. }
  1150. }
  1151. }
  1152. $result->identification = json_encode($identification);
  1153. $result->save();
  1154. }
  1155. //如果有教育证明模块
  1156. if(in_array('education_certification',$forms) || in_array('internship',$forms)){
  1157. $education_certification = $request->input('education_certification');
  1158. if(is_array($education_certification)){
  1159. //删除掉没有成功返回路径的图片
  1160. foreach ($education_certification as $k => $v){
  1161. if(!array_key_exists('response',$v)){
  1162. unset($education_certification[$k]);
  1163. }
  1164. }
  1165. }
  1166. $result->education_certification = json_encode($education_certification);
  1167. $result->save();
  1168. }
  1169. //如果有其他证明模块
  1170. if(in_array('other_certification',$forms) || in_array('internship',$forms)){
  1171. $other_certification = $request->input('other_certification');
  1172. if($other_certification){
  1173. if(is_array($other_certification)){
  1174. //删除掉没有成功返回路径的图片
  1175. foreach ($other_certification as $k => $v){
  1176. if(!array_key_exists('response',$v)){
  1177. unset($other_certification[$k]);
  1178. }
  1179. }
  1180. }
  1181. $result->other_certification = json_encode($other_certification);
  1182. $result->save();
  1183. }
  1184. }
  1185. //如果有承诺书模块
  1186. if(in_array('chengnuoshu',$forms)){
  1187. $chengnuoshu = $request->input('chengnuoshu');
  1188. if($chengnuoshu){
  1189. if(is_array($chengnuoshu)){
  1190. //删除掉没有成功返回路径的图片
  1191. foreach ($chengnuoshu as $k => $v){
  1192. if(!array_key_exists('response',$v)){
  1193. unset($chengnuoshu[$k]);
  1194. }
  1195. }
  1196. }
  1197. $result->chengnuoshu = json_encode($chengnuoshu);
  1198. $result->save();
  1199. }
  1200. }
  1201. //如果有失信被执行人模块
  1202. if(in_array('shixin',$forms)){
  1203. $shixin = $request->input('shixin');
  1204. if($shixin){
  1205. if(is_array($shixin)){
  1206. //删除掉没有成功返回路径的图片
  1207. foreach ($shixin as $k => $v){
  1208. if(!array_key_exists('response',$v)){
  1209. unset($shixin[$k]);
  1210. }
  1211. }
  1212. }
  1213. $result->shixin = json_encode($shixin);
  1214. $result->save();
  1215. }
  1216. }
  1217. //如果有声明书模块
  1218. if(in_array('baokaoshengming',$forms)){
  1219. $baokaoshengming = $request->input('baokaoshengming');
  1220. if($baokaoshengming){
  1221. if(is_array($baokaoshengming)){
  1222. //删除掉没有成功返回路径的图片
  1223. foreach ($baokaoshengming as $k => $v){
  1224. if(!array_key_exists('response',$v)){
  1225. unset($baokaoshengming[$k]);
  1226. }
  1227. }
  1228. }
  1229. $result->baokaoshengming = json_encode($baokaoshengming);
  1230. $result->save();
  1231. }
  1232. }
  1233. DB::commit();
  1234. if($operation == 2){
  1235. $log = [
  1236. 'type' => 3,
  1237. 'appoint_id'=> $result->id,
  1238. 'uid' => $uid,
  1239. 'log' => '用户首次提交报名'
  1240. ];
  1241. RecruitAppointLog::create($log);
  1242. return ['status' => 1, 'msg' => '提交成功', 'data' => $result->id];
  1243. }else{
  1244. return ['status' => 1, 'msg' => '资料保存成功,请尽快完善并提交', 'data' => $result->id];
  1245. }
  1246. } catch (\Exception $e){
  1247. DB::rollback();
  1248. return ['status' => 0, 'msg' => $e->getMessage()];
  1249. }
  1250. }
  1251. }
  1252. /**
  1253. * 获得当前登录的用户
  1254. * @return \Illuminate\Contracts\Auth\Authenticatable|null
  1255. */
  1256. public function getUser()
  1257. {
  1258. if (auth('web-member')->check()) {
  1259. $user = auth('web-member')->user();
  1260. } else {
  1261. $user = null;
  1262. }
  1263. return $user;
  1264. }
  1265. /**
  1266. * 检查用户基本信息
  1267. * @return array
  1268. */
  1269. public function checkUserBasicInfo()
  1270. {
  1271. $user = $this->getUser();
  1272. if (!empty($user)) {
  1273. $uid = $user->id;
  1274. } else {
  1275. $arr = ['status' => 401, 'msg'=>'请登录!'];
  1276. return $arr;
  1277. }
  1278. $info = RecruitAppointBasic::where('uid',$uid)->first();
  1279. if (empty($info)){
  1280. $arr = ['status'=>401,'msg'=>'请先完善招考基本信息','url'=> route('recruit.recruitInfo')];
  1281. return $arr;
  1282. }
  1283. return ['status' => 200, 'msg' => ''];
  1284. }
  1285. /**
  1286. * 个人中心招考页面
  1287. * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
  1288. */
  1289. public function person_recruit()
  1290. {
  1291. $user = auth('web-member')->user();
  1292. $list = RecruitAppointInfo::where('uid',$user->id)
  1293. ->join('recruit', 'recruit.id', '=', 'recruit_appoint_info.recruit_id', 'left')
  1294. ->join('recruit_post', 'recruit_post.id', '=', 'recruit_appoint_info.post_id', 'left')
  1295. ->select('recruit.name as recruit_name','recruit_appoint_info.*','recruit_post.code','recruit_post.name')
  1296. ->get();
  1297. return view('app.person.recruit')->with(['list' => $list,'total' => count($list)]);
  1298. }
  1299. /**
  1300. * 招考信息基础页
  1301. * @param Request $request
  1302. * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
  1303. */
  1304. public function recruit_info(Request $request)
  1305. {
  1306. $user = auth('web-member')->user();
  1307. if (!empty($user)) {
  1308. $uid = $user->id;
  1309. } else {
  1310. return redirect(route('login'));
  1311. }
  1312. $info = RecruitAppointBasic::where('uid',$user->id)->first();
  1313. if(!$info){
  1314. $info = [
  1315. 'realname' => '',
  1316. 'sex' => '0',
  1317. 'birthday' => '',
  1318. 'avatar' => '',
  1319. 'nation' => '',
  1320. 'native_place' => '',
  1321. 'political_affiliation' => '',
  1322. 'titles' => '',
  1323. 'work' => '',
  1324. 'house_register' => '',
  1325. 'join_time' => '',
  1326. 'edu_type' => '',
  1327. 'education' => '',
  1328. 'school' => '',
  1329. 'degree' => '',
  1330. 'pro' => '',
  1331. 'address' => '',
  1332. 'card' => '',
  1333. 'mobile' => '',
  1334. 'email' => '',
  1335. 'concat_name' => '',
  1336. 'concat_mobile' => '',
  1337. 'resume' => '',
  1338. 'family' => [
  1339. [
  1340. 'relation' => '',
  1341. 'realname' => '',
  1342. 'birthday' => '',
  1343. 'political_affiliation' => '',
  1344. 'work' => ''
  1345. ]
  1346. ],
  1347. 'is_push' => '1'
  1348. ];
  1349. }else{
  1350. $info->sex = (string)$info->sex;
  1351. $info->edu_type = (string)$info->edu_type;
  1352. $info->is_push = (string)$info->is_push;
  1353. $info->family = empty($info->family) ? [[
  1354. 'relation' => '',
  1355. 'realname' => '',
  1356. 'birthday' => '',
  1357. 'political_affiliation' => '',
  1358. 'work' => ''
  1359. ]] : json_decode($info->family);
  1360. }
  1361. $recruit_id = $request->input('recruit_id',0);
  1362. return view('app.person.recruit_info',[
  1363. 'info' => json_encode($info),
  1364. 'recruit_id'=> $recruit_id
  1365. ]);
  1366. }
  1367. /**
  1368. * 保存招考信息
  1369. * @param RecruitValidatorRequest $request
  1370. * @return \Illuminate\Http\JsonResponse
  1371. */
  1372. public function saveRecruitInfo(RecruitValidatorRequest $request)
  1373. {
  1374. $user = auth('web-member')->user();
  1375. $basic = RecruitAppointBasic::where('uid',$user->id)->first();
  1376. $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');
  1377. if(count($data['family']) > 0){
  1378. $data['family'] = json_encode($data['family']);
  1379. }
  1380. if($basic){
  1381. //更新基础信息
  1382. $res = RecruitAppointBasic::where('uid',$user->id)->update($data);
  1383. if (!$res) {
  1384. return response()->json(['status'=>0,'msg'=>'保存失败,请联系客服']);
  1385. }else{
  1386. return response()->json(['status'=>1,'msg'=>'个人基础信息保存成功,快去报名吧!']);
  1387. }
  1388. }else{
  1389. //新增基础信息
  1390. $data['uid'] = $user->id;
  1391. $res = RecruitAppointBasic::create($data);
  1392. if (!$res) {
  1393. return response()->json(['status'=>0,'msg'=>'保存失败,请联系客服']);
  1394. }else{
  1395. return response()->json(['status'=>1,'msg'=>'个人基础信息保存成功,快去报名吧!']);
  1396. }
  1397. }
  1398. }
  1399. /**
  1400. * 笔试准考证
  1401. * @param Request $request
  1402. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1403. */
  1404. public function pen_ticket(Request $request)
  1405. {
  1406. $user = $this->getUser();
  1407. if (!empty($user)) {
  1408. $uid = $user->id;
  1409. } else {
  1410. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1411. }
  1412. $recruit_id = $request->input('recruit_id');
  1413. $recruit = Recruit::where('id',$recruit_id)->first();
  1414. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  1415. if($appoint_info){
  1416. $pen_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',1)->first();
  1417. if($pen_ticket){
  1418. $health = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
  1419. if((!$health || $health->h_status == 0) && $recruit->pen_epidemic){
  1420. return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
  1421. }
  1422. $time = time();
  1423. if(strtotime($pen_ticket->ex_start) < $time && strtotime($pen_ticket->ex_end) > $time){
  1424. RecruitTicket::where('appoint_id',$appoint_info->id)->update(['ex_status' => 1]);
  1425. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1426. $name = $recruit->name_en;
  1427. $date = date("Y-m-d",strtotime($recruit->created_at));
  1428. //$filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
  1429. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1430. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/pen/" . $filename . '.pdf';
  1431. if(file_exists($file)){
  1432. header('Content-Description: File Transfer');
  1433. header('Content-Type: application/octet-stream');
  1434. header('Content-Disposition: attachment; filename='.basename($file));
  1435. header('Content-Transfer-Encoding: binary');
  1436. header('Expires: 0');
  1437. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1438. header('Pragma: public');
  1439. header('Content-Length: ' . filesize($file));
  1440. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1441. flush();
  1442. readfile($file);
  1443. }else{
  1444. return $this->showMessage('准考证不存在,请联系管理员!', route('home'), true, '上一页', '3');
  1445. }
  1446. }else{
  1447. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1448. }
  1449. }else{
  1450. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1451. }
  1452. }else{
  1453. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1454. }
  1455. }
  1456. /**
  1457. * 审核准考证
  1458. * @param Request $request
  1459. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1460. */
  1461. public function check_ticket(Request $request)
  1462. {
  1463. $user = $this->getUser();
  1464. if (!empty($user)) {
  1465. $uid = $user->id;
  1466. } else {
  1467. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1468. }
  1469. $recruit_id = $request->input('recruit_id');
  1470. $recruit = Recruit::where('id',$recruit_id)->first();
  1471. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  1472. if($appoint_info){
  1473. $check_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',2)->first();
  1474. if($check_ticket){
  1475. $health = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
  1476. if((!$health || $health->h_status == 0) && $recruit->pen_epidemic){
  1477. return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
  1478. }$time = time();
  1479. if(strtotime($check_ticket->ex_start) < $time && strtotime($check_ticket->ex_end) > $time){
  1480. RecruitTicket::where('id',$check_ticket->id)->update(['ex_status' => 1]);
  1481. $recruit = Recruit::where('id',$recruit_id)->first();
  1482. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1483. $name = $recruit->name_en;
  1484. $date = date("Y-m-d",strtotime($recruit->created_at));
  1485. //$filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
  1486. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1487. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/computer/" . $filename . '.pdf';
  1488. if(file_exists($file)){
  1489. header('Content-Description: File Transfer');
  1490. header('Content-Type: application/octet-stream');
  1491. header('Content-Disposition: attachment; filename='.basename($file));
  1492. header('Content-Transfer-Encoding: binary');
  1493. header('Expires: 0');
  1494. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1495. header('Pragma: public');
  1496. header('Content-Length: ' . filesize($file));
  1497. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1498. flush();
  1499. readfile($file);
  1500. }
  1501. }else{
  1502. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1503. }
  1504. }else{
  1505. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1506. }
  1507. }else{
  1508. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1509. }
  1510. }
  1511. /**
  1512. * 面试准考证
  1513. * @param Request $request
  1514. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1515. */
  1516. public function face_ticket(Request $request)
  1517. {
  1518. $user = $this->getUser();
  1519. if (!empty($user)) {
  1520. $uid = $user->id;
  1521. } else {
  1522. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1523. }
  1524. $recruit_id = $request->input('recruit_id');
  1525. $recruit = Recruit::where('id',$recruit_id)->first();
  1526. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  1527. if($appoint_info){
  1528. $face_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',3)->first();
  1529. if($face_ticket){
  1530. $health = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
  1531. if((!$health || $health->h_status == 0) && $recruit->pen_epidemic){
  1532. return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
  1533. }$time = time();
  1534. if(strtotime($face_ticket->ex_start) < $time && strtotime($face_ticket->ex_end) > $time){
  1535. RecruitTicket::where('id',$face_ticket->id)->update(['ex_status' => 1]);
  1536. $recruit = Recruit::where('id',$recruit_id)->first();
  1537. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1538. $name = $recruit->name_en;
  1539. $date = date("Y-m-d",strtotime($recruit->created_at));
  1540. //$filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
  1541. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1542. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/face/" . $filename . '.pdf';
  1543. if(file_exists($file)){
  1544. header('Content-Description: File Transfer');
  1545. header('Content-Type: application/octet-stream');
  1546. header('Content-Disposition: attachment; filename='.basename($file));
  1547. header('Content-Transfer-Encoding: binary');
  1548. header('Expires: 0');
  1549. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1550. header('Pragma: public');
  1551. header('Content-Length: ' . filesize($file));
  1552. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1553. flush();
  1554. readfile($file);
  1555. }
  1556. }else{
  1557. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1558. }
  1559. }else{
  1560. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1561. }
  1562. }else{
  1563. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1564. }
  1565. }
  1566. /**
  1567. * 复试准考证
  1568. * @param Request $request
  1569. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1570. */
  1571. public function reexamine_ticket(Request $request)
  1572. {
  1573. $user = $this->getUser();
  1574. if (!empty($user)) {
  1575. $uid = $user->id;
  1576. } else {
  1577. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1578. }
  1579. $recruit_id = $request->input('recruit_id');
  1580. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  1581. if($appoint_info){
  1582. $reexamine_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',4)->first();
  1583. if($reexamine_ticket){
  1584. $time = time();
  1585. if(strtotime($reexamine_ticket->ex_start) < $time && strtotime($reexamine_ticket->ex_end) > $time){
  1586. RecruitTicket::where('id',$reexamine_ticket->id)->update(['ex_status' => 1]);
  1587. $recruit = Recruit::where('id',$recruit_id)->first();
  1588. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1589. $name = $recruit->name_en;
  1590. $date = date("Y-m-d",strtotime($recruit->created_at));
  1591. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1592. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/reexamine/" . $filename . '.pdf';
  1593. if(file_exists($file)){
  1594. header('Content-Description: File Transfer');
  1595. header('Content-Type: application/octet-stream');
  1596. header('Content-Disposition: attachment; filename='.basename($file));
  1597. header('Content-Transfer-Encoding: binary');
  1598. header('Expires: 0');
  1599. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1600. header('Pragma: public');
  1601. header('Content-Length: ' . filesize($file));
  1602. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1603. flush();
  1604. readfile($file);
  1605. }
  1606. }else{
  1607. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1608. }
  1609. }else{
  1610. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1611. }
  1612. }else{
  1613. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1614. }
  1615. }
  1616. /**
  1617. * 材料补登
  1618. * @param Request $request
  1619. */
  1620. public function material_supplement(Request $request)
  1621. {
  1622. $user = $this->getUser();
  1623. if (!empty($user)) {
  1624. $uid = $user->id;
  1625. } else {
  1626. return redirect(route('login'));
  1627. }
  1628. //招考id
  1629. $id = $request->input('id', 0);
  1630. if (!$id) {
  1631. return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
  1632. }
  1633. $recruit = Recruit::find($id);
  1634. if(!$recruit['status'] && !$user->recruit_test){
  1635. return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1636. }
  1637. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  1638. if(!$appoint_info){
  1639. return $this->showMessage('抱歉,您没有报名,无需考察审核!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1640. }
  1641. if($appoint_info->pen_audit != 1){
  1642. return $this->showMessage('抱歉,您未入闱,无需考察审核!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1643. }
  1644. $limit_time = 1694079000;
  1645. $time = time();
  1646. if( $time > $limit_time){
  1647. return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1648. }
  1649. $info = RecruitSupplement::where('appoint_id',$appoint_info->id)->where('type','supplement')->first();
  1650. if(!$info){
  1651. $info = [
  1652. 'appoint_id' => $appoint_info->id,
  1653. 'identification' => '',
  1654. //'household_register' => '',
  1655. //'education_certification' => '',
  1656. //'family_planning' => '',
  1657. 'chengxin' => '',
  1658. 'manage' => '',
  1659. 'status' => 3
  1660. ];
  1661. }else{
  1662. $info = $info->toArray();
  1663. if(json_decode($info['identification'])){
  1664. $identification = json_decode($info['identification'],true);
  1665. foreach ($identification as $k => $v){
  1666. if(array_key_exists('response',$v)){
  1667. $identification[$k]['url'] = $v['response']['path'];
  1668. }
  1669. }
  1670. }else{
  1671. $identification = [];
  1672. }
  1673. $info['identification'] = $identification;
  1674. if(json_decode($info['household_register'])){
  1675. $household_register = json_decode($info['household_register'],true);
  1676. foreach ($household_register as $k => $v){
  1677. if(array_key_exists('response',$v)){
  1678. $household_register[$k]['url'] = $v['response']['path'];
  1679. }
  1680. }
  1681. }else{
  1682. $household_register = [];
  1683. }
  1684. $info['household_register'] = $household_register;
  1685. if(json_decode($info['education_certification'])){
  1686. $education_certification = json_decode($info['education_certification'],true);
  1687. foreach ($education_certification as $k => $v){
  1688. if(array_key_exists('response',$v)){
  1689. $education_certification[$k]['url'] = $v['response']['path'];
  1690. }
  1691. }
  1692. }else{
  1693. $education_certification = [];
  1694. }
  1695. $info['education_certification'] = $education_certification;
  1696. if(json_decode($info['family_planning'])){
  1697. $family_planning = json_decode($info['family_planning'],true);
  1698. foreach ($family_planning as $k => $v){
  1699. if(array_key_exists('response',$v)){
  1700. $family_planning[$k]['url'] = $v['response']['path'];
  1701. }
  1702. }
  1703. }else{
  1704. $family_planning = [];
  1705. }
  1706. $info['family_planning'] = $family_planning;
  1707. if(json_decode($info['chengxin'])){
  1708. $chengxin = json_decode($info['chengxin'],true);
  1709. foreach ($chengxin as $k => $v){
  1710. if(array_key_exists('response',$v)){
  1711. $chengxin[$k]['url'] = $v['response']['path'];
  1712. }
  1713. }
  1714. }else{
  1715. $chengxin = [];
  1716. }
  1717. $info['chengxin'] = $chengxin;
  1718. if(json_decode($info['manage'])){
  1719. $manage = json_decode($info['manage'],true);
  1720. foreach ($manage as $k => $v){
  1721. if(array_key_exists('response',$v)){
  1722. $manage[$k]['url'] = $v['response']['path'];
  1723. }
  1724. }
  1725. }else{
  1726. $manage = [];
  1727. }
  1728. $info['manage'] = $manage;
  1729. }
  1730. $view_data['info'] = json_encode($info);
  1731. $view_data['title'] = $recruit->company;
  1732. return view('app.recruit.supplement',$view_data);
  1733. }
  1734. /**
  1735. * 健康信息登记
  1736. * @param Request $request
  1737. */
  1738. public function health_info(Request $request)
  1739. {
  1740. $user = $this->getUser();
  1741. if (!empty($user)) {
  1742. $uid = $user->id;
  1743. } else {
  1744. return redirect(route('login'));
  1745. }
  1746. //招考id
  1747. $id = $request->input('id', 0);
  1748. if (!$id) {
  1749. return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
  1750. }
  1751. $recruit = Recruit::find($id);
  1752. if(!$recruit['status'] && !$user->recruit_test){
  1753. return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1754. }
  1755. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  1756. if(!$appoint_info){
  1757. return $this->showMessage('抱歉,您没有报名,无需登记!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1758. }
  1759. if($appoint_info->audit != 3){
  1760. return $this->showMessage('抱歉,您无需登记!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1761. }
  1762. $time = time();
  1763. $type = $request->input('type',null);
  1764. $where = [];
  1765. if($type){
  1766. switch ($type){
  1767. case 'pen':
  1768. $start = strtotime($recruit->pen_health_start);
  1769. $end = strtotime($recruit->pen_health_end);
  1770. break;
  1771. case 'computer':
  1772. $start = strtotime($recruit->computer_health_start);
  1773. $end = strtotime($recruit->computer_health_end);
  1774. break;
  1775. case 'face':
  1776. $start = strtotime($recruit->face_health_start);
  1777. $end = strtotime($recruit->face_health_end);
  1778. break;
  1779. case 'reexamine':
  1780. $start = strtotime($recruit->reexamine_health_start);
  1781. $end = strtotime($recruit->reexamine_health_end);
  1782. break;
  1783. default:
  1784. $start = strtotime($recruit->supplement_start);
  1785. $end = strtotime($recruit->supplement_end);
  1786. break;
  1787. }
  1788. $where[] = ['type', '=', $type];
  1789. }else{
  1790. $start = strtotime($recruit->supplement_start);
  1791. $end = strtotime($recruit->supplement_end);
  1792. }
  1793. if($time > $end || $time < $start){
  1794. return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1795. }
  1796. $where[] = ['appoint_id', '=', $appoint_info->id];
  1797. $info = RecruitSupplement::where($where)->first();
  1798. if(!$info){
  1799. $info = [
  1800. 'appoint_id' => $appoint_info->id,
  1801. 'health_code' => '',
  1802. 'trip_code' => '',
  1803. 'type' => $type
  1804. ];
  1805. }else{
  1806. $info = $info->toArray();
  1807. if(json_decode($info['health_code'])){
  1808. $health_code = json_decode($info['health_code'],true);
  1809. foreach ($health_code as $k => $v){
  1810. if(array_key_exists('response',$v)){
  1811. $health_code[$k]['url'] = $v['response']['path'];
  1812. }
  1813. }
  1814. }else{
  1815. $health_code = [];
  1816. }
  1817. $info['health_code'] = $health_code;
  1818. if(json_decode($info['trip_code'])){
  1819. $trip_code = json_decode($info['trip_code'],true);
  1820. foreach ($trip_code as $k => $v){
  1821. if(array_key_exists('response',$v)){
  1822. $trip_code[$k]['url'] = $v['response']['path'];
  1823. }
  1824. }
  1825. }else{
  1826. $trip_code = [];
  1827. }
  1828. $info['trip_code'] = $trip_code;
  1829. }
  1830. $view_data['info'] = json_encode($info);
  1831. $view_data['title'] = $recruit->company;
  1832. return view('app.recruit.health',$view_data);
  1833. }
  1834. public function save_supplement(Request $request)
  1835. {
  1836. $user = $this->getUser();
  1837. if (!empty($user)) {
  1838. $uid = $user->id;
  1839. } else {
  1840. return redirect(route('login'));
  1841. }
  1842. $limit_time = 1662543000;
  1843. $time = time();
  1844. if( $time > $limit_time){
  1845. return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',18)), true, '上一页', '3');
  1846. }
  1847. $appoint_id = $request->input('appoint_id');
  1848. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',18)->where('id',$appoint_id)->first();
  1849. if(!$appoint_info){
  1850. return ['status' => 0, 'msg' => '抱歉,找不到您要补登的报名记录!'];
  1851. }
  1852. $info = RecruitSupplement::where('appoint_id',$appoint_id)->where('type','supplement')->first();
  1853. if($info){
  1854. if($info->status == 1){
  1855. return ['status' => 0, 'msg' => '材料已审核通过,不允许修改'];
  1856. }
  1857. if($info->status == 0){
  1858. return ['status' => 0, 'msg' => '材料审核中,不允许修改'];
  1859. }
  1860. //身份证明
  1861. $identification = $request->input('identification');
  1862. if(is_array($identification)){
  1863. //删除掉没有成功返回路径的图片
  1864. foreach ($identification as $k => $v){
  1865. if(!array_key_exists('response',$v)){
  1866. unset($identification[$k]);
  1867. }
  1868. }
  1869. }
  1870. $info->identification = json_encode($identification);
  1871. //户口簿
  1872. $household_register = $request->input('household_register');
  1873. if(is_array($household_register)){
  1874. //删除掉没有成功返回路径的图片
  1875. foreach ($household_register as $k => $v){
  1876. if(!array_key_exists('response',$v)){
  1877. unset($household_register[$k]);
  1878. }
  1879. }
  1880. }
  1881. $info->household_register = json_encode($household_register);
  1882. //学信网
  1883. $education_certification = $request->input('education_certification');
  1884. if(is_array($education_certification)){
  1885. //删除掉没有成功返回路径的图片
  1886. foreach ($education_certification as $k => $v){
  1887. if(!array_key_exists('response',$v)){
  1888. unset($education_certification[$k]);
  1889. }
  1890. }
  1891. }
  1892. $info->education_certification = json_encode($education_certification);
  1893. //计生
  1894. // $family_planning = $request->input('family_planning');
  1895. // if(is_array($family_planning)){
  1896. // //删除掉没有成功返回路径的图片
  1897. // foreach ($family_planning as $k => $v){
  1898. // if(!array_key_exists('response',$v)){
  1899. // unset($family_planning[$k]);
  1900. // }
  1901. // }
  1902. // }
  1903. // $info->family_planning = json_encode($family_planning);
  1904. //综治
  1905. $manage = $request->input('manage');
  1906. if(is_array($manage)){
  1907. //删除掉没有成功返回路径的图片
  1908. foreach ($manage as $k => $v){
  1909. if(!array_key_exists('response',$v)){
  1910. unset($manage[$k]);
  1911. }
  1912. }
  1913. }
  1914. $info->manage = json_encode($manage);
  1915. $info->status = 0;
  1916. $info->save();
  1917. $appoint_info->political_audit = 4;
  1918. $appoint_info->save();
  1919. return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
  1920. }else{
  1921. $data['appoint_id'] = $appoint_id;
  1922. //身份证明
  1923. $identification = $request->input('identification');
  1924. if(is_array($identification)){
  1925. //删除掉没有成功返回路径的图片
  1926. foreach ($identification as $k => $v){
  1927. if(!array_key_exists('response',$v)){
  1928. unset($identification[$k]);
  1929. }
  1930. }
  1931. }
  1932. $data['identification'] = json_encode($identification);
  1933. //户口簿
  1934. $household_register = $request->input('household_register');
  1935. if(is_array($household_register)){
  1936. //删除掉没有成功返回路径的图片
  1937. foreach ($household_register as $k => $v){
  1938. if(!array_key_exists('response',$v)){
  1939. unset($household_register[$k]);
  1940. }
  1941. }
  1942. }
  1943. $data['household_register'] = json_encode($household_register);
  1944. //学信网
  1945. $education_certification = $request->input('education_certification');
  1946. if(is_array($education_certification)){
  1947. //删除掉没有成功返回路径的图片
  1948. foreach ($education_certification as $k => $v){
  1949. if(!array_key_exists('response',$v)){
  1950. unset($education_certification[$k]);
  1951. }
  1952. }
  1953. }
  1954. $data['education_certification'] = json_encode($education_certification);
  1955. //计生
  1956. // $family_planning = $request->input('family_planning');
  1957. // if(is_array($family_planning)){sp
  1958. // //删除掉没有成功返回路径的图片
  1959. // foreach ($family_planning as $k => $v){
  1960. // if(!array_key_exists('response',$v)){
  1961. // unset($family_planning[$k]);
  1962. // }
  1963. // }
  1964. // }
  1965. // $data['family_planning'] = json_encode($family_planning);
  1966. //综治
  1967. $manage = $request->input('manage');
  1968. if(is_array($manage)){
  1969. //删除掉没有成功返回路径的图片
  1970. foreach ($manage as $k => $v){
  1971. if(!array_key_exists('response',$v)){
  1972. unset($manage[$k]);
  1973. }
  1974. }
  1975. }
  1976. $data['manage'] = json_encode($manage);
  1977. $data['status'] = 0;
  1978. $data['type'] = 'supplement';
  1979. $result = RecruitSupplement::create($data);
  1980. $appoint_info->political_audit = 4;
  1981. $appoint_info->save();
  1982. return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
  1983. }
  1984. return ['status' => 0, 'msg' => 'test', 'data' => ''];
  1985. }
  1986. public function save_healthinfo(Request $request)
  1987. {
  1988. $user = $this->getUser();
  1989. if (!empty($user)) {
  1990. $uid = $user->id;
  1991. } else {
  1992. return redirect(route('login'));
  1993. }
  1994. $appoint_id = $request->input('appoint_id');
  1995. $type = $request->input('type');
  1996. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('id',$appoint_id)->first();
  1997. if(!$appoint_info){
  1998. return ['status' => 0, 'msg' => '抱歉,找不到您要登记的报名记录!'];
  1999. }
  2000. $recruit = Recruit::where('id',$appoint_info->recruit_id)->first();
  2001. $info = RecruitSupplement::where('appoint_id',$appoint_id)->where('type',$type)->first();
  2002. if($info){
  2003. if($info->h_status == 1){
  2004. return ['status' => 0, 'msg' => '材料已审核通过,不允许修改'];
  2005. }
  2006. if($info->h_status == 0){
  2007. return ['status' => 0, 'msg' => '材料审核中,不允许修改'];
  2008. }
  2009. $health_code = $request->input('health_code');
  2010. if(is_array($health_code)){
  2011. //删除掉没有成功返回路径的图片
  2012. foreach ($health_code as $k => $v){
  2013. if(!array_key_exists('response',$v)){
  2014. unset($health_code[$k]);
  2015. }
  2016. }
  2017. }
  2018. $info->health_code = json_encode($health_code);
  2019. $trip_code = $request->input('trip_code');
  2020. if(is_array($trip_code)){
  2021. //删除掉没有成功返回路径的图片
  2022. foreach ($trip_code as $k => $v){
  2023. if(!array_key_exists('response',$v)){
  2024. unset($trip_code[$k]);
  2025. }
  2026. }
  2027. }
  2028. $info->trip_code = json_encode($trip_code);
  2029. $info->h_status = 0;
  2030. $appoint_info->health_audit = 4;
  2031. $appoint_info->save();
  2032. $info->save();
  2033. return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
  2034. }else{
  2035. $data['appoint_id'] = $appoint_id;
  2036. $data['type'] = $type;
  2037. $data['h_status'] = 0;
  2038. $appoint_info->health_audit = 4;
  2039. $health_code = $request->input('health_code');
  2040. if(is_array($health_code)){
  2041. //删除掉没有成功返回路径的图片
  2042. foreach ($health_code as $k => $v){
  2043. if(!array_key_exists('response',$v)){
  2044. unset($health_code[$k]);
  2045. }
  2046. }
  2047. }
  2048. $health_result = $this->baiduService->health_code(file_get_contents(base_path() . "/public" . $health_code[0]['response']['path']));
  2049. $health_msg = ['健康码自动审核通过'];
  2050. //$h_status = 1;
  2051. //$appoint_info->health_audit = 1;
  2052. if(!array_key_exists('error_msg',$health_result) && !array_key_exists('error_code',$health_result)){
  2053. if(array_key_exists('姓名',$health_result)){
  2054. if(stripos($health_result['姓名'][0]['word'],'*')>0){
  2055. return ['status' => 0, 'msg' => '请打开健康码的“眼睛开关”,显示完整个人信息'];
  2056. }
  2057. if($health_result['姓名'][0]['word'] != $appoint_info->realname){
  2058. array_push($health_msg,'抱歉,请上传您本人的健康码!');
  2059. }
  2060. }else{
  2061. array_push($health_msg,'健康码错误,识别不到姓名!');
  2062. }
  2063. if(array_key_exists('状态',$health_result)){
  2064. if($health_result['状态'][0]['word'] != '绿码'){
  2065. array_push($health_msg,'抱歉,您的健康码非绿码!');
  2066. }
  2067. }else{
  2068. array_push($health_msg,'健康码错误,识别不到状态!');
  2069. }
  2070. if(array_key_exists('更新时间',$health_result)){
  2071. $time = strtotime($health_result['更新时间'][0]['word']);
  2072. if($time < strtotime($recruit->pen_health_start) || $time > strtotime($recruit->pen_health_end)){
  2073. array_push($health_msg,'抱歉,请上传{$recruit->pen_health_start}至{$recruit->pen_health_end}之间的健康码!');
  2074. }
  2075. }else{
  2076. array_push($health_msg,'健康码错误,识别不到时间!');
  2077. }
  2078. //$data['h_status'] = $h_status;
  2079. $data['h_msg'] = implode(';',$health_msg);
  2080. //$appoint_info->health_audit = $h_status == 1 ? 1 : 4;
  2081. $data['health_code'] = json_encode($health_code);
  2082. }
  2083. $data['health_result'] = json_encode($health_result);
  2084. $trip_code = $request->input('trip_code');
  2085. if(is_array($trip_code)){
  2086. //删除掉没有成功返回路径的图片
  2087. foreach ($trip_code as $k => $v){
  2088. if(!array_key_exists('response',$v)){
  2089. unset($trip_code[$k]);
  2090. }
  2091. }
  2092. }
  2093. $trip_result = $this->baiduService->trip_code(file_get_contents(base_path() . "/public" . $trip_code[0]['response']['path']));
  2094. $trip_msg = [];
  2095. $trip_status = 0;
  2096. if(!array_key_exists('error_msg',$trip_result) && !array_key_exists('error_code',$trip_result)){
  2097. if(array_key_exists('途经地',$trip_result['result'])){
  2098. $fangyi_area = explode("\r\n",config('aix.fangyi.fangyi_zhaokao.fangyi_zhaokao.risk_area'));
  2099. $result = array_intersect($fangyi_area,$trip_result['result']['途经地'][0]['word']);
  2100. if(count($result) > 0){
  2101. array_push($trip_msg,'抱歉,您的行程中包含系统设置中高风险地区!');
  2102. $trip_status = 0;
  2103. }
  2104. }
  2105. if(array_key_exists('风险性',$trip_result['result']) && $trip_result['result']['风险性']){
  2106. array_push($trip_msg,'抱歉,您的行程可能含有风险!');
  2107. $trip_status = 0;
  2108. }
  2109. if(array_key_exists('更新时间',$trip_result['result'])){
  2110. $time = strtotime($trip_result['result']['更新时间'][0]['word'][0]);
  2111. if($time > strtotime($recruit->pen_health_start) || $recruit < ($recruit->pen_health_end)){
  2112. array_push($trip_msg,'抱歉,请上传{$recruit->pen_health_start}至{$recruit->pen_health_end}之间的行程码!');
  2113. $trip_status = 0;
  2114. }
  2115. }
  2116. $data['h_msg'] .= implode(';',$trip_msg);
  2117. }
  2118. $data['trip_result'] = json_encode($trip_result);
  2119. $data['trip_code'] = json_encode($trip_code);
  2120. $data['h_status'] = 0;
  2121. $appoint_info->health_audit = 4;
  2122. RecruitSupplement::create($data);
  2123. $appoint_info->save();
  2124. return ['status' => 1, 'msg' => '提交成功,请刷新查看审核结果', 'data' => ''];
  2125. }
  2126. return ['status' => 0, 'msg' => 'test', 'data' => ''];
  2127. }
  2128. public function post_select(Request $request)
  2129. {
  2130. $user = $this->getUser();
  2131. if (!empty($user)) {
  2132. $uid = $user->id;
  2133. } else {
  2134. return redirect(route('login'));
  2135. }
  2136. $recruit_id = $request->input('recruit_id');
  2137. //$appoint_id = $request->input('appoint_id');
  2138. $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  2139. if(!$info){
  2140. return $this->showMessage('抱歉,您无需择岗!', route('recruit.show',array('id',$recruit_id)), true, '上一页', '2');
  2141. }
  2142. //手动设置择岗时间段
  2143. $time = time();
  2144. if($time > 1663300800 || $time < 1663200000){
  2145. return $this->showMessage('抱歉,未到择岗时间!', route('recruit.show',array('id',$recruit_id)), true, '上一页', '2');
  2146. }
  2147. $option_list = [
  2148. [
  2149. 'id' => 6,
  2150. 'name' => '新塘街道'
  2151. ],
  2152. [
  2153. 'id' => 7,
  2154. 'name' => '陈埭镇'
  2155. ],
  2156. [
  2157. 'id' => 8,
  2158. 'name' => '池店镇'
  2159. ],
  2160. [
  2161. 'id' => 9,
  2162. 'name' => '安海镇'
  2163. ],
  2164. [
  2165. 'id' => 10,
  2166. 'name' => '磁灶镇'
  2167. ],
  2168. [
  2169. 'id' => 11,
  2170. 'name' => '内坑镇'
  2171. ],
  2172. [
  2173. 'id' => 13,
  2174. 'name' => '东石镇'
  2175. ],
  2176. [
  2177. 'id' => 14,
  2178. 'name' => '永和镇'
  2179. ],
  2180. [
  2181. 'id' => 15,
  2182. 'name' => '英林镇'
  2183. ],
  2184. [
  2185. 'id' => 16,
  2186. 'name' => '金井镇'
  2187. ],
  2188. [
  2189. 'id' => 17,
  2190. 'name' => '龙湖镇'
  2191. ],
  2192. [
  2193. 'id' => 18,
  2194. 'name' => '深沪镇'
  2195. ],
  2196. [
  2197. 'id' => 19,
  2198. 'name' => '西滨镇'
  2199. ]
  2200. ];
  2201. $select_list = [];
  2202. if($info->result){
  2203. $result = json_decode($info->result,true);
  2204. foreach ($result as $v){
  2205. $item['name'] = $v;
  2206. array_push($select_list,$item);
  2207. }
  2208. }
  2209. // $recruit_id = $request->input('recruit_id');
  2210. // $appoint_id = $request->input('appoint_id');
  2211. // $uid = $request->input('uid');
  2212. // $info = RecruitAppointSelect::where('uid',$uid)->first();
  2213. // if(!$info){
  2214. // $info = new \stdClass();
  2215. // $info->status = 0;
  2216. // $info->recruit_id = 8;
  2217. // $info->appoint_id = rand(0,999999);
  2218. // $info->uid = rand(0,999999);
  2219. // }else{
  2220. // $result = json_decode($info->result,true);
  2221. // foreach ($option_list as $k => $v){
  2222. // if(in_array($v['name'],$result)){
  2223. // $select_list[$k] = $v;
  2224. // unset($option_list[$k]);
  2225. // }
  2226. // }
  2227. // }
  2228. $view_data = ['info' => $info,'options_list' => json_encode($option_list),'select_list' => json_encode($select_list)];
  2229. return view('app.recruit.post_select',$view_data);
  2230. }
  2231. /**
  2232. * 放弃择岗
  2233. */
  2234. public function give_up_post(Request $request)
  2235. {
  2236. //以下为测试环境
  2237. // $recruit_id = $request->input('recruit_id');
  2238. // $appoint_id = $request->input('appoint_id');
  2239. // $uid = $request->input('uid');
  2240. // $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->where('appoint_id',$appoint_id)->first();
  2241. // if($info){
  2242. // return ['status' => 0, 'msg' => "测试数据重复,请重新点击生成测试数据!"];
  2243. // }
  2244. // RecruitAppointSelect::create(['recruit_id'=>$recruit_id,'appoint_id'=>$appoint_id,'uid'=>$uid,'status'=>-1]);
  2245. // return ['status' => 1, 'msg' => "放弃择岗成功!"];
  2246. //以下为正式环境再放开
  2247. $user = $this->getUser();
  2248. if (!empty($user)) {
  2249. $uid = $user->id;
  2250. } else {
  2251. return redirect(route('login'));
  2252. }
  2253. $recruit_id = $request->input('recruit_id');
  2254. $appoint_id = $request->input('appoint_id');
  2255. $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->where('appoint_id',$appoint_id)->first();
  2256. if($info == null){
  2257. return ['status' => 0, 'msg' => "抱歉,您无需择岗!"];
  2258. }
  2259. if($info->status != 0){
  2260. return ['status' => 0, 'msg' => "抱歉,您不是待择岗状态!"];
  2261. }
  2262. $info->status = -1;
  2263. $info->save();
  2264. return ['status' => 1, 'msg' => "放弃择岗成功!"];
  2265. }
  2266. public function comfirm_post(Request $request)
  2267. {
  2268. $user = $this->getUser();
  2269. if (!empty($user)) {
  2270. $uid = $user->id;
  2271. } else {
  2272. return redirect(route('login'));
  2273. }
  2274. $recruit_id = $request->input('recruit_id');
  2275. $appoint_id = $request->input('appoint_id');
  2276. $time = time();
  2277. if($time > 1663300800 || $time < 1663200000){
  2278. return $this->showMessage('抱歉,未到择岗时间!', route('recruit.show',array('id',$recruit_id)), true, '上一页', '2');
  2279. }
  2280. $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->where('appoint_id',$appoint_id)->first();
  2281. if($info->result){
  2282. return ['status' => 0, 'msg' => "择岗数据已提交!"];
  2283. }
  2284. // $data = [
  2285. // 'recruit_id' => $recruit_id,
  2286. // 'appoint_id' => $recruit_id,
  2287. // 'uid' => $uid,
  2288. // 'status' => 1
  2289. // ];
  2290. $result = [];
  2291. $select = $request->input('select');
  2292. if(is_array($select) && count($select) > 0){
  2293. foreach ($select as $v) {
  2294. array_push($result,$v['name']);
  2295. }
  2296. }
  2297. $info->result = json_encode($result);
  2298. $info->status = 1;
  2299. $info->save();
  2300. return ['status' => 1, 'msg' => "提交择岗意愿成功,请耐心等待结果!"];
  2301. }
  2302. public function select_result(Request $request)
  2303. {
  2304. return view('app.recruit.select_result');
  2305. }
  2306. public function get_select_result(Request $request)
  2307. {
  2308. $redis = Cache::getRedis();
  2309. $quota = $redis->get('recruit_quota');
  2310. if(!$quota){
  2311. $quota = [
  2312. [
  2313. 'name' => '新塘街道',
  2314. 'value' => 13
  2315. ],
  2316. [
  2317. 'name' => '陈埭镇',
  2318. 'value' => 88
  2319. ],
  2320. [
  2321. 'name' => '池店镇',
  2322. 'value' => 10
  2323. ],
  2324. [
  2325. 'name' => '安海镇',
  2326. 'value' => 10
  2327. ],
  2328. [
  2329. 'name' => '磁灶镇',
  2330. 'value' => 21
  2331. ],
  2332. [
  2333. 'name' => '内坑镇',
  2334. 'value' => 22
  2335. ],
  2336. [
  2337. 'name' => '东石镇',
  2338. 'value' => 4
  2339. ],
  2340. [
  2341. 'name' => '永和镇',
  2342. 'value' => 27
  2343. ],
  2344. [
  2345. 'name' => '英林镇',
  2346. 'value' => 5
  2347. ],
  2348. [
  2349. 'name' => '金井镇',
  2350. 'value' => 13
  2351. ],
  2352. [
  2353. 'name' => '龙湖镇',
  2354. 'value' => 53
  2355. ],
  2356. [
  2357. 'name' => '深沪镇',
  2358. 'value' => 23
  2359. ],
  2360. [
  2361. 'name' => '西滨镇',
  2362. 'value' => 3
  2363. ]
  2364. ];
  2365. $redis->set('recruit_quota',json_encode($quota));
  2366. }else{
  2367. $quota = json_decode($quota,true);
  2368. }
  2369. $limit = $request->input('limit',1);
  2370. $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=2 and a.status=1')->select(['b.realname','c.ex_number','a.result','a.select_result','a.id'])->orderBy('record','desc')->limit($limit)->get();
  2371. $return_data = [
  2372. 'list' => []
  2373. ];
  2374. $array_column = array_column($quota,'name');
  2375. foreach ($list as $k => $v){
  2376. $person_select_result = json_decode($v->result,true);
  2377. $flag = 0;//是否择岗成功
  2378. foreach ($person_select_result as $val){
  2379. //寻找下标
  2380. $index = array_search($val,$array_column);
  2381. if($quota[$index]['value'] > 0){
  2382. $quota_data = [
  2383. 'index' => $index,
  2384. 'old_value' => $quota[$index]['value']
  2385. ];
  2386. //有名额允许择岗
  2387. DB::table('recruit_appoint_select')->where('id',$v->id)->update(['select_result'=>$val,'status' => 1]);
  2388. $v->select_result = $val;
  2389. $quota[$index]['value']--;
  2390. $quota_data['new_value'] = $quota[$index]['value'];
  2391. $redis->set('recruit_quota',json_encode($quota));
  2392. $flag = 1;
  2393. break;
  2394. }
  2395. }
  2396. if(!$flag){
  2397. $v->select_result = '未匹配到志愿,本轮择岗不成功!';
  2398. DB::table('recruit_appoint_select')->where('id',$v->id)->update(['select_result'=>'未匹配到志愿,本轮择岗不成功!','status' => -2]);
  2399. }
  2400. array_push($return_data['list'],$v);
  2401. }
  2402. $return_data['quota'] = $quota_data;
  2403. return ['status' => 1, 'msg' => '择岗排序成功', 'data' => $return_data];
  2404. }
  2405. public function select_init(Request $request)
  2406. {
  2407. $count = DB::table('recruit_appoint_select')->whereRaw('select_result is null and batch = 2')->count();
  2408. $redis = Cache::getRedis();
  2409. $quota = $redis->get('recruit_quota');
  2410. if(!$quota){
  2411. $quota = [
  2412. [
  2413. 'name' => '新塘街道',
  2414. 'value' => 13
  2415. ],
  2416. [
  2417. 'name' => '陈埭镇',
  2418. 'value' => 88
  2419. ],
  2420. [
  2421. 'name' => '池店镇',
  2422. 'value' => 10
  2423. ],
  2424. [
  2425. 'name' => '安海镇',
  2426. 'value' => 10
  2427. ],
  2428. [
  2429. 'name' => '磁灶镇',
  2430. 'value' => 21
  2431. ],
  2432. [
  2433. 'name' => '内坑镇',
  2434. 'value' => 22
  2435. ],
  2436. [
  2437. 'name' => '东石镇',
  2438. 'value' => 4
  2439. ],
  2440. [
  2441. 'name' => '永和镇',
  2442. 'value' => 27
  2443. ],
  2444. [
  2445. 'name' => '英林镇',
  2446. 'value' => 5
  2447. ],
  2448. [
  2449. 'name' => '金井镇',
  2450. 'value' => 13
  2451. ],
  2452. [
  2453. 'name' => '龙湖镇',
  2454. 'value' => 53
  2455. ],
  2456. [
  2457. 'name' => '深沪镇',
  2458. 'value' => 23
  2459. ],
  2460. [
  2461. 'name' => '西滨镇',
  2462. 'value' => 3
  2463. ]
  2464. ];
  2465. $redis->set('recruit_quota',json_encode($quota));
  2466. }
  2467. $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=2')->select(['b.realname','c.ex_number','a.result','a.select_result','a.id'])->orderBy('record','desc')->get();
  2468. return ['status' => 1, 'msg' => '获取初始化信息成功', 'data' => ['count' => $count, 'quota' => $quota, 'list' => $list]];
  2469. }
  2470. public function interviewer_random(Request $request)
  2471. {
  2472. $model = $request->input('model',1);
  2473. $number1 = $request->input('number1',5);//考官人数
  2474. $number2 = $request->input('number2',1);//替补人数
  2475. $where[] = ['id','>',0];
  2476. switch ($model){
  2477. case '0':
  2478. $list = DB::table('recruit_interviewer')->get()->toArray();
  2479. shuffle($list);
  2480. $result = array_slice($list, 0, $number1+$number2);
  2481. break;
  2482. case '1':
  2483. $list = DB::table('recruit_interviewer')->get()->toArray();
  2484. shuffle($list);
  2485. $count = $number1;
  2486. for ($i = 0; $i < $count; $i++){
  2487. if(!$list[$i]->status){
  2488. $list[] = $list[$i];
  2489. unset($list[$i]);
  2490. $count++;
  2491. }
  2492. }
  2493. $result = array_slice($list, 0, $number1+$number2);
  2494. break;
  2495. case '2':
  2496. $list = DB::table('recruit_interviewer')->where('status',1)->get()->toArray();
  2497. shuffle($list);
  2498. $result = array_slice($list, 0, $number1+$number2);
  2499. break;
  2500. default:
  2501. $list = DB::table('recruit_interviewer')->get()->toArray();
  2502. shuffle($list);
  2503. for ($i = 0; $i < $number1; $i++){
  2504. dd($list[$i]);
  2505. if(!$list[$i]->status){
  2506. $list[] = $list[$i];
  2507. unset($list[$i]);
  2508. }
  2509. }
  2510. $result = array_slice($list, 0, $number1+$number2);
  2511. break;
  2512. }
  2513. $return_data = [
  2514. 'list' => $result,
  2515. 'number1' => $number1,
  2516. 'number2' => $number2
  2517. ];
  2518. return view('app.recruit.interviewer', $return_data);
  2519. }
  2520. public function supplement_info(Request $request)
  2521. {
  2522. $user = $this->getUser();
  2523. if (!empty($user)) {
  2524. $uid = $user->id;
  2525. } else {
  2526. return redirect(route('login'));
  2527. }
  2528. //招考id
  2529. $id = $request->input('id', 0);
  2530. if (!$id) {
  2531. return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
  2532. }
  2533. $recruit = Recruit::find($id);
  2534. if(!$recruit['status']){
  2535. return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2536. }
  2537. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  2538. if(!$appoint_info){
  2539. return $this->showMessage('抱歉,您没有报名,无需补充信息!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2540. }
  2541. $supplement_info = DB::table("recruit_supplement_cunwu")->where('uid',$uid)->where('appoint_id',$appoint_info->id)->first();
  2542. if($supplement_info){
  2543. return $this->showMessage('您已登记信息,无需再次登记!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2544. }
  2545. $uids = [179049,179051,175896,177011,179015,179134,166830,179056,179110,179140,179040,179154,168701,149108,176405,176637,179182,179115,52845,179240,179036,170227,179286,179145,177121,169161,179282,179318,179173,179385,179287,175723,165156,179217,179085,179174,179441,179459,179448,179461,179476,170189,158658,162111,179504,177503,169950,173378,179571,179576,179548,175865,132228,168809,158464,150061,179594,169655,179311,168348,179131,179654,179664,179683,175855,179100,56968,179610,179146,179731,176717,179435,179669,175794,179487,176307,179806,179758,179555,179822,176249,179769,179815,179685,179856,179840,179828,179844,179376,169398,169530,170181,179799,179123,179652,179936,176102,179261,179957,179888,180033,180039,180050,180028,180064,180078,159819,180085,179987,177195,176790,175722,179933,176170,180122,176929,179872,180151,180123,176834,179547,179879,180196,170277,159623,179892,179904,180227,179952,180232,165930,179195,173624,180244,180277,180325,180321,180265,179871,179908,149297,179898,180407,180239,169158,175716,169910,180288,180452,162757,180309,180474,179266,164225,180465,169899,180098,175481,179306,180458,176454,180451,180507,180531,169591,180456,175467,180589,180587,180590,180601,179679,180597,180602,180604,175637,179830,165858,179835,180677,169304,180711,180234,180426,169691,176956,178303,170289,177028,179894,180311,176683,169720,150103,180705,176548,176655,180849,176101,180855,180808,180869,180348,180733,180889,180866,180399,180657,180920,180876,179701,152053,180208,175641,180831,169075,180980,180988,180991,180686,181016,181023,180974,152179,179284,181058,168483,177233,176619,181110,180809,180979,181122,180916,181142,180992,177427,181143,169886,147697,181173,181218,181041,181171,163107,180363,151296,169429,150164,181258,176891,56330,169740,181272,170078,177000,181317,180845,181303,180839,180983];//写死用户
  2546. if(!in_array($uid,$uids)){
  2547. return $this->showMessage('您无需登记信息!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2548. }
  2549. // $limit_time = 1661961599;
  2550. // $time = time();
  2551. // if( $time > $limit_time){
  2552. // return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2553. // }
  2554. $view_data = [];
  2555. //$view_data['info'] = json_encode($info);
  2556. $view_data['title'] = $recruit->company;
  2557. $view_data['id'] = $id;
  2558. return view('app.recruit.supplement_info',$view_data);
  2559. }
  2560. public function save_supplement_info(Request $request){
  2561. $user = $this->getUser();
  2562. if (!empty($user)) {
  2563. $uid = $user->id;
  2564. } else {
  2565. return redirect(route('login'));
  2566. }
  2567. //招考id
  2568. $id = $request->input('recruit_id', 0);
  2569. if (!$id) {
  2570. return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
  2571. }
  2572. $recruit = Recruit::find($id);
  2573. if(!$recruit['status']){
  2574. return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
  2575. }
  2576. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  2577. if(!$appoint_info){
  2578. return ['status' => 0, 'msg' => '抱歉,您没有报名,无需补充信息!', 'data' => ''];
  2579. }
  2580. if($request->input('marriage') == '已婚'){
  2581. if($request->input('spouse_card_type') == '' || $request->input('spouse_card') == '' || $request->input('spouse_realname') == '' || $request->input('spouse_mobile') == ''){
  2582. return ['status' => 0, 'msg' => '请完善配偶信息!', 'data' => ''];
  2583. }
  2584. }
  2585. $data = [
  2586. 'uid' => $uid,
  2587. 'appoint_id' => $appoint_info->id,
  2588. 'street' => $request->input('street'),
  2589. 'realname' => $request->input('realname'),
  2590. 'sex' => $request->input('sex'),
  2591. 'house' => $request->input('house'),
  2592. 'nation' => $request->input('nation'),
  2593. 'native' => $request->input('native'),
  2594. 'marriage' => $request->input('marriage'),
  2595. 'spouse_card_type' => $request->input('spouse_card_type'),
  2596. 'spouse_card' => $request->input('spouse_card'),
  2597. 'spouse_realname' => $request->input('spouse_realname'),
  2598. 'spouse_mobile' => $request->input('spouse_mobile'),
  2599. 'political' => $request->input('political'),
  2600. 'bank_card' => $request->input('bank_card'),
  2601. 'bank_open' => $request->input('bank_open'),
  2602. 'card' => $request->input('card'),
  2603. 'card_endtime' => $request->input('card_endtime'),
  2604. 'mobile' => $request->input('mobile'),
  2605. 'edu' => $request->input('education'),
  2606. 'pro' => $request->input('pro'),
  2607. 'address' => $request->input('address'),
  2608. 'funds' => $request->input('funds')
  2609. ];
  2610. DB::table('recruit_supplement_cunwu')->insert($data);
  2611. return ['status' => 1, 'msg' => '提交成功!', 'data' => ''];
  2612. }
  2613. public function comfirm_pen(Request $request){
  2614. $user = $this->getUser();
  2615. if (!empty($user)) {
  2616. $uid = $user->id;
  2617. } else {
  2618. return redirect(route('login'));
  2619. }
  2620. //招考id
  2621. $id = $request->input('recruit_id', 0);
  2622. if (!$id) {
  2623. return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
  2624. }
  2625. $recruit = Recruit::find($id);
  2626. if(!$recruit['status']){
  2627. return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
  2628. }
  2629. if(!$recruit->pen_comfirm){
  2630. return ['status' => 0, 'msg' => '该项目无须确认笔试考试!', 'data' => ''];
  2631. }
  2632. $appoint_info = RecruitAppointInfo::where('recruit_id',$id)->where('uid',$uid)->first();
  2633. if(!$appoint_info){
  2634. return ['status' => 0, 'msg' => '找不到您的报名记录,请检查!', 'data' => ''];
  2635. }
  2636. if($appoint_info->audit != 3){
  2637. return ['status' => 0, 'msg' => '您的报名未审核通过,无需确认!', 'data' => ''];
  2638. }
  2639. $time = time();
  2640. if(strtotime($recruit->pen_comfirm_start) > $time || strtotime($recruit->pen_comfirm_end) < $time){
  2641. return ['status' => 0, 'msg' => '未在笔试确认时间段!', 'data' => ''];
  2642. }
  2643. if($appoint_info->pen_audit != -2){
  2644. return ['status' => 0, 'msg' => '您已确认参加笔试,无需再次确认!', 'data' => ''];
  2645. }
  2646. $appoint_info->update(['pen_audit' => -1]);
  2647. $log = [
  2648. 'type' => 3,
  2649. 'appoint_id'=> $appoint_info->id,
  2650. 'uid' => $uid,
  2651. 'log' => '用户确认参加笔试'
  2652. ];
  2653. RecruitAppointLog::create($log);
  2654. return ['status' => 1, 'msg' => '确认成功', 'data' => $appoint_info->id];
  2655. }
  2656. public function supplementary_entry(Request $request){
  2657. $user = $this->getUser();
  2658. if (!empty($user)) {
  2659. $uid = $user->id;
  2660. } else {
  2661. return redirect(route('login'));
  2662. }
  2663. //招考id
  2664. $id = $request->input('recruit_id', 0);
  2665. if (!$id) {
  2666. return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
  2667. }
  2668. $recruit = Recruit::find($id);
  2669. if(!$recruit['status']){
  2670. return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
  2671. }
  2672. $appoint_info = RecruitAppointInfo::where('recruit_id',$id)->where('uid',$uid)->first();
  2673. if(!$appoint_info){
  2674. return ['status' => 0, 'msg' => '找不到您的报名记录,请检查!', 'data' => ''];
  2675. }
  2676. $time = time();
  2677. if($time > 1680969600){
  2678. return ['status' => 0, 'msg' => '已停止补充报名!', 'data' => ''];
  2679. }
  2680. if($appoint_info->adjust_limit){
  2681. $appoint_info->update(['adjust' => 1]);
  2682. return ['status' => 1, 'msg' => '补充报名成功!', 'data' => ''];
  2683. }else{
  2684. return ['status' => 0, 'msg' => '您无需补充报名!', 'data' => ''];
  2685. }
  2686. }
  2687. }