IndexController.php 134 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044
  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. if(strpos($special['condition'],',') !== false){
  474. $special['condition'] = explode(',',$special['condition']);
  475. }
  476. $material = json_decode($special['material'],true);
  477. if(is_array($material)){
  478. foreach ($material as $k => $v){
  479. if(array_key_exists('response',$v)){
  480. if(array_key_exists('path',$v['response'])){
  481. $material[$k]['url'] = $v['response']['path'];
  482. }
  483. }
  484. }
  485. }
  486. }else{
  487. $material = [];
  488. $special = [
  489. 'point_apply' => '0',
  490. 'condition' => ''
  491. ];
  492. }
  493. $user_info['special'] = [
  494. 'point_apply' => (string)$special['point_apply'],
  495. 'condition' => $special['condition'],
  496. 'material' => $material
  497. ];
  498. }
  499. if(in_array('detail',$forms)){
  500. $detail = RecruitAppointDetail::where('recruit_appoint_id',$user_info['id'])->first();
  501. if($detail){
  502. $user_info['detail'] = $detail->toArray();
  503. }else{
  504. $user_info['detail'] = [
  505. 'train' => '',
  506. 'rewards_and_punishments' => '',
  507. 'introduce' => ''
  508. ];
  509. }
  510. }
  511. //如果有身份证明模块
  512. if(in_array('identification',$forms)){
  513. if(json_decode($user_info['identification'])){
  514. $identification = json_decode($user_info['identification'],true);
  515. foreach ($identification as $k => $v){
  516. if(array_key_exists('response',$v)){
  517. if(array_key_exists('path',$v['response'])){
  518. $identification[$k]['url'] = $v['response']['path'];
  519. }
  520. }
  521. }
  522. }else{
  523. $identification = [];
  524. }
  525. $user_info['identification'] = $identification;
  526. }
  527. //如果有教育证明模块
  528. if(in_array('education_certification',$forms)){
  529. if(json_decode($user_info['education_certification'])){
  530. $education_certification = json_decode($user_info['education_certification'],true);
  531. foreach ($education_certification as $k => $v){
  532. if(array_key_exists('response',$v)){
  533. if(array_key_exists('path',$v['response'])){
  534. $education_certification[$k]['url'] = $v['response']['path'];
  535. }
  536. }
  537. }
  538. }else{
  539. $education_certification = [];
  540. }
  541. $user_info['education_certification'] = $education_certification;
  542. }
  543. //如果有其他证明模块
  544. if(in_array('other_certification',$forms)){
  545. if(json_decode($user_info['other_certification'])){
  546. $other_certification = json_decode($user_info['other_certification'],true);
  547. foreach ($other_certification as $k => $v){
  548. if(array_key_exists('response',$v)){
  549. if(array_key_exists('path',$v['response'])){
  550. $other_certification[$k]['url'] = $v['response']['path'];
  551. }
  552. }
  553. }
  554. }else{
  555. $other_certification = [];
  556. }
  557. $user_info['other_certification'] = $other_certification;
  558. }
  559. //如果有承诺书模块
  560. if(in_array('chengnuoshu',$forms)){
  561. if(json_decode($user_info['chengnuoshu'])){
  562. $chengnuoshu = json_decode($user_info['chengnuoshu'],true);
  563. foreach ($chengnuoshu as $k => $v){
  564. if(array_key_exists('response',$v)){
  565. if(array_key_exists('path',$v['response'])){
  566. $chengnuoshu[$k]['url'] = $v['response']['path'];
  567. }
  568. }
  569. }
  570. }else{
  571. $chengnuoshu = [];
  572. }
  573. $user_info['chengnuoshu'] = $chengnuoshu;
  574. }
  575. //如果有失信被执行人模块
  576. if(in_array('shixin',$forms)){
  577. if(json_decode($user_info['shixin'])){
  578. $shixin = json_decode($user_info['shixin'],true);
  579. foreach ($shixin as $k => $v){
  580. if(array_key_exists('response',$v)){
  581. if(array_key_exists('path',$v['response'])){
  582. $shixin[$k]['url'] = $v['response']['path'];
  583. }
  584. }
  585. }
  586. }else{
  587. $shixin = [];
  588. }
  589. $user_info['shixin'] = $shixin;
  590. }
  591. //如果有声明书模块
  592. if(in_array('baokaoshengming',$forms)){
  593. if(json_decode($user_info['baokaoshengming'])){
  594. $baokaoshengming = json_decode($user_info['baokaoshengming'],true);
  595. foreach ($baokaoshengming as $k => $v){
  596. if(array_key_exists('response',$v)){
  597. if(array_key_exists('path',$v['response'])){
  598. $baokaoshengming[$k]['url'] = $v['response']['path'];
  599. }
  600. }
  601. }
  602. }else{
  603. $baokaoshengming = [];
  604. }
  605. $user_info['baokaoshengming'] = $baokaoshengming;
  606. }
  607. //获取最新的报名审核信息
  608. $logs = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',2)->orderBy('created_at','desc')->first();
  609. if($logs){
  610. $user_info['audit_log'] = $logs->log;
  611. }else{
  612. $user_info['audit_log'] = '';
  613. }
  614. //获取提交报名的次数
  615. // $number = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',3)->count();
  616. // $post_number = $number+1;//todo
  617. }
  618. }
  619. else{
  620. //实习专场
  621. if(in_array('internship',$forms)){
  622. $user_info = json_encode([
  623. 'recruit_id' => $id,
  624. 'operation' => 1,
  625. 'realname' => '',
  626. 'sex' => '1',
  627. 'birthday' => '',
  628. 'card' => '',
  629. 'nation' => '',
  630. 'native_place' => '',
  631. 'political_affiliation' => '',
  632. 'join_time' => '',
  633. 'house_register' => '',
  634. 'education' => '',
  635. 'school' => '',
  636. 'pro' => '',
  637. 'adjust' => '',
  638. 'mobile' => '',
  639. 'email' => '',
  640. 'address' => '',
  641. 'post_id' => '',
  642. 'concat_name' => '',
  643. 'concat_mobile' => '',
  644. 'resume' => '',
  645. 'avatar' => '',
  646. 'family' => [
  647. [
  648. 'relation' => '',
  649. 'realname' => '',
  650. 'birthday' => '',
  651. 'political_affiliation' => '',
  652. 'work' => ''
  653. ]
  654. ],
  655. 'detail' => [
  656. 'rewards_and_punishments' => '',
  657. 'introduce' => ''
  658. ],
  659. 'identification' => [],
  660. 'education_certification' => [],
  661. 'other_certification' => [],
  662. 'chengnuoshu' => [],
  663. 'baokaoshengming' => [],
  664. 'shixin' => []
  665. ]);
  666. }else{
  667. //如果没有,结合基础数据及模块表单信息,制作数据对象
  668. $user_info = RecruitAppointBasic::where('uid',$uid)->first();
  669. if(!$user_info){
  670. //没有基础信息跳转完善route('person.recruitInfo')
  671. return $this->showMessage('请先完善招考基础信息!', route('recruit.recruitInfo',array('recruit_id',$id)), true, '上一页', '3');
  672. }
  673. $user_info['sex'] = (string)$user_info['sex'];
  674. $user_info['edu_type'] = (string)$user_info['edu_type'];
  675. $user_info['family'] = json_decode($user_info['family']);
  676. if(in_array('expand_special',$forms)){
  677. $user_info['special'] = [
  678. 'point_apply' => '0',
  679. 'condition' => '',
  680. 'material' => []
  681. ];
  682. }
  683. if(in_array('detail',$forms)){
  684. $user_info['detail'] = [
  685. 'train' => '',
  686. 'rewards_and_punishments' => '',
  687. 'introduce' => ''
  688. ];
  689. }
  690. if(in_array('identification',$forms)){
  691. $user_info['identification'] = [];
  692. }
  693. if(in_array('education_certification',$forms)){
  694. $user_info['education_certification'] = [];
  695. }
  696. if(in_array('other_certification',$forms)){
  697. $user_info['other_certification'] = [];
  698. }
  699. if(in_array('chengnuoshu',$forms)){
  700. $user_info['chengnuoshu'] = [];
  701. }
  702. if(in_array('shixin',$forms)){
  703. $user_info['shixin'] = [];
  704. }
  705. if(in_array('baokaoshengming',$forms)){
  706. $user_info['baokaoshengming'] = [];
  707. }
  708. $user_info['recruit_id'] = $id;
  709. $user_info['operation'] = 1;
  710. }
  711. }
  712. //招考岗位
  713. $where_post[] = ['recruit_id', '=', $id];
  714. $where_post[] = ['status', '=', 1];
  715. $recruit_post = RecruitPost::where($where_post)->get();
  716. $post = [];
  717. $post_limit = [];
  718. $post_special = [];
  719. foreach ($recruit_post as $value){
  720. $item = [
  721. 'value' => $value['id'],
  722. 'label' => $value['code'] . " " . $value['name']
  723. ];
  724. $post_limit[$value['id']] = json_decode($value['limit']);
  725. $post_special[$value['id']] = json_decode($value['special']);
  726. array_push($post,$item);
  727. }
  728. $view_data['appoint_info'] = $user_info;
  729. $view_data['post'] = json_encode($post);
  730. // $view_data['post_number'] = $post_number;
  731. // $view_data['post_times'] = $recruit['post_times'];
  732. $view_data['post_limit'] = json_encode($post_limit);
  733. $view_data['post_special'] = json_encode($post_special);
  734. $view_data['formDisable'] = $formDisabled;
  735. $view_data['title'] = $recruit->company;
  736. $view_data['special_condition_type'] = $recruit->special_condition_type;
  737. $view_data['special_condition_value'] = json_decode($recruit->special_condition_value,true);
  738. return view('app.recruit.sign_up',$view_data);
  739. }
  740. public function preview(Request $request)
  741. {
  742. $modules = $request->input('modules');
  743. $view_data['module'] = $forms = explode(',', $modules);
  744. return view('app.recruit.preview',$view_data);
  745. }
  746. /**
  747. * 提交报名的处理程序
  748. * @param Request $request
  749. * @return array|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\think\response\Redirect|void
  750. */
  751. public function saveSignUp(Request $request)
  752. {
  753. $user = $this->getUser();
  754. if (!empty($user)) {
  755. $uid = $user->id;
  756. } else {
  757. return redirect(route('login'));
  758. }
  759. $recruit_id = $request->input('recruit_id', 0);
  760. if (!$recruit_id) {
  761. return response()->json(['status' => 0,'msg' => '请选择项目!']);
  762. }
  763. $recruit = Recruit::find($recruit_id);
  764. // if(!$recruit['status']){
  765. // return response()->json(['status' => 0,'msg' => '抱歉,该项目状态不正确,请联系客服!']);
  766. // }
  767. if($recruit['current'] != 1 && $recruit['current'] != 2){
  768. return response()->json(['status' => 0,'msg' => '抱歉,该项目报名通道已关闭,如有疑问,请联系客服!']);
  769. }
  770. $card = $request->input('card');
  771. $appointinfo_exist = RecruitAppointInfo::where('card',$card)->where('uid','<>',$uid)->where('recruit_id',$recruit_id)->first();
  772. //兆丰建设两场公告二而一例外
  773. if($recruit_id == 25 || $recruit_id == 26){
  774. $special = RecruitAppointInfo::where('card',$card)->where('uid','<>',$uid)->whereIn('recruit_id',[25,26])->first();
  775. $appointinfo_exist = $appointinfo_exist & $special;
  776. }
  777. if($appointinfo_exist){
  778. return response()->json(['status' => 0,'msg' => '您的证件已有其他账号的报名记录,请检查!']);
  779. }
  780. $time = time();
  781. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  782. if(($time < strtotime($recruit['apply_start']) || strtotime($recruit['apply_end']) < $time)){//过了招考时间
  783. if(!$appoint_info){
  784. return response()->json(['status' => 0,'msg' => '抱歉,该项目已过报名时间!']);
  785. }
  786. if(($time < strtotime($recruit['audit_start']) || strtotime($recruit['audit_end']) < $time)){//过了审核时间
  787. return response()->json(['status' => 0,'msg' => '抱歉,该项目已过审核时间,无法继续报名!']);
  788. }
  789. //如果有报名记录,先查询首次报名是什么时候
  790. $first_post = RecruitAppointLog::where('type',3)->where('uid',$uid)->orderBy('created_at','asc')->first();
  791. if(!$first_post){//没有记录代表只是暂存
  792. return response()->json(['status' => 0,'msg' => '抱歉,该项目已过报名时间!']);
  793. }
  794. }
  795. $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');
  796. if(!array_key_exists('post_id',$data)){
  797. return response()->json(['status' => 0,'msg' => '请选择报考岗位']);
  798. }
  799. $post_info = RecruitPost::where('id',$data['post_id'])->where('recruit_id',$recruit_id)->first();
  800. if(!$post_info['status'] || $post_info['deleted_at'] != null){
  801. return response()->json(['status' => 0,'msg' => '该岗位已失效']);
  802. }
  803. //获取操作符,是暂存还是提交
  804. $operation = $request->input('operation');
  805. if($operation == 1){
  806. $data['audit'] = 0;//暂存
  807. }else{
  808. //基础信息的检查
  809. $rules = [
  810. 'realname' => 'required',
  811. 'sex' => 'required',
  812. 'birthday' => 'required',
  813. 'avatar' => 'required',
  814. 'nation' => 'required',
  815. 'native_place' => 'required',
  816. 'political_affiliation' => 'required',
  817. 'post_id' => 'required',
  818. 'house_register' => 'required',
  819. //'edu_type' => 'required',
  820. 'education' => 'required',
  821. 'school' => 'required',
  822. 'graduation' => 'required',
  823. 'address' => 'required',
  824. 'mobile' => 'required',
  825. 'email' => 'required',
  826. 'card' => 'required',
  827. 'concat_name' => 'required',
  828. 'concat_mobile' => 'required',
  829. 'resume' => 'required'
  830. ];
  831. $messages = [
  832. 'realname.required' => '请填写姓名',
  833. 'sex.required' => '请填写性别',
  834. 'birthday.required' => '请填写出生日期',
  835. 'avatar.required' => '请上传彩色免冠照',
  836. 'nation.required' => '请填写民族',
  837. 'native_place.required' => '请填写籍贯',
  838. 'political_affiliation.required' => '请选择政治面貌',
  839. 'post_id.required' => '请选择报名岗位',
  840. 'house_register.required' => '请填写户籍所在地',
  841. //'edu_type.required' => '请选择教育类型',
  842. 'education.required' => '请输入学历',
  843. 'school.required' => '请输入毕业院校',
  844. 'graduation.required' => '请填写毕业时间',
  845. 'address.required' => '请填写通信地址',
  846. 'mobile.required' => '请填写手机号码',
  847. 'email.required' => '请填写电子邮箱',
  848. 'card.required' => '请填写身份证号码',
  849. 'resume.required' => '请填写个人简历',
  850. 'concat_name.required' => '请填写联系人姓名',
  851. 'concat_mobile.required' => '请填写联系人手机号码'
  852. ];
  853. $create_data = $request->all();
  854. $validator = Validator::make($create_data,$rules,$messages);
  855. if ($validator->fails()) {
  856. $msg = $validator->errors()->all();
  857. return response()->json(['status' => 0,'msg' => $msg[0]]);
  858. }
  859. $data['audit'] = 1;//提交
  860. }
  861. if(strlen($data['card']) == 18){
  862. //身份证判断出生日期和性别
  863. $year = substr($data['card'],6,4);
  864. $month = substr($data['card'],10,2);
  865. $day = substr($data['card'],12,2);
  866. if($year.'-'.$month.'-'.$day != $data['birthday']){
  867. $data['birthday'] = $year.'-'.$month.'-'.$day;
  868. }
  869. if(intval(substr($data['card'],16,1)) % 2 == 0){
  870. $data['sex'] = 0;
  871. }else{
  872. $data['sex'] = 1;
  873. }
  874. }
  875. try{
  876. if(!empty($post_info['limit']) && json_decode($post_info['limit'])){
  877. //岗位限制条件的判断
  878. $post_limit = json_decode($post_info['limit'],true);
  879. if(is_array($post_limit)){
  880. foreach($post_limit as $k => $v){
  881. if($k == 'birthday'){
  882. $value = str_replace('-','',$data[$k]);
  883. }else{
  884. $value = $data[$k];
  885. }
  886. switch ($v['op']){
  887. case '=':
  888. if($value != $v['value']){
  889. return response()->json(['status' => 0,'msg' => $v['msg']]);
  890. }
  891. break;
  892. case '>':
  893. if($value <= $v['value']){
  894. return response()->json(['status' => 0,'msg' => $v['msg']]);
  895. }
  896. break;
  897. case '>=':
  898. if($value < $v['value']){
  899. return response()->json(['status' => 0,'msg' => $v['msg']]);
  900. }
  901. break;
  902. case '<':
  903. if($value >= $v['value']){
  904. return response()->json(['status' => 0,'msg' => $v['msg']]);
  905. }
  906. break;
  907. case '<=':
  908. if($value > $v['value']){
  909. return response()->json(['status' => 0,'msg' => $v['msg']]);
  910. }
  911. break;
  912. case '!=':
  913. if($value == $v['value']){
  914. return response()->json(['status' => 0,'msg' => $v['msg']]);
  915. }
  916. break;
  917. case 'like':
  918. if(strpos($value,$v['value']) === false){
  919. return response()->json(['status' => 0,'msg' => $v['msg']]);
  920. }
  921. break;
  922. case 'in':
  923. if(strpos($v['value'],$value) === false){
  924. return response()->json(['status' => 0,'msg' => $v['msg']]);
  925. }
  926. break;
  927. }
  928. }
  929. }
  930. }
  931. }catch (\Exception $e){
  932. error_log(serialize($data),3,'/data/wwwroot/jucai/sms');
  933. return ['status' => 0, 'msg' => '数据有误,请联系客服'];
  934. }
  935. //前置审核 判断完成,先将数据入报名信息基础表
  936. //解析家庭成员数据
  937. $familys = $request->input('family');
  938. $family = [];
  939. if(is_array($familys)){
  940. foreach ($familys as $value){
  941. $item = [
  942. 'relation' => $value['relation'],
  943. 'realname' => $value['realname'],
  944. 'birthday' => $value['birthday'],
  945. 'political_affiliation' => $value['political_affiliation'],
  946. 'work' => $value['work']
  947. ];
  948. array_push($family,$item);
  949. }
  950. }
  951. $forms = explode(',', $recruit['forms']);
  952. if(in_array('expand_special',$forms)){
  953. $special = $request->input('special');
  954. if($special['point_apply'] && is_array($special['condition']) && count($special['condition']) == 0){
  955. return response()->json(['status' => 0,'msg' => '加分条件不能为空']);
  956. }
  957. if($special['point_apply'] && ($special['condition'] == '' )){
  958. return response()->json(['status' => 0,'msg' => '加分条件不能为空']);
  959. }
  960. }
  961. $data['family'] = json_encode($family);
  962. if($appoint_info){
  963. //如果已有报名记录,进入修改阶段的处理流程
  964. DB::beginTransaction();
  965. try{
  966. RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->update($data);
  967. //分模块解析数据
  968. //如果有加分模块
  969. if(in_array('expand_special',$forms)){
  970. $special = $request->input('special');
  971. if($special['point_apply']){//如果申请加分
  972. if(!array_key_exists('material',$special)){
  973. return response()->json(['status' => 0,'msg' => '加分佐证材料不能为空!']);
  974. }
  975. //删除掉没有成功返回路径的图片
  976. if(is_array($special['material'])){
  977. foreach ($special['material'] as $k => $v){
  978. if(!array_key_exists('response',$v)){
  979. unset($special['material'][$k]);
  980. }
  981. }
  982. }
  983. switch ($recruit->special_condition_type){
  984. case 0:
  985. $special['point'] = 0;
  986. break;
  987. case 1:
  988. $special_rule = json_decode($recruit->special_condition_value,true);
  989. $conditions = array_column($special_rule['list'],'condition');
  990. $special['point'] = 0;
  991. if(array_key_exists('multi',$special_rule) && $special_rule['multi'] && is_array($special['condition'])){
  992. foreach ($special['condition'] as $v){
  993. $key = array_search($v,$conditions);
  994. $rule_info = $special_rule['list'][$key];
  995. $special['point'] += $rule_info['value'];
  996. }
  997. }else{
  998. $key = array_search($special['condition'],$conditions);
  999. $rule_info = $special_rule['list'][$key];
  1000. $special['point'] += $rule_info['value'];
  1001. }
  1002. break;
  1003. case 2:
  1004. $special_rule = json_decode($post_info['special'],true);
  1005. $conditions = array_column($special_rule['list'],'condition');
  1006. $special['point'] = 0;
  1007. if(array_key_exists('multi',$special_rule) && $special_rule['multi'] && is_array($special['condition'])){
  1008. foreach ($special['condition'] as $v){
  1009. $key = array_search($v,$conditions);
  1010. $rule_info = $special_rule['list'][$key];
  1011. $special['point'] += $rule_info['value'];
  1012. }
  1013. }else{
  1014. $key = array_search($special['condition'],$conditions);
  1015. $rule_info = $special_rule['list'][$key];
  1016. $special['point'] += $rule_info['value'];
  1017. }
  1018. break;
  1019. }
  1020. if(is_array($special['condition'])){
  1021. $special['condition'] = implode(',',$special['condition']);
  1022. }
  1023. $special['material'] = json_encode($special['material']);
  1024. $hasRecord = RecruitAppointExpandSpecial::where('recruit_appoint_id',$appoint_info->id)->first();
  1025. if($hasRecord){
  1026. RecruitAppointExpandSpecial::where('recruit_appoint_id',$appoint_info->id)->update($special);
  1027. }else{
  1028. $special['recruit_appoint_id'] = $appoint_info->id;
  1029. RecruitAppointExpandSpecial::create($special);
  1030. }
  1031. }
  1032. }
  1033. //如果有详情模块
  1034. if(in_array('detail',$forms) || in_array('internship',$forms)){
  1035. $detail = $request->input('detail');
  1036. $hasRecord = RecruitAppointDetail::where('recruit_appoint_id',$appoint_info->id)->first();
  1037. if($hasRecord){
  1038. RecruitAppointDetail::where('recruit_appoint_id',$appoint_info->id)->update($detail);
  1039. }else{
  1040. $detail['recruit_appoint_id'] = $appoint_info->id;
  1041. RecruitAppointDetail::create($detail);
  1042. }
  1043. }
  1044. //如果有身份证明模块
  1045. if(in_array('identification',$forms) || in_array('internship',$forms)){
  1046. $identification = $request->input('identification');
  1047. if(is_array($identification)){
  1048. //删除掉没有成功返回路径的图片
  1049. foreach ($identification as $k => $v){
  1050. if(!array_key_exists('response',$v)){
  1051. unset($identification[$k]);
  1052. }
  1053. }
  1054. }
  1055. $appoint_info->identification = json_encode($identification);
  1056. $appoint_info->save();
  1057. }
  1058. //如果有教育证明模块
  1059. if(in_array('education_certification',$forms) || in_array('internship',$forms)){
  1060. $education_certification = $request->input('education_certification');
  1061. if(is_array($education_certification)){
  1062. //删除掉没有成功返回路径的图片
  1063. foreach ($education_certification as $k => $v){
  1064. if(!array_key_exists('response',$v)){
  1065. unset($education_certification[$k]);
  1066. }
  1067. }
  1068. }
  1069. $appoint_info->education_certification = json_encode($education_certification);
  1070. $appoint_info->save();
  1071. }
  1072. //如果有其他证明模块
  1073. if(in_array('other_certification',$forms) || in_array('internship',$forms)){
  1074. $other_certification = $request->input('other_certification');
  1075. if(is_array($other_certification)){
  1076. //删除掉没有成功返回路径的图片
  1077. foreach ($other_certification as $k => $v){
  1078. if(!array_key_exists('response',$v)){
  1079. unset($other_certification[$k]);
  1080. }
  1081. }
  1082. }
  1083. if($other_certification){
  1084. $appoint_info->other_certification = json_encode($other_certification);
  1085. $appoint_info->save();
  1086. }
  1087. }
  1088. //如果有承诺书模块
  1089. if(in_array('chengnuoshu',$forms)){
  1090. $chengnuoshu = $request->input('chengnuoshu');
  1091. if(is_array($chengnuoshu)){
  1092. //删除掉没有成功返回路径的图片
  1093. foreach ($chengnuoshu as $k => $v){
  1094. if(!array_key_exists('response',$v)){
  1095. unset($chengnuoshu[$k]);
  1096. }
  1097. }
  1098. }
  1099. if($chengnuoshu){
  1100. $appoint_info->chengnuoshu = json_encode($chengnuoshu);
  1101. $appoint_info->save();
  1102. }
  1103. }
  1104. //如果有失信被执行人模块
  1105. if(in_array('shixin',$forms)){
  1106. $shixin = $request->input('shixin');
  1107. if(is_array($shixin)){
  1108. //删除掉没有成功返回路径的图片
  1109. foreach ($shixin as $k => $v){
  1110. if(!array_key_exists('response',$v)){
  1111. unset($shixin[$k]);
  1112. }
  1113. }
  1114. }
  1115. if($shixin){
  1116. $appoint_info->shixin = json_encode($shixin);
  1117. $appoint_info->save();
  1118. }
  1119. }
  1120. //如果有声明书模块
  1121. if(in_array('baokaoshengming',$forms)){
  1122. $baokaoshengming = $request->input('baokaoshengming');
  1123. if(is_array($baokaoshengming)){
  1124. //删除掉没有成功返回路径的图片
  1125. foreach ($baokaoshengming as $k => $v){
  1126. if(!array_key_exists('response',$v)){
  1127. unset($baokaoshengming[$k]);
  1128. }
  1129. }
  1130. }
  1131. if($baokaoshengming){
  1132. $appoint_info->baokaoshengming = json_encode($baokaoshengming);
  1133. $appoint_info->save();
  1134. }
  1135. }
  1136. DB::commit();
  1137. if($operation == 2){
  1138. $log = [
  1139. 'type' => 3,
  1140. 'appoint_id'=> $appoint_info->id,
  1141. 'uid' => $uid,
  1142. 'log' => '用户提交报名'
  1143. ];
  1144. RecruitAppointLog::create($log);
  1145. return ['status' => 1, 'msg' => '提交成功', 'data' => $appoint_info->id];
  1146. }else{
  1147. return ['status' => 1, 'msg' => '资料保存成功,请尽快完善并提交', 'data' => $appoint_info->id];
  1148. }
  1149. } catch (\Exception $e){
  1150. DB::rollback();
  1151. return ['status' => 0, 'msg' => $e->getMessage()];
  1152. }
  1153. }else{
  1154. //没有报名记录,进入增加阶段的处理流程
  1155. DB::beginTransaction();
  1156. try{
  1157. //20220726增加地区undefined选项处理
  1158. if($index = stripos($data['native_place'],',undefined')){
  1159. $data['native_place'] = substr($data['native_place'],0,$index);
  1160. }
  1161. if($index = stripos($data['house_register'],',undefined')){
  1162. $data['house_register'] = substr($data['house_register'],0,$index);
  1163. }
  1164. $data['uid'] = $uid;
  1165. $data['recruit_id'] = $recruit_id;
  1166. $result = RecruitAppointInfo::create($data);
  1167. //分模块解析数据
  1168. $forms = explode(',', $recruit['forms']);
  1169. //如果有加分模块
  1170. if(in_array('expand_special',$forms)){
  1171. $special = $request->input('special');
  1172. if($special['point_apply']){
  1173. if(is_array($special['material'])){
  1174. //删除掉没有成功返回路径的图片
  1175. foreach ($special['material'] as $k => $v){
  1176. if(!array_key_exists('response',$v)){
  1177. unset($special['material'][$k]);
  1178. }
  1179. }
  1180. }
  1181. switch ($recruit->special_condition_type){
  1182. case 0:
  1183. $special['point'] = 0;
  1184. break;
  1185. case 1:
  1186. $special_rule = json_decode($recruit->special_condition_value,true);
  1187. $conditions = array_column($special_rule['list'],'condition');
  1188. $special['point'] = 0;
  1189. if(array_key_exists('multi',$special_rule) && $special_rule['multi'] && is_array($special['condition'])){
  1190. foreach ($special['condition'] as $v){
  1191. $key = array_search($v,$conditions);
  1192. $rule_info = $special_rule['list'][$key];
  1193. $special['point'] += $rule_info['value'];
  1194. }
  1195. }else{
  1196. $key = array_search($special['condition'],$conditions);
  1197. $rule_info = $special_rule['list'][$key];
  1198. $special['point'] += $rule_info['value'];
  1199. }
  1200. break;
  1201. case 2:
  1202. $special_rule = json_decode($post_info['special'],true);
  1203. $conditions = array_column($special_rule['list'],'condition');
  1204. $special['point'] = 0;
  1205. if(array_key_exists('multi',$special_rule) && $special_rule['multi'] && is_array($special['condition'])){
  1206. foreach ($special['condition'] as $v){
  1207. $key = array_search($v,$conditions);
  1208. $rule_info = $special_rule['list'][$key];
  1209. $special['point'] += $rule_info['value'];
  1210. }
  1211. }else{
  1212. $key = array_search($special['condition'],$conditions);
  1213. $rule_info = $special_rule['list'][$key];
  1214. $special['point'] += $rule_info['value'];
  1215. }
  1216. break;
  1217. }
  1218. if(is_array($special['condition'])){
  1219. $special['condition'] = implode(',',$special['condition']);
  1220. }
  1221. $special['material'] = json_encode($special['material']);
  1222. $special['recruit_appoint_id'] = $result->id;
  1223. RecruitAppointExpandSpecial::create($special);
  1224. }
  1225. }
  1226. //如果有详情模块
  1227. if(in_array('detail',$forms) || in_array('internship',$forms)){
  1228. $detail = $request->input('detail');
  1229. $detail['recruit_appoint_id'] = $result->id;
  1230. RecruitAppointDetail::create($detail);
  1231. }
  1232. //如果有身份证明模块
  1233. if(in_array('identification',$forms) || in_array('internship',$forms)){
  1234. $identification = $request->input('identification');
  1235. if(is_array($identification)){
  1236. //删除掉没有成功返回路径的图片
  1237. foreach ($identification as $k => $v){
  1238. if(!array_key_exists('response',$v)){
  1239. unset($identification[$k]);
  1240. }
  1241. }
  1242. }
  1243. $result->identification = json_encode($identification);
  1244. $result->save();
  1245. }
  1246. //如果有教育证明模块
  1247. if(in_array('education_certification',$forms) || in_array('internship',$forms)){
  1248. $education_certification = $request->input('education_certification');
  1249. if(is_array($education_certification)){
  1250. //删除掉没有成功返回路径的图片
  1251. foreach ($education_certification as $k => $v){
  1252. if(!array_key_exists('response',$v)){
  1253. unset($education_certification[$k]);
  1254. }
  1255. }
  1256. }
  1257. $result->education_certification = json_encode($education_certification);
  1258. $result->save();
  1259. }
  1260. //如果有其他证明模块
  1261. if(in_array('other_certification',$forms) || in_array('internship',$forms)){
  1262. $other_certification = $request->input('other_certification');
  1263. if($other_certification){
  1264. if(is_array($other_certification)){
  1265. //删除掉没有成功返回路径的图片
  1266. foreach ($other_certification as $k => $v){
  1267. if(!array_key_exists('response',$v)){
  1268. unset($other_certification[$k]);
  1269. }
  1270. }
  1271. }
  1272. $result->other_certification = json_encode($other_certification);
  1273. $result->save();
  1274. }
  1275. }
  1276. //如果有承诺书模块
  1277. if(in_array('chengnuoshu',$forms)){
  1278. $chengnuoshu = $request->input('chengnuoshu');
  1279. if($chengnuoshu){
  1280. if(is_array($chengnuoshu)){
  1281. //删除掉没有成功返回路径的图片
  1282. foreach ($chengnuoshu as $k => $v){
  1283. if(!array_key_exists('response',$v)){
  1284. unset($chengnuoshu[$k]);
  1285. }
  1286. }
  1287. }
  1288. $result->chengnuoshu = json_encode($chengnuoshu);
  1289. $result->save();
  1290. }
  1291. }
  1292. //如果有失信被执行人模块
  1293. if(in_array('shixin',$forms)){
  1294. $shixin = $request->input('shixin');
  1295. if($shixin){
  1296. if(is_array($shixin)){
  1297. //删除掉没有成功返回路径的图片
  1298. foreach ($shixin as $k => $v){
  1299. if(!array_key_exists('response',$v)){
  1300. unset($shixin[$k]);
  1301. }
  1302. }
  1303. }
  1304. $result->shixin = json_encode($shixin);
  1305. $result->save();
  1306. }
  1307. }
  1308. //如果有声明书模块
  1309. if(in_array('baokaoshengming',$forms)){
  1310. $baokaoshengming = $request->input('baokaoshengming');
  1311. if($baokaoshengming){
  1312. if(is_array($baokaoshengming)){
  1313. //删除掉没有成功返回路径的图片
  1314. foreach ($baokaoshengming as $k => $v){
  1315. if(!array_key_exists('response',$v)){
  1316. unset($baokaoshengming[$k]);
  1317. }
  1318. }
  1319. }
  1320. $result->baokaoshengming = json_encode($baokaoshengming);
  1321. $result->save();
  1322. }
  1323. }
  1324. DB::commit();
  1325. if($operation == 2){
  1326. $log = [
  1327. 'type' => 3,
  1328. 'appoint_id'=> $result->id,
  1329. 'uid' => $uid,
  1330. 'log' => '用户首次提交报名'
  1331. ];
  1332. RecruitAppointLog::create($log);
  1333. return ['status' => 1, 'msg' => '提交成功', 'data' => $result->id];
  1334. }else{
  1335. return ['status' => 1, 'msg' => '资料保存成功,请尽快完善并提交', 'data' => $result->id];
  1336. }
  1337. } catch (\Exception $e){
  1338. DB::rollback();
  1339. return ['status' => 0, 'msg' => $e->getMessage()];
  1340. }
  1341. }
  1342. }
  1343. /**
  1344. * 获得当前登录的用户
  1345. * @return \Illuminate\Contracts\Auth\Authenticatable|null
  1346. */
  1347. public function getUser()
  1348. {
  1349. if (auth('web-member')->check()) {
  1350. $user = auth('web-member')->user();
  1351. } else {
  1352. $user = null;
  1353. }
  1354. return $user;
  1355. }
  1356. /**
  1357. * 检查用户基本信息
  1358. * @return array
  1359. */
  1360. public function checkUserBasicInfo()
  1361. {
  1362. $user = $this->getUser();
  1363. if (!empty($user)) {
  1364. $uid = $user->id;
  1365. } else {
  1366. $arr = ['status' => 401, 'msg'=>'请登录!'];
  1367. return $arr;
  1368. }
  1369. $info = RecruitAppointBasic::where('uid',$uid)->first();
  1370. if (empty($info)){
  1371. $arr = ['status'=>401,'msg'=>'请先完善招考基本信息','url'=> route('recruit.recruitInfo')];
  1372. return $arr;
  1373. }
  1374. return ['status' => 200, 'msg' => ''];
  1375. }
  1376. /**
  1377. * 个人中心招考页面
  1378. * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
  1379. */
  1380. public function person_recruit()
  1381. {
  1382. $user = auth('web-member')->user();
  1383. $list = RecruitAppointInfo::where('uid',$user->id)
  1384. ->join('recruit', 'recruit.id', '=', 'recruit_appoint_info.recruit_id', 'left')
  1385. ->join('recruit_post', 'recruit_post.id', '=', 'recruit_appoint_info.post_id', 'left')
  1386. ->select('recruit.name as recruit_name','recruit_appoint_info.*','recruit_post.code','recruit_post.name')
  1387. ->get();
  1388. return view('app.person.recruit')->with(['list' => $list,'total' => count($list)]);
  1389. }
  1390. /**
  1391. * 招考信息基础页
  1392. * @param Request $request
  1393. * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
  1394. */
  1395. public function recruit_info(Request $request)
  1396. {
  1397. $user = auth('web-member')->user();
  1398. if (!empty($user)) {
  1399. $uid = $user->id;
  1400. } else {
  1401. return redirect(route('login'));
  1402. }
  1403. $info = RecruitAppointBasic::where('uid',$user->id)->first();
  1404. if(!$info){
  1405. $info = [
  1406. 'realname' => '',
  1407. 'sex' => '0',
  1408. 'birthday' => '',
  1409. 'avatar' => '',
  1410. 'nation' => '',
  1411. 'native_place' => '',
  1412. 'political_affiliation' => '',
  1413. 'titles' => '',
  1414. 'work' => '',
  1415. 'house_register' => '',
  1416. 'join_time' => '',
  1417. 'edu_type' => '',
  1418. 'education' => '',
  1419. 'school' => '',
  1420. 'degree' => '',
  1421. 'pro' => '',
  1422. 'address' => '',
  1423. 'card' => '',
  1424. 'mobile' => '',
  1425. 'email' => '',
  1426. 'concat_name' => '',
  1427. 'concat_mobile' => '',
  1428. 'resume' => '',
  1429. 'family' => [
  1430. [
  1431. 'relation' => '',
  1432. 'realname' => '',
  1433. 'birthday' => '',
  1434. 'political_affiliation' => '',
  1435. 'work' => ''
  1436. ]
  1437. ],
  1438. 'is_push' => '1'
  1439. ];
  1440. }else{
  1441. $info->sex = (string)$info->sex;
  1442. $info->edu_type = (string)$info->edu_type;
  1443. $info->is_push = (string)$info->is_push;
  1444. $info->family = empty($info->family) ? [[
  1445. 'relation' => '',
  1446. 'realname' => '',
  1447. 'birthday' => '',
  1448. 'political_affiliation' => '',
  1449. 'work' => ''
  1450. ]] : json_decode($info->family);
  1451. }
  1452. $recruit_id = $request->input('recruit_id',0);
  1453. return view('app.person.recruit_info',[
  1454. 'info' => json_encode($info),
  1455. 'recruit_id'=> $recruit_id
  1456. ]);
  1457. }
  1458. /**
  1459. * 保存招考信息
  1460. * @param RecruitValidatorRequest $request
  1461. * @return \Illuminate\Http\JsonResponse
  1462. */
  1463. public function saveRecruitInfo(RecruitValidatorRequest $request)
  1464. {
  1465. $user = auth('web-member')->user();
  1466. $basic = RecruitAppointBasic::where('uid',$user->id)->first();
  1467. $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');
  1468. if(count($data['family']) > 0){
  1469. $data['family'] = json_encode($data['family']);
  1470. }
  1471. if($basic){
  1472. //更新基础信息
  1473. $res = RecruitAppointBasic::where('uid',$user->id)->update($data);
  1474. if (!$res) {
  1475. return response()->json(['status'=>0,'msg'=>'保存失败,请联系客服']);
  1476. }else{
  1477. return response()->json(['status'=>1,'msg'=>'个人基础信息保存成功,快去报名吧!']);
  1478. }
  1479. }else{
  1480. //新增基础信息
  1481. $data['uid'] = $user->id;
  1482. $res = RecruitAppointBasic::create($data);
  1483. if (!$res) {
  1484. return response()->json(['status'=>0,'msg'=>'保存失败,请联系客服']);
  1485. }else{
  1486. return response()->json(['status'=>1,'msg'=>'个人基础信息保存成功,快去报名吧!']);
  1487. }
  1488. }
  1489. }
  1490. /**
  1491. * 笔试准考证
  1492. * @param Request $request
  1493. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1494. */
  1495. public function pen_ticket(Request $request)
  1496. {
  1497. $user = $this->getUser();
  1498. if (!empty($user)) {
  1499. $uid = $user->id;
  1500. } else {
  1501. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1502. }
  1503. $recruit_id = $request->input('recruit_id');
  1504. $recruit = Recruit::where('id',$recruit_id)->first();
  1505. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  1506. if($appoint_info){
  1507. $pen_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',1)->first();
  1508. if($pen_ticket){
  1509. $health = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
  1510. if((!$health || $health->h_status == 0) && $recruit->pen_epidemic){
  1511. return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
  1512. }
  1513. $time = time();
  1514. if(strtotime($pen_ticket->ex_start) < $time && strtotime($pen_ticket->ex_end) > $time){
  1515. RecruitTicket::where('appoint_id',$appoint_info->id)->update(['ex_status' => 1]);
  1516. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1517. $name = $recruit->name_en;
  1518. $date = date("Y-m-d",strtotime($recruit->created_at));
  1519. //$filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
  1520. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1521. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/pen/" . $filename . '.pdf';
  1522. if(file_exists($file)){
  1523. header('Content-Description: File Transfer');
  1524. header('Content-Type: application/octet-stream');
  1525. header('Content-Disposition: attachment; filename='.basename($file));
  1526. header('Content-Transfer-Encoding: binary');
  1527. header('Expires: 0');
  1528. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1529. header('Pragma: public');
  1530. header('Content-Length: ' . filesize($file));
  1531. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1532. flush();
  1533. readfile($file);
  1534. }else{
  1535. return $this->showMessage('准考证不存在,请联系管理员!', route('home'), true, '上一页', '3');
  1536. }
  1537. }else{
  1538. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1539. }
  1540. }else{
  1541. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1542. }
  1543. }else{
  1544. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1545. }
  1546. }
  1547. /**
  1548. * 审核准考证
  1549. * @param Request $request
  1550. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1551. */
  1552. public function check_ticket(Request $request)
  1553. {
  1554. $user = $this->getUser();
  1555. if (!empty($user)) {
  1556. $uid = $user->id;
  1557. } else {
  1558. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1559. }
  1560. $recruit_id = $request->input('recruit_id');
  1561. $recruit = Recruit::where('id',$recruit_id)->first();
  1562. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  1563. if($appoint_info){
  1564. $check_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',2)->first();
  1565. if($check_ticket){
  1566. $health = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
  1567. if((!$health || $health->h_status == 0) && $recruit->pen_epidemic){
  1568. return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
  1569. }$time = time();
  1570. if(strtotime($check_ticket->ex_start) < $time && strtotime($check_ticket->ex_end) > $time){
  1571. RecruitTicket::where('id',$check_ticket->id)->update(['ex_status' => 1]);
  1572. $recruit = Recruit::where('id',$recruit_id)->first();
  1573. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1574. $name = $recruit->name_en;
  1575. $date = date("Y-m-d",strtotime($recruit->created_at));
  1576. //$filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
  1577. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1578. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/computer/" . $filename . '.pdf';
  1579. if(file_exists($file)){
  1580. header('Content-Description: File Transfer');
  1581. header('Content-Type: application/octet-stream');
  1582. header('Content-Disposition: attachment; filename='.basename($file));
  1583. header('Content-Transfer-Encoding: binary');
  1584. header('Expires: 0');
  1585. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1586. header('Pragma: public');
  1587. header('Content-Length: ' . filesize($file));
  1588. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1589. flush();
  1590. readfile($file);
  1591. }
  1592. }else{
  1593. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1594. }
  1595. }else{
  1596. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1597. }
  1598. }else{
  1599. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1600. }
  1601. }
  1602. /**
  1603. * 面试准考证
  1604. * @param Request $request
  1605. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1606. */
  1607. public function face_ticket(Request $request)
  1608. {
  1609. $user = $this->getUser();
  1610. if (!empty($user)) {
  1611. $uid = $user->id;
  1612. } else {
  1613. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1614. }
  1615. $recruit_id = $request->input('recruit_id');
  1616. $recruit = Recruit::where('id',$recruit_id)->first();
  1617. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  1618. if($appoint_info){
  1619. $face_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',3)->first();
  1620. if($face_ticket){
  1621. $health = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
  1622. if((!$health || $health->h_status == 0) && $recruit->pen_epidemic){
  1623. return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
  1624. }$time = time();
  1625. if(strtotime($face_ticket->ex_start) < $time && strtotime($face_ticket->ex_end) > $time){
  1626. RecruitTicket::where('id',$face_ticket->id)->update(['ex_status' => 1]);
  1627. $recruit = Recruit::where('id',$recruit_id)->first();
  1628. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1629. $name = $recruit->name_en;
  1630. $date = date("Y-m-d",strtotime($recruit->created_at));
  1631. //$filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
  1632. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1633. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/face/" . $filename . '.pdf';
  1634. if(file_exists($file)){
  1635. header('Content-Description: File Transfer');
  1636. header('Content-Type: application/octet-stream');
  1637. header('Content-Disposition: attachment; filename='.basename($file));
  1638. header('Content-Transfer-Encoding: binary');
  1639. header('Expires: 0');
  1640. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1641. header('Pragma: public');
  1642. header('Content-Length: ' . filesize($file));
  1643. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1644. flush();
  1645. readfile($file);
  1646. }
  1647. }else{
  1648. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1649. }
  1650. }else{
  1651. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1652. }
  1653. }else{
  1654. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1655. }
  1656. }
  1657. /**
  1658. * 复试准考证
  1659. * @param Request $request
  1660. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1661. */
  1662. public function reexamine_ticket(Request $request)
  1663. {
  1664. $user = $this->getUser();
  1665. if (!empty($user)) {
  1666. $uid = $user->id;
  1667. } else {
  1668. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1669. }
  1670. $recruit_id = $request->input('recruit_id');
  1671. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  1672. if($appoint_info){
  1673. $reexamine_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',4)->first();
  1674. if($reexamine_ticket){
  1675. $time = time();
  1676. if(strtotime($reexamine_ticket->ex_start) < $time && strtotime($reexamine_ticket->ex_end) > $time){
  1677. RecruitTicket::where('id',$reexamine_ticket->id)->update(['ex_status' => 1]);
  1678. $recruit = Recruit::where('id',$recruit_id)->first();
  1679. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1680. $name = $recruit->name_en;
  1681. $date = date("Y-m-d",strtotime($recruit->created_at));
  1682. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1683. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/reexamine/" . $filename . '.pdf';
  1684. if(file_exists($file)){
  1685. header('Content-Description: File Transfer');
  1686. header('Content-Type: application/octet-stream');
  1687. header('Content-Disposition: attachment; filename='.basename($file));
  1688. header('Content-Transfer-Encoding: binary');
  1689. header('Expires: 0');
  1690. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1691. header('Pragma: public');
  1692. header('Content-Length: ' . filesize($file));
  1693. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1694. flush();
  1695. readfile($file);
  1696. }
  1697. }else{
  1698. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1699. }
  1700. }else{
  1701. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1702. }
  1703. }else{
  1704. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1705. }
  1706. }
  1707. /**
  1708. * 材料补登
  1709. * @param Request $request
  1710. */
  1711. public function material_supplement(Request $request)
  1712. {
  1713. $user = $this->getUser();
  1714. if (!empty($user)) {
  1715. $uid = $user->id;
  1716. } else {
  1717. return redirect(route('login'));
  1718. }
  1719. //招考id
  1720. $id = $request->input('id', 0);
  1721. if (!$id) {
  1722. return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
  1723. }
  1724. $recruit = Recruit::find($id);
  1725. if(!$recruit['status'] && !$user->recruit_test){
  1726. return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1727. }
  1728. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  1729. if(!$appoint_info){
  1730. return $this->showMessage('抱歉,您没有报名,无需考察审核!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1731. }
  1732. if($appoint_info->pen_audit != 1){
  1733. return $this->showMessage('抱歉,您未入闱,无需考察审核!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1734. }
  1735. $limit_time = 1694683800;
  1736. $time = time();
  1737. if( $time > $limit_time){
  1738. return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1739. }
  1740. $info = RecruitSupplement::where('appoint_id',$appoint_info->id)->where('type','supplement')->first();
  1741. if(!$info){
  1742. $info = [
  1743. 'appoint_id' => $appoint_info->id,
  1744. 'identification' => '',
  1745. //'household_register' => '',
  1746. //'education_certification' => '',
  1747. //'family_planning' => '',
  1748. 'chengxin' => '',
  1749. 'manage' => '',
  1750. 'status' => 3
  1751. ];
  1752. }else{
  1753. $info = $info->toArray();
  1754. if(json_decode($info['identification'])){
  1755. $identification = json_decode($info['identification'],true);
  1756. foreach ($identification as $k => $v){
  1757. if(array_key_exists('response',$v)){
  1758. $identification[$k]['url'] = $v['response']['path'];
  1759. }
  1760. }
  1761. }else{
  1762. $identification = [];
  1763. }
  1764. $info['identification'] = $identification;
  1765. if(json_decode($info['household_register'])){
  1766. $household_register = json_decode($info['household_register'],true);
  1767. foreach ($household_register as $k => $v){
  1768. if(array_key_exists('response',$v)){
  1769. $household_register[$k]['url'] = $v['response']['path'];
  1770. }
  1771. }
  1772. }else{
  1773. $household_register = [];
  1774. }
  1775. $info['household_register'] = $household_register;
  1776. if(json_decode($info['education_certification'])){
  1777. $education_certification = json_decode($info['education_certification'],true);
  1778. foreach ($education_certification as $k => $v){
  1779. if(array_key_exists('response',$v)){
  1780. $education_certification[$k]['url'] = $v['response']['path'];
  1781. }
  1782. }
  1783. }else{
  1784. $education_certification = [];
  1785. }
  1786. $info['education_certification'] = $education_certification;
  1787. if(json_decode($info['family_planning'])){
  1788. $family_planning = json_decode($info['family_planning'],true);
  1789. foreach ($family_planning as $k => $v){
  1790. if(array_key_exists('response',$v)){
  1791. $family_planning[$k]['url'] = $v['response']['path'];
  1792. }
  1793. }
  1794. }else{
  1795. $family_planning = [];
  1796. }
  1797. $info['family_planning'] = $family_planning;
  1798. if(json_decode($info['chengxin'])){
  1799. $chengxin = json_decode($info['chengxin'],true);
  1800. foreach ($chengxin as $k => $v){
  1801. if(array_key_exists('response',$v)){
  1802. $chengxin[$k]['url'] = $v['response']['path'];
  1803. }
  1804. }
  1805. }else{
  1806. $chengxin = [];
  1807. }
  1808. $info['chengxin'] = $chengxin;
  1809. if(json_decode($info['manage'])){
  1810. $manage = json_decode($info['manage'],true);
  1811. foreach ($manage as $k => $v){
  1812. if(array_key_exists('response',$v)){
  1813. $manage[$k]['url'] = $v['response']['path'];
  1814. }
  1815. }
  1816. }else{
  1817. $manage = [];
  1818. }
  1819. $info['manage'] = $manage;
  1820. }
  1821. $view_data['info'] = json_encode($info);
  1822. $view_data['title'] = $recruit->company;
  1823. return view('app.recruit.supplement',$view_data);
  1824. }
  1825. /**
  1826. * 健康信息登记
  1827. * @param Request $request
  1828. */
  1829. public function health_info(Request $request)
  1830. {
  1831. $user = $this->getUser();
  1832. if (!empty($user)) {
  1833. $uid = $user->id;
  1834. } else {
  1835. return redirect(route('login'));
  1836. }
  1837. //招考id
  1838. $id = $request->input('id', 0);
  1839. if (!$id) {
  1840. return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
  1841. }
  1842. $recruit = Recruit::find($id);
  1843. if(!$recruit['status'] && !$user->recruit_test){
  1844. return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1845. }
  1846. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  1847. if(!$appoint_info){
  1848. return $this->showMessage('抱歉,您没有报名,无需登记!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1849. }
  1850. if($appoint_info->audit != 3){
  1851. return $this->showMessage('抱歉,您无需登记!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1852. }
  1853. $time = time();
  1854. $type = $request->input('type',null);
  1855. $where = [];
  1856. if($type){
  1857. switch ($type){
  1858. case 'pen':
  1859. $start = strtotime($recruit->pen_health_start);
  1860. $end = strtotime($recruit->pen_health_end);
  1861. break;
  1862. case 'computer':
  1863. $start = strtotime($recruit->computer_health_start);
  1864. $end = strtotime($recruit->computer_health_end);
  1865. break;
  1866. case 'face':
  1867. $start = strtotime($recruit->face_health_start);
  1868. $end = strtotime($recruit->face_health_end);
  1869. break;
  1870. case 'reexamine':
  1871. $start = strtotime($recruit->reexamine_health_start);
  1872. $end = strtotime($recruit->reexamine_health_end);
  1873. break;
  1874. default:
  1875. $start = strtotime($recruit->supplement_start);
  1876. $end = strtotime($recruit->supplement_end);
  1877. break;
  1878. }
  1879. $where[] = ['type', '=', $type];
  1880. }else{
  1881. $start = strtotime($recruit->supplement_start);
  1882. $end = strtotime($recruit->supplement_end);
  1883. }
  1884. if($time > $end || $time < $start){
  1885. return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1886. }
  1887. $where[] = ['appoint_id', '=', $appoint_info->id];
  1888. $info = RecruitSupplement::where($where)->first();
  1889. if(!$info){
  1890. $info = [
  1891. 'appoint_id' => $appoint_info->id,
  1892. 'health_code' => '',
  1893. 'trip_code' => '',
  1894. 'type' => $type
  1895. ];
  1896. }else{
  1897. $info = $info->toArray();
  1898. if(json_decode($info['health_code'])){
  1899. $health_code = json_decode($info['health_code'],true);
  1900. foreach ($health_code as $k => $v){
  1901. if(array_key_exists('response',$v)){
  1902. $health_code[$k]['url'] = $v['response']['path'];
  1903. }
  1904. }
  1905. }else{
  1906. $health_code = [];
  1907. }
  1908. $info['health_code'] = $health_code;
  1909. if(json_decode($info['trip_code'])){
  1910. $trip_code = json_decode($info['trip_code'],true);
  1911. foreach ($trip_code as $k => $v){
  1912. if(array_key_exists('response',$v)){
  1913. $trip_code[$k]['url'] = $v['response']['path'];
  1914. }
  1915. }
  1916. }else{
  1917. $trip_code = [];
  1918. }
  1919. $info['trip_code'] = $trip_code;
  1920. }
  1921. $view_data['info'] = json_encode($info);
  1922. $view_data['title'] = $recruit->company;
  1923. return view('app.recruit.health',$view_data);
  1924. }
  1925. public function save_supplement(Request $request)
  1926. {
  1927. $user = $this->getUser();
  1928. if (!empty($user)) {
  1929. $uid = $user->id;
  1930. } else {
  1931. return redirect(route('login'));
  1932. }
  1933. $limit_time = 1694683800;
  1934. $time = time();
  1935. if( $time > $limit_time){
  1936. return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',38)), true, '上一页', '3');
  1937. }
  1938. $appoint_id = $request->input('appoint_id');
  1939. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',38)->where('id',$appoint_id)->first();
  1940. if(!$appoint_info){
  1941. return ['status' => 0, 'msg' => '抱歉,找不到您要补登的报名记录!'];
  1942. }
  1943. $info = RecruitSupplement::where('appoint_id',$appoint_id)->where('type','supplement')->first();
  1944. if($info){
  1945. if($info->status == 1){
  1946. return ['status' => 0, 'msg' => '材料已审核通过,不允许修改'];
  1947. }
  1948. if($info->status == 0){
  1949. return ['status' => 0, 'msg' => '材料审核中,不允许修改'];
  1950. }
  1951. //身份证明
  1952. $identification = $request->input('identification');
  1953. if(is_array($identification)){
  1954. //删除掉没有成功返回路径的图片
  1955. foreach ($identification as $k => $v){
  1956. if(!array_key_exists('response',$v)){
  1957. unset($identification[$k]);
  1958. }
  1959. }
  1960. }
  1961. $info->identification = json_encode($identification);
  1962. //户口簿
  1963. $household_register = $request->input('household_register');
  1964. if(is_array($household_register)){
  1965. //删除掉没有成功返回路径的图片
  1966. foreach ($household_register as $k => $v){
  1967. if(!array_key_exists('response',$v)){
  1968. unset($household_register[$k]);
  1969. }
  1970. }
  1971. }
  1972. $info->household_register = json_encode($household_register);
  1973. //学信网
  1974. $education_certification = $request->input('education_certification');
  1975. if(is_array($education_certification)){
  1976. //删除掉没有成功返回路径的图片
  1977. foreach ($education_certification as $k => $v){
  1978. if(!array_key_exists('response',$v)){
  1979. unset($education_certification[$k]);
  1980. }
  1981. }
  1982. }
  1983. $info->education_certification = json_encode($education_certification);
  1984. //计生
  1985. // $family_planning = $request->input('family_planning');
  1986. // if(is_array($family_planning)){
  1987. // //删除掉没有成功返回路径的图片
  1988. // foreach ($family_planning as $k => $v){
  1989. // if(!array_key_exists('response',$v)){
  1990. // unset($family_planning[$k]);
  1991. // }
  1992. // }
  1993. // }
  1994. // $info->family_planning = json_encode($family_planning);
  1995. //失信查询 情况
  1996. $chengxin = $request->input('chengxin');
  1997. if(is_array($chengxin)){
  1998. //删除掉没有成功返回路径的图片
  1999. foreach ($chengxin as $k => $v){
  2000. if(!array_key_exists('response',$v)){
  2001. unset($chengxin[$k]);
  2002. }
  2003. }
  2004. }
  2005. $info->chengxin = json_encode($chengxin);
  2006. //综治
  2007. $manage = $request->input('manage');
  2008. if(is_array($manage)){
  2009. //删除掉没有成功返回路径的图片
  2010. foreach ($manage as $k => $v){
  2011. if(!array_key_exists('response',$v)){
  2012. unset($manage[$k]);
  2013. }
  2014. }
  2015. }
  2016. $info->manage = json_encode($manage);
  2017. $info->status = 0;
  2018. $info->save();
  2019. $appoint_info->political_audit = 4;
  2020. $appoint_info->save();
  2021. return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
  2022. }else{
  2023. $data['appoint_id'] = $appoint_id;
  2024. //身份证明
  2025. $identification = $request->input('identification');
  2026. if(is_array($identification)){
  2027. //删除掉没有成功返回路径的图片
  2028. foreach ($identification as $k => $v){
  2029. if(!array_key_exists('response',$v)){
  2030. unset($identification[$k]);
  2031. }
  2032. }
  2033. }
  2034. $data['identification'] = json_encode($identification);
  2035. //户口簿
  2036. $household_register = $request->input('household_register');
  2037. if(is_array($household_register)){
  2038. //删除掉没有成功返回路径的图片
  2039. foreach ($household_register as $k => $v){
  2040. if(!array_key_exists('response',$v)){
  2041. unset($household_register[$k]);
  2042. }
  2043. }
  2044. }
  2045. $data['household_register'] = json_encode($household_register);
  2046. //学信网
  2047. $education_certification = $request->input('education_certification');
  2048. if(is_array($education_certification)){
  2049. //删除掉没有成功返回路径的图片
  2050. foreach ($education_certification as $k => $v){
  2051. if(!array_key_exists('response',$v)){
  2052. unset($education_certification[$k]);
  2053. }
  2054. }
  2055. }
  2056. $data['education_certification'] = json_encode($education_certification);
  2057. //计生
  2058. // $family_planning = $request->input('family_planning');
  2059. // if(is_array($family_planning)){sp
  2060. // //删除掉没有成功返回路径的图片
  2061. // foreach ($family_planning as $k => $v){
  2062. // if(!array_key_exists('response',$v)){
  2063. // unset($family_planning[$k]);
  2064. // }
  2065. // }
  2066. // }
  2067. // $data['family_planning'] = json_encode($family_planning);
  2068. //失信查询 情况
  2069. $chengxin = $request->input('chengxin');
  2070. if(is_array($chengxin)){
  2071. //删除掉没有成功返回路径的图片
  2072. foreach ($chengxin as $k => $v){
  2073. if(!array_key_exists('response',$v)){
  2074. unset($chengxin[$k]);
  2075. }
  2076. }
  2077. }
  2078. $data['chengxin'] = json_encode($chengxin);
  2079. //综治
  2080. $manage = $request->input('manage');
  2081. if(is_array($manage)){
  2082. //删除掉没有成功返回路径的图片
  2083. foreach ($manage as $k => $v){
  2084. if(!array_key_exists('response',$v)){
  2085. unset($manage[$k]);
  2086. }
  2087. }
  2088. }
  2089. $data['manage'] = json_encode($manage);
  2090. $data['status'] = 0;
  2091. $data['type'] = 'supplement';
  2092. $result = RecruitSupplement::create($data);
  2093. $appoint_info->political_audit = 4;
  2094. $appoint_info->save();
  2095. return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
  2096. }
  2097. return ['status' => 0, 'msg' => 'test', 'data' => ''];
  2098. }
  2099. public function save_healthinfo(Request $request)
  2100. {
  2101. $user = $this->getUser();
  2102. if (!empty($user)) {
  2103. $uid = $user->id;
  2104. } else {
  2105. return redirect(route('login'));
  2106. }
  2107. $appoint_id = $request->input('appoint_id');
  2108. $type = $request->input('type');
  2109. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('id',$appoint_id)->first();
  2110. if(!$appoint_info){
  2111. return ['status' => 0, 'msg' => '抱歉,找不到您要登记的报名记录!'];
  2112. }
  2113. $recruit = Recruit::where('id',$appoint_info->recruit_id)->first();
  2114. $info = RecruitSupplement::where('appoint_id',$appoint_id)->where('type',$type)->first();
  2115. if($info){
  2116. if($info->h_status == 1){
  2117. return ['status' => 0, 'msg' => '材料已审核通过,不允许修改'];
  2118. }
  2119. if($info->h_status == 0){
  2120. return ['status' => 0, 'msg' => '材料审核中,不允许修改'];
  2121. }
  2122. $health_code = $request->input('health_code');
  2123. if(is_array($health_code)){
  2124. //删除掉没有成功返回路径的图片
  2125. foreach ($health_code as $k => $v){
  2126. if(!array_key_exists('response',$v)){
  2127. unset($health_code[$k]);
  2128. }
  2129. }
  2130. }
  2131. $info->health_code = json_encode($health_code);
  2132. $trip_code = $request->input('trip_code');
  2133. if(is_array($trip_code)){
  2134. //删除掉没有成功返回路径的图片
  2135. foreach ($trip_code as $k => $v){
  2136. if(!array_key_exists('response',$v)){
  2137. unset($trip_code[$k]);
  2138. }
  2139. }
  2140. }
  2141. $info->trip_code = json_encode($trip_code);
  2142. $info->h_status = 0;
  2143. $appoint_info->health_audit = 4;
  2144. $appoint_info->save();
  2145. $info->save();
  2146. return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
  2147. }else{
  2148. $data['appoint_id'] = $appoint_id;
  2149. $data['type'] = $type;
  2150. $data['h_status'] = 0;
  2151. $appoint_info->health_audit = 4;
  2152. $health_code = $request->input('health_code');
  2153. if(is_array($health_code)){
  2154. //删除掉没有成功返回路径的图片
  2155. foreach ($health_code as $k => $v){
  2156. if(!array_key_exists('response',$v)){
  2157. unset($health_code[$k]);
  2158. }
  2159. }
  2160. }
  2161. $health_result = $this->baiduService->health_code(file_get_contents(base_path() . "/public" . $health_code[0]['response']['path']));
  2162. $health_msg = ['健康码自动审核通过'];
  2163. //$h_status = 1;
  2164. //$appoint_info->health_audit = 1;
  2165. if(!array_key_exists('error_msg',$health_result) && !array_key_exists('error_code',$health_result)){
  2166. if(array_key_exists('姓名',$health_result)){
  2167. if(stripos($health_result['姓名'][0]['word'],'*')>0){
  2168. return ['status' => 0, 'msg' => '请打开健康码的“眼睛开关”,显示完整个人信息'];
  2169. }
  2170. if($health_result['姓名'][0]['word'] != $appoint_info->realname){
  2171. array_push($health_msg,'抱歉,请上传您本人的健康码!');
  2172. }
  2173. }else{
  2174. array_push($health_msg,'健康码错误,识别不到姓名!');
  2175. }
  2176. if(array_key_exists('状态',$health_result)){
  2177. if($health_result['状态'][0]['word'] != '绿码'){
  2178. array_push($health_msg,'抱歉,您的健康码非绿码!');
  2179. }
  2180. }else{
  2181. array_push($health_msg,'健康码错误,识别不到状态!');
  2182. }
  2183. if(array_key_exists('更新时间',$health_result)){
  2184. $time = strtotime($health_result['更新时间'][0]['word']);
  2185. if($time < strtotime($recruit->pen_health_start) || $time > strtotime($recruit->pen_health_end)){
  2186. array_push($health_msg,'抱歉,请上传{$recruit->pen_health_start}至{$recruit->pen_health_end}之间的健康码!');
  2187. }
  2188. }else{
  2189. array_push($health_msg,'健康码错误,识别不到时间!');
  2190. }
  2191. //$data['h_status'] = $h_status;
  2192. $data['h_msg'] = implode(';',$health_msg);
  2193. //$appoint_info->health_audit = $h_status == 1 ? 1 : 4;
  2194. $data['health_code'] = json_encode($health_code);
  2195. }
  2196. $data['health_result'] = json_encode($health_result);
  2197. $trip_code = $request->input('trip_code');
  2198. if(is_array($trip_code)){
  2199. //删除掉没有成功返回路径的图片
  2200. foreach ($trip_code as $k => $v){
  2201. if(!array_key_exists('response',$v)){
  2202. unset($trip_code[$k]);
  2203. }
  2204. }
  2205. }
  2206. $trip_result = $this->baiduService->trip_code(file_get_contents(base_path() . "/public" . $trip_code[0]['response']['path']));
  2207. $trip_msg = [];
  2208. $trip_status = 0;
  2209. if(!array_key_exists('error_msg',$trip_result) && !array_key_exists('error_code',$trip_result)){
  2210. if(array_key_exists('途经地',$trip_result['result'])){
  2211. $fangyi_area = explode("\r\n",config('aix.fangyi.fangyi_zhaokao.fangyi_zhaokao.risk_area'));
  2212. $result = array_intersect($fangyi_area,$trip_result['result']['途经地'][0]['word']);
  2213. if(count($result) > 0){
  2214. array_push($trip_msg,'抱歉,您的行程中包含系统设置中高风险地区!');
  2215. $trip_status = 0;
  2216. }
  2217. }
  2218. if(array_key_exists('风险性',$trip_result['result']) && $trip_result['result']['风险性']){
  2219. array_push($trip_msg,'抱歉,您的行程可能含有风险!');
  2220. $trip_status = 0;
  2221. }
  2222. if(array_key_exists('更新时间',$trip_result['result'])){
  2223. $time = strtotime($trip_result['result']['更新时间'][0]['word'][0]);
  2224. if($time > strtotime($recruit->pen_health_start) || $recruit < ($recruit->pen_health_end)){
  2225. array_push($trip_msg,'抱歉,请上传{$recruit->pen_health_start}至{$recruit->pen_health_end}之间的行程码!');
  2226. $trip_status = 0;
  2227. }
  2228. }
  2229. $data['h_msg'] .= implode(';',$trip_msg);
  2230. }
  2231. $data['trip_result'] = json_encode($trip_result);
  2232. $data['trip_code'] = json_encode($trip_code);
  2233. $data['h_status'] = 0;
  2234. $appoint_info->health_audit = 4;
  2235. RecruitSupplement::create($data);
  2236. $appoint_info->save();
  2237. return ['status' => 1, 'msg' => '提交成功,请刷新查看审核结果', 'data' => ''];
  2238. }
  2239. return ['status' => 0, 'msg' => 'test', 'data' => ''];
  2240. }
  2241. public function post_select(Request $request)
  2242. {
  2243. $user = $this->getUser();
  2244. if (!empty($user)) {
  2245. $uid = $user->id;
  2246. } else {
  2247. return redirect(route('login'));
  2248. }
  2249. $recruit_id = $request->input('recruit_id');
  2250. //$appoint_id = $request->input('appoint_id');
  2251. $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  2252. if(!$info){
  2253. return $this->showMessage('抱歉,您无需择岗!', route('recruit.show',array('id',$recruit_id)), true, '上一页', '2');
  2254. }
  2255. //手动设置择岗时间段
  2256. $time = time();
  2257. if($time > 1695096000 || $time < 1694998800){
  2258. //if($time > 1694491200){
  2259. return $this->showMessage('抱歉,未到择岗时间!', route('recruit.show',array('id',$recruit_id)), true, '上一页', '2');
  2260. }
  2261. if($info->type == 1){
  2262. $option_list = [
  2263. [
  2264. 'id' => 1,
  2265. 'name' => '陈埭镇'
  2266. ],
  2267. [
  2268. 'id' => 2,
  2269. 'name' => '池店镇'
  2270. ],
  2271. [
  2272. 'id' => 3,
  2273. 'name' => '金井镇'
  2274. ],
  2275. [
  2276. 'id' => 4,
  2277. 'name' => '龙湖镇'
  2278. ]
  2279. ];
  2280. }else{
  2281. $option_list = [
  2282. [
  2283. 'id' => 5,
  2284. 'name' => '陈埭镇'
  2285. ],
  2286. [
  2287. 'id' => 6,
  2288. 'name' => '金井镇'
  2289. ],
  2290. [
  2291. 'id' => 7,
  2292. 'name' => '龙湖镇'
  2293. ]
  2294. ];
  2295. }
  2296. $select_list = [];
  2297. if($info->result){
  2298. $result = json_decode($info->result,true);
  2299. foreach ($result as $v){
  2300. $item['name'] = $v;
  2301. array_push($select_list,$item);
  2302. }
  2303. }
  2304. // $recruit_id = $request->input('recruit_id');
  2305. // $appoint_id = $request->input('appoint_id');
  2306. // $uid = $request->input('uid');
  2307. // $info = RecruitAppointSelect::where('uid',$uid)->first();
  2308. // if(!$info){
  2309. // $info = new \stdClass();
  2310. // $info->status = 0;
  2311. // $info->recruit_id = 8;
  2312. // $info->appoint_id = rand(0,999999);
  2313. // $info->uid = rand(0,999999);
  2314. // }else{
  2315. // $result = json_decode($info->result,true);
  2316. // foreach ($option_list as $k => $v){
  2317. // if(in_array($v['name'],$result)){
  2318. // $select_list[$k] = $v;
  2319. // unset($option_list[$k]);
  2320. // }
  2321. // }
  2322. // }
  2323. $view_data = ['info' => $info,'options_list' => json_encode($option_list),'select_list' => json_encode($select_list)];
  2324. return view('app.recruit.post_select',$view_data);
  2325. }
  2326. /**
  2327. * 放弃择岗
  2328. */
  2329. public function give_up_post(Request $request)
  2330. {
  2331. //以下为测试环境
  2332. // $recruit_id = $request->input('recruit_id');
  2333. // $appoint_id = $request->input('appoint_id');
  2334. // $uid = $request->input('uid');
  2335. // $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->where('appoint_id',$appoint_id)->first();
  2336. // if($info){
  2337. // return ['status' => 0, 'msg' => "测试数据重复,请重新点击生成测试数据!"];
  2338. // }
  2339. // RecruitAppointSelect::create(['recruit_id'=>$recruit_id,'appoint_id'=>$appoint_id,'uid'=>$uid,'status'=>-1]);
  2340. // return ['status' => 1, 'msg' => "放弃择岗成功!"];
  2341. //以下为正式环境再放开
  2342. $user = $this->getUser();
  2343. if (!empty($user)) {
  2344. $uid = $user->id;
  2345. } else {
  2346. return redirect(route('login'));
  2347. }
  2348. $recruit_id = $request->input('recruit_id');
  2349. $appoint_id = $request->input('appoint_id');
  2350. $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->where('appoint_id',$appoint_id)->first();
  2351. if($info == null){
  2352. return ['status' => 0, 'msg' => "抱歉,您无需择岗!"];
  2353. }
  2354. if($info->status != 0){
  2355. return ['status' => 0, 'msg' => "抱歉,您不是待择岗状态!"];
  2356. }
  2357. $info->status = -1;
  2358. $info->save();
  2359. return ['status' => 1, 'msg' => "放弃择岗成功!"];
  2360. }
  2361. public function comfirm_post(Request $request)
  2362. {
  2363. $user = $this->getUser();
  2364. if (!empty($user)) {
  2365. $uid = $user->id;
  2366. } else {
  2367. return redirect(route('login'));
  2368. }
  2369. $recruit_id = $request->input('recruit_id');
  2370. $appoint_id = $request->input('appoint_id');
  2371. $time = time();
  2372. if($time > 1695096000 || $time < 1694998800){
  2373. return ['status' => 0, 'msg' => "抱歉,未到择岗时间!"];
  2374. }
  2375. $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->where('appoint_id',$appoint_id)->first();
  2376. if($info->result){
  2377. return ['status' => 0, 'msg' => "择岗数据已提交!"];
  2378. }
  2379. // $data = [
  2380. // 'recruit_id' => $recruit_id,
  2381. // 'appoint_id' => $recruit_id,
  2382. // 'uid' => $uid,
  2383. // 'status' => 1
  2384. // ];
  2385. $result = [];
  2386. $select = $request->input('select');
  2387. if(is_array($select) && count($select) > 0){
  2388. foreach ($select as $v) {
  2389. array_push($result,$v['name']);
  2390. }
  2391. }
  2392. $info->result = json_encode($result);
  2393. $info->status = 1;
  2394. $info->save();
  2395. return ['status' => 1, 'msg' => "提交择岗意愿成功,请耐心等待结果!"];
  2396. }
  2397. public function select_result(Request $request)
  2398. {
  2399. return view('app.recruit.select_result');
  2400. }
  2401. public function get_select_result(Request $request)
  2402. {
  2403. $redis = Cache::getRedis();
  2404. $quota = $redis->get('recruit_quotaA');
  2405. if(!$quota){
  2406. $quota = [
  2407. [
  2408. 'name' => '陈埭镇',
  2409. 'value' => 2
  2410. ],
  2411. [
  2412. 'name' => '池店镇',
  2413. 'value' => 1
  2414. ],
  2415. [
  2416. 'name' => '金井镇',
  2417. 'value' => 2
  2418. ],
  2419. [
  2420. 'name' => '龙湖镇',
  2421. 'value' => 2
  2422. ]
  2423. ];
  2424. $redis->set('recruit_quotaA',json_encode($quota));
  2425. }else{
  2426. $quota = json_decode($quota,true);
  2427. }
  2428. $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=3 and a.type=2 and a.status=1 and a.id > 1262')->select(['b.realname','c.ex_number','a.result','a.select_result','a.id','a.record','a.record2','a.record3'])->orderBy('record','desc')->orderBy('record2','desc')->orderBy('record3','desc')->limit(2)->get()->toArray();
  2429. $return_data = [
  2430. 'list' => []
  2431. ];
  2432. $array_column = array_column($quota,'name');
  2433. if(count($list) > 1){
  2434. $current = $list[0];
  2435. $next = $list[1];
  2436. }else{
  2437. $current = $list[0];
  2438. $next = false;
  2439. }
  2440. $person_select_result = json_decode($current->result,true);
  2441. $flag = 0;//是否择岗成功
  2442. foreach ($person_select_result as $val){
  2443. //寻找下标
  2444. $index = array_search($val,$array_column);
  2445. if($quota[$index]['value']){
  2446. if($next && $current->record == $next->record && $current->record2 == $next->record2 && $current->record3 == $next->record3 && $quota[$index]['value'] == 1){
  2447. //如果当前处理人员不是最后一个,且分数与下一名人员三个维度完全一样的话并且该人员欲择的岗位仅剩一位,则特殊处理
  2448. //查找同样分数人同样志愿
  2449. $next_select_result = json_decode($next->result,true);
  2450. //寻找下标
  2451. $current_index = array_search($val,$person_select_result);
  2452. $next_index = array_search($val,$next_select_result);
  2453. if($current_index > $next_index){
  2454. //如果当前人员对当前镇街的意向排序大于下一人,调换两个指针,先排序下一个人
  2455. $current = $next;
  2456. }
  2457. }
  2458. $quota_data = [
  2459. 'index' => $index,
  2460. 'old_value' => $quota[$index]['value']
  2461. ];
  2462. //有名额允许择岗
  2463. DB::table('recruit_appoint_select')->where('id',$current->id)->update(['select_result'=>$val,'status' => 1]);
  2464. $current->select_result = $val;
  2465. $quota[$index]['value']--;
  2466. $quota_data['new_value'] = $quota[$index]['value'];
  2467. $redis->set('recruit_quotaA',json_encode($quota));
  2468. $flag = 1;
  2469. break;
  2470. }
  2471. }
  2472. if(!$flag){
  2473. $current->select_result = '未匹配到志愿,本轮择岗不成功!';
  2474. DB::table('recruit_appoint_select')->where('id',$current->id)->update(['select_result'=>'未匹配到志愿,本轮择岗不成功!','status' => -2]);
  2475. }
  2476. $return_data['quota'] = $quota_data;
  2477. return ['status' => 1, 'msg' => '择岗排序成功', 'data' => $return_data];
  2478. }
  2479. public function select_init(Request $request)
  2480. {
  2481. $count = DB::table('recruit_appoint_select')->whereRaw('select_result is null and batch = 3 and type = 2')->count();
  2482. $redis = Cache::getRedis();
  2483. $quotaA = $redis->get('recruit_quotaA');
  2484. $quotaB = $redis->get('recruit_quotaB');
  2485. if(!$quotaA){
  2486. $quotaA = [
  2487. [
  2488. 'name' => '梅岭街道',
  2489. 'value' => 3
  2490. ],
  2491. [
  2492. 'name' => '西园街道',
  2493. 'value' => 3
  2494. ],
  2495. [
  2496. 'name' => '罗山街道',
  2497. 'value' => 3
  2498. ],
  2499. [
  2500. 'name' => '新塘街道',
  2501. 'value' => 3
  2502. ],
  2503. [
  2504. 'name' => '陈埭镇',
  2505. 'value' => 10
  2506. ],
  2507. [
  2508. 'name' => '池店镇',
  2509. 'value' => 7
  2510. ],
  2511. [
  2512. 'name' => '安海镇',
  2513. 'value' => 5
  2514. ],
  2515. [
  2516. 'name' => '内坑镇',
  2517. 'value' => 3
  2518. ],
  2519. [
  2520. 'name' => '金井镇',
  2521. 'value' => 3
  2522. ],
  2523. [
  2524. 'name' => '龙湖镇',
  2525. 'value' => 5
  2526. ],
  2527. [
  2528. 'name' => '经济开发区',
  2529. 'value' => 5
  2530. ]
  2531. ];
  2532. $redis->set('recruit_quota',json_encode($quotaA));
  2533. }
  2534. if(!$quotaB){
  2535. $quotaB = [
  2536. [
  2537. 'name' => '青阳街道',
  2538. 'value' => 7
  2539. ],
  2540. [
  2541. 'name' => '梅岭街道',
  2542. 'value' => 14
  2543. ],
  2544. [
  2545. 'name' => '西园街道',
  2546. 'value' => 11
  2547. ],
  2548. [
  2549. 'name' => '罗山街道',
  2550. 'value' => 7
  2551. ],
  2552. [
  2553. 'name' => '灵源街道',
  2554. 'value' => 3
  2555. ],
  2556. [
  2557. 'name' => '新塘街道',
  2558. 'value' => 13
  2559. ],
  2560. [
  2561. 'name' => '陈埭镇',
  2562. 'value' => 49
  2563. ],
  2564. [
  2565. 'name' => '池店镇',
  2566. 'value' => 23
  2567. ],
  2568. [
  2569. 'name' => '安海镇',
  2570. 'value' => 16
  2571. ],
  2572. [
  2573. 'name' => '磁灶镇',
  2574. 'value' => 2
  2575. ],
  2576. [
  2577. 'name' => '内坑镇',
  2578. 'value' => 4
  2579. ],
  2580. [
  2581. 'name' => '紫帽镇',
  2582. 'value' => 8
  2583. ],
  2584. [
  2585. 'name' => '永和镇',
  2586. 'value' => 5
  2587. ],
  2588. [
  2589. 'name' => '金井镇',
  2590. 'value' => 11
  2591. ],
  2592. [
  2593. 'name' => '龙湖镇',
  2594. 'value' => 41
  2595. ],
  2596. [
  2597. 'name' => '经济开发区',
  2598. 'value' => 18
  2599. ]
  2600. ];
  2601. $redis->set('recruit_quota',json_encode($quotaB));
  2602. }
  2603. $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=3 and type = 2')->select(['b.realname','c.ex_number','a.result','a.select_result','a.id'])->orderBy('record','desc')->get();
  2604. return ['status' => 1, 'msg' => '获取初始化信息成功', 'data' => ['count' => $count, 'quota' => $quotaB, 'list' => $list]];
  2605. }
  2606. public function interviewer_random(Request $request)
  2607. {
  2608. $model = $request->input('model',1);
  2609. $number1 = $request->input('number1',5);//考官人数
  2610. $number2 = $request->input('number2',1);//替补人数
  2611. $where[] = ['id','>',0];
  2612. switch ($model){
  2613. case '0':
  2614. $list = DB::table('recruit_interviewer')->get()->toArray();
  2615. shuffle($list);
  2616. $result = array_slice($list, 0, $number1+$number2);
  2617. break;
  2618. case '1':
  2619. $list = DB::table('recruit_interviewer')->get()->toArray();
  2620. shuffle($list);
  2621. $count = $number1;
  2622. for ($i = 0; $i < $count; $i++){
  2623. if(!$list[$i]->status){
  2624. $list[] = $list[$i];
  2625. unset($list[$i]);
  2626. $count++;
  2627. }
  2628. }
  2629. $result = array_slice($list, 0, $number1+$number2);
  2630. break;
  2631. case '2':
  2632. $list = DB::table('recruit_interviewer')->where('status',1)->get()->toArray();
  2633. shuffle($list);
  2634. $result = array_slice($list, 0, $number1+$number2);
  2635. break;
  2636. default:
  2637. $list = DB::table('recruit_interviewer')->get()->toArray();
  2638. shuffle($list);
  2639. for ($i = 0; $i < $number1; $i++){
  2640. dd($list[$i]);
  2641. if(!$list[$i]->status){
  2642. $list[] = $list[$i];
  2643. unset($list[$i]);
  2644. }
  2645. }
  2646. $result = array_slice($list, 0, $number1+$number2);
  2647. break;
  2648. }
  2649. $return_data = [
  2650. 'list' => $result,
  2651. 'number1' => $number1,
  2652. 'number2' => $number2
  2653. ];
  2654. return view('app.recruit.interviewer', $return_data);
  2655. }
  2656. public function supplement_info(Request $request)
  2657. {
  2658. $user = $this->getUser();
  2659. if (!empty($user)) {
  2660. $uid = $user->id;
  2661. } else {
  2662. return redirect(route('login'));
  2663. }
  2664. //招考id
  2665. $id = $request->input('id', 0);
  2666. if (!$id) {
  2667. return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
  2668. }
  2669. $recruit = Recruit::find($id);
  2670. if(!$recruit['status']){
  2671. return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2672. }
  2673. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  2674. if(!$appoint_info){
  2675. return $this->showMessage('抱歉,您没有报名,无需补充信息!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2676. }
  2677. $supplement_info = DB::table("recruit_supplement_cunwu")->where('uid',$uid)->where('appoint_id',$appoint_info->id)->first();
  2678. if($supplement_info){
  2679. return $this->showMessage('您已登记信息,无需再次登记!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2680. }
  2681. $uids = [175698,175640,187343,158515,185998,186897,56876,180291,175734,187360,187347,187363,175508,187404,169182,187405,187406,179068,58932,169152,187421,185406,187419,168483,180769,187422,135137,187431,150399,187463,187454,180390,176017,187453,187471,187476,180462,187491,187449,169250,187445,186533,187429,187506,184540,187507,187372,187499,176069,187474,170770,187526,187528,149125,164284,170348,161536,186851,186462,170172,187467,187548,186199,147272,182911,179796,187569,187564,176818,169793,169989,187573,187579,187567,181274,152152,176154,187586,187594,187588,187596,179863,187593,187592,169380,187600,187605,179957,187603,187504,187522,187555,161945,187609,187608,170213,187614,176312,148985,179435,160517,187633,149312,149994,187650,187658,187661,161344,180791,184787,185337,179788,159539,185460,187692,187685,187679,180008,187539,187691,187683,186033,187703,187711,159619,187710,187704,173451,56533,185753,187705,187644,187719,150600,187708,187733,187736,187350,183256,180982,169082,175616,187761,187715,187730,56447,176797,187769,187540,176257,187777,175910,187639,187758,178526,187656,187796,187800,171911,187792,187803,171602,169578,187626,187827,187826,177179,149524,187831,187837,187362,149658,184568,169782,187853,176867,187861,187862,187863,187866,158774,187815,187869,187847,149975,187886,187551,187893,187190,187901,151626,187903,187907,176864,187906,159018,187904,187910,187774,187525,187897,186187,187524,187939,150646,187942,187717,187508,187950,176623,187958,187954,187783,187971,176995,180392,187973,176469,187978,169920,187992,176152,187986,184657,188010,185534,187998,187834,188009,188015,159122,176594,188001,175956,188005,188008,188033,188037,187489,188013,180655,188025,187856,188041,185341,187546,187374,187851,187518,188061,188085,188087,176061,188069,187967,170717,187627,152012,188063,188055,188083,188088,188086,188096,188099,179321,188108,177043,176786,188116,186426,188118,188091,188124,188121,188134,170275,188152,187595,188077,176503,188159,187328,188171,179081,188170,164941,188175,188133,169656,176514,188188,176878,181132,177136,188196,188204,165360,185372,151294,188213,188214,180151,149174,161161,185382,177239,188227,188229,177067,188234,188235,188233,158546,188240,188093,164832,188251,188247,188263,169813,188271,188268,169848,188259,188075,188181,188232,175899,188281,180695,187395,188292,188296,180333,176745,148688,188309,188299,177212,188321,188315,188324,188325,188207,188327,184727,188014,188316,161818,151015,188320,169465,186085,188341,188350,170397,186261,168661,188355,188332,188367,188368,179322,188337,187920,173737,175692,188374,162742,168949,187970,185738,158599,188381,188392,188396,185476,186998,182607,188416,175767,184318,188158,186714,188410,188425,188431,188445,188423,188439,187527,146401,188453,188450,188442,56388,165708,188469,188474,181053,188167,188485,188419,184938,185496,188286,56417,185739,188501,188514,188460,188193,188466,180702,188497,187239,167536,159831,169610,188535,187908];//写死用户
  2682. if(!in_array($uid,$uids)){
  2683. return $this->showMessage('您无需登记信息!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2684. }
  2685. // $limit_time = 1661961599;
  2686. // $time = time();
  2687. // if( $time > $limit_time){
  2688. // return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2689. // }
  2690. $view_data = [];
  2691. //$view_data['info'] = json_encode($info);
  2692. $view_data['title'] = $recruit->company;
  2693. $view_data['id'] = $id;
  2694. return view('app.recruit.supplement_info',$view_data);
  2695. }
  2696. public function save_supplement_info(Request $request){
  2697. $user = $this->getUser();
  2698. if (!empty($user)) {
  2699. $uid = $user->id;
  2700. } else {
  2701. return redirect(route('login'));
  2702. }
  2703. //招考id
  2704. $id = $request->input('recruit_id', 0);
  2705. if (!$id) {
  2706. return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
  2707. }
  2708. $recruit = Recruit::find($id);
  2709. if(!$recruit['status']){
  2710. return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
  2711. }
  2712. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  2713. if(!$appoint_info){
  2714. return ['status' => 0, 'msg' => '抱歉,您没有报名,无需补充信息!', 'data' => ''];
  2715. }
  2716. if($request->input('marriage') == '已婚'){
  2717. if($request->input('spouse_card_type') == '' || $request->input('spouse_card') == '' || $request->input('spouse_realname') == '' || $request->input('spouse_mobile') == ''){
  2718. return ['status' => 0, 'msg' => '请完善配偶信息!', 'data' => ''];
  2719. }
  2720. }
  2721. $data = [
  2722. 'uid' => $uid,
  2723. 'appoint_id' => $appoint_info->id,
  2724. 'street' => $request->input('street'),
  2725. 'realname' => $request->input('realname'),
  2726. 'sex' => $request->input('sex'),
  2727. 'house' => $request->input('house'),
  2728. 'nation' => $request->input('nation'),
  2729. 'native' => $request->input('native'),
  2730. 'marriage' => $request->input('marriage'),
  2731. 'spouse_card_type' => $request->input('spouse_card_type'),
  2732. 'spouse_card' => $request->input('spouse_card'),
  2733. 'spouse_realname' => $request->input('spouse_realname'),
  2734. 'spouse_mobile' => $request->input('spouse_mobile'),
  2735. 'political' => $request->input('political'),
  2736. 'bank_card' => $request->input('bank_card'),
  2737. 'bank_open' => $request->input('bank_open'),
  2738. 'card' => $request->input('card'),
  2739. 'card_endtime' => $request->input('card_endtime'),
  2740. 'mobile' => $request->input('mobile'),
  2741. 'edu' => $request->input('education'),
  2742. 'pro' => $request->input('pro'),
  2743. 'address' => $request->input('address'),
  2744. 'funds' => $request->input('funds')
  2745. ];
  2746. DB::table('recruit_supplement_cunwu')->insert($data);
  2747. return ['status' => 1, 'msg' => '提交成功!', 'data' => ''];
  2748. }
  2749. public function comfirm_pen(Request $request){
  2750. $user = $this->getUser();
  2751. if (!empty($user)) {
  2752. $uid = $user->id;
  2753. } else {
  2754. return redirect(route('login'));
  2755. }
  2756. //招考id
  2757. $id = $request->input('recruit_id', 0);
  2758. if (!$id) {
  2759. return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
  2760. }
  2761. $recruit = Recruit::find($id);
  2762. if(!$recruit['status']){
  2763. return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
  2764. }
  2765. if(!$recruit->pen_comfirm){
  2766. return ['status' => 0, 'msg' => '该项目无须确认笔试考试!', 'data' => ''];
  2767. }
  2768. $appoint_info = RecruitAppointInfo::where('recruit_id',$id)->where('uid',$uid)->first();
  2769. if(!$appoint_info){
  2770. return ['status' => 0, 'msg' => '找不到您的报名记录,请检查!', 'data' => ''];
  2771. }
  2772. if($appoint_info->audit != 3){
  2773. return ['status' => 0, 'msg' => '您的报名未审核通过,无需确认!', 'data' => ''];
  2774. }
  2775. $time = time();
  2776. if(strtotime($recruit->pen_comfirm_start) > $time || strtotime($recruit->pen_comfirm_end) < $time){
  2777. return ['status' => 0, 'msg' => '未在笔试确认时间段!', 'data' => ''];
  2778. }
  2779. if($appoint_info->pen_audit != -2){
  2780. return ['status' => 0, 'msg' => '您已确认参加笔试,无需再次确认!', 'data' => ''];
  2781. }
  2782. $appoint_info->update(['pen_audit' => -1]);
  2783. $log = [
  2784. 'type' => 3,
  2785. 'appoint_id'=> $appoint_info->id,
  2786. 'uid' => $uid,
  2787. 'log' => '用户确认参加笔试'
  2788. ];
  2789. RecruitAppointLog::create($log);
  2790. return ['status' => 1, 'msg' => '确认成功', 'data' => $appoint_info->id];
  2791. }
  2792. public function supplementary_entry(Request $request){
  2793. $user = $this->getUser();
  2794. if (!empty($user)) {
  2795. $uid = $user->id;
  2796. } else {
  2797. return redirect(route('login'));
  2798. }
  2799. //招考id
  2800. $id = $request->input('recruit_id', 0);
  2801. if (!$id) {
  2802. return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
  2803. }
  2804. $recruit = Recruit::find($id);
  2805. if(!$recruit['status']){
  2806. return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
  2807. }
  2808. $appoint_info = RecruitAppointInfo::where('recruit_id',$id)->where('uid',$uid)->first();
  2809. if(!$appoint_info){
  2810. return ['status' => 0, 'msg' => '找不到您的报名记录,请检查!', 'data' => ''];
  2811. }
  2812. $time = time();
  2813. if($time > 1680969600){
  2814. return ['status' => 0, 'msg' => '已停止补充报名!', 'data' => ''];
  2815. }
  2816. if($appoint_info->adjust_limit){
  2817. $appoint_info->update(['adjust' => 1]);
  2818. return ['status' => 1, 'msg' => '补充报名成功!', 'data' => ''];
  2819. }else{
  2820. return ['status' => 0, 'msg' => '您无需补充报名!', 'data' => ''];
  2821. }
  2822. }
  2823. }