IndexController.php 135 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047
  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. if(!array_key_exists('relation',$value) || !array_key_exists('realname',$value) || !array_key_exists('birthday',$value) || !array_key_exists('political_affiliation',$value) || !array_key_exists('work',$value)){
  942. return ['status' => 0, 'msg' => '请填写完整的家庭成员信息'];
  943. }
  944. $item = [
  945. 'relation' => $value['relation'],
  946. 'realname' => $value['realname'],
  947. 'birthday' => $value['birthday'],
  948. 'political_affiliation' => $value['political_affiliation'],
  949. 'work' => $value['work']
  950. ];
  951. array_push($family,$item);
  952. }
  953. }
  954. $forms = explode(',', $recruit['forms']);
  955. if(in_array('expand_special',$forms)){
  956. $special = $request->input('special');
  957. if($special['point_apply'] && is_array($special['condition']) && count($special['condition']) == 0){
  958. return response()->json(['status' => 0,'msg' => '加分条件不能为空']);
  959. }
  960. if($special['point_apply'] && ($special['condition'] == '' )){
  961. return response()->json(['status' => 0,'msg' => '加分条件不能为空']);
  962. }
  963. }
  964. $data['family'] = json_encode($family);
  965. if($appoint_info){
  966. //如果已有报名记录,进入修改阶段的处理流程
  967. DB::beginTransaction();
  968. try{
  969. RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->update($data);
  970. //分模块解析数据
  971. //如果有加分模块
  972. if(in_array('expand_special',$forms)){
  973. $special = $request->input('special');
  974. if($special['point_apply']){//如果申请加分
  975. if(!array_key_exists('material',$special)){
  976. return response()->json(['status' => 0,'msg' => '加分佐证材料不能为空!']);
  977. }
  978. //删除掉没有成功返回路径的图片
  979. if(is_array($special['material'])){
  980. foreach ($special['material'] as $k => $v){
  981. if(!array_key_exists('response',$v)){
  982. unset($special['material'][$k]);
  983. }
  984. }
  985. }
  986. switch ($recruit->special_condition_type){
  987. case 0:
  988. $special['point'] = 0;
  989. break;
  990. case 1:
  991. $special_rule = json_decode($recruit->special_condition_value,true);
  992. $conditions = array_column($special_rule['list'],'condition');
  993. $special['point'] = 0;
  994. if(array_key_exists('multi',$special_rule) && $special_rule['multi'] && is_array($special['condition'])){
  995. foreach ($special['condition'] as $v){
  996. $key = array_search($v,$conditions);
  997. $rule_info = $special_rule['list'][$key];
  998. $special['point'] += $rule_info['value'];
  999. }
  1000. }else{
  1001. $key = array_search($special['condition'],$conditions);
  1002. $rule_info = $special_rule['list'][$key];
  1003. $special['point'] += $rule_info['value'];
  1004. }
  1005. break;
  1006. case 2:
  1007. $special_rule = json_decode($post_info['special'],true);
  1008. $conditions = array_column($special_rule['list'],'condition');
  1009. $special['point'] = 0;
  1010. if(array_key_exists('multi',$special_rule) && $special_rule['multi'] && is_array($special['condition'])){
  1011. foreach ($special['condition'] as $v){
  1012. $key = array_search($v,$conditions);
  1013. $rule_info = $special_rule['list'][$key];
  1014. $special['point'] += $rule_info['value'];
  1015. }
  1016. }else{
  1017. $key = array_search($special['condition'],$conditions);
  1018. $rule_info = $special_rule['list'][$key];
  1019. $special['point'] += $rule_info['value'];
  1020. }
  1021. break;
  1022. }
  1023. if(is_array($special['condition'])){
  1024. $special['condition'] = implode(',',$special['condition']);
  1025. }
  1026. $special['material'] = json_encode($special['material']);
  1027. $hasRecord = RecruitAppointExpandSpecial::where('recruit_appoint_id',$appoint_info->id)->first();
  1028. if($hasRecord){
  1029. RecruitAppointExpandSpecial::where('recruit_appoint_id',$appoint_info->id)->update($special);
  1030. }else{
  1031. $special['recruit_appoint_id'] = $appoint_info->id;
  1032. RecruitAppointExpandSpecial::create($special);
  1033. }
  1034. }
  1035. }
  1036. //如果有详情模块
  1037. if(in_array('detail',$forms) || in_array('internship',$forms)){
  1038. $detail = $request->input('detail');
  1039. $hasRecord = RecruitAppointDetail::where('recruit_appoint_id',$appoint_info->id)->first();
  1040. if($hasRecord){
  1041. RecruitAppointDetail::where('recruit_appoint_id',$appoint_info->id)->update($detail);
  1042. }else{
  1043. $detail['recruit_appoint_id'] = $appoint_info->id;
  1044. RecruitAppointDetail::create($detail);
  1045. }
  1046. }
  1047. //如果有身份证明模块
  1048. if(in_array('identification',$forms) || in_array('internship',$forms)){
  1049. $identification = $request->input('identification');
  1050. if(is_array($identification)){
  1051. //删除掉没有成功返回路径的图片
  1052. foreach ($identification as $k => $v){
  1053. if(!array_key_exists('response',$v)){
  1054. unset($identification[$k]);
  1055. }
  1056. }
  1057. }
  1058. $appoint_info->identification = json_encode($identification);
  1059. $appoint_info->save();
  1060. }
  1061. //如果有教育证明模块
  1062. if(in_array('education_certification',$forms) || in_array('internship',$forms)){
  1063. $education_certification = $request->input('education_certification');
  1064. if(is_array($education_certification)){
  1065. //删除掉没有成功返回路径的图片
  1066. foreach ($education_certification as $k => $v){
  1067. if(!array_key_exists('response',$v)){
  1068. unset($education_certification[$k]);
  1069. }
  1070. }
  1071. }
  1072. $appoint_info->education_certification = json_encode($education_certification);
  1073. $appoint_info->save();
  1074. }
  1075. //如果有其他证明模块
  1076. if(in_array('other_certification',$forms) || in_array('internship',$forms)){
  1077. $other_certification = $request->input('other_certification');
  1078. if(is_array($other_certification)){
  1079. //删除掉没有成功返回路径的图片
  1080. foreach ($other_certification as $k => $v){
  1081. if(!array_key_exists('response',$v)){
  1082. unset($other_certification[$k]);
  1083. }
  1084. }
  1085. }
  1086. if($other_certification){
  1087. $appoint_info->other_certification = json_encode($other_certification);
  1088. $appoint_info->save();
  1089. }
  1090. }
  1091. //如果有承诺书模块
  1092. if(in_array('chengnuoshu',$forms)){
  1093. $chengnuoshu = $request->input('chengnuoshu');
  1094. if(is_array($chengnuoshu)){
  1095. //删除掉没有成功返回路径的图片
  1096. foreach ($chengnuoshu as $k => $v){
  1097. if(!array_key_exists('response',$v)){
  1098. unset($chengnuoshu[$k]);
  1099. }
  1100. }
  1101. }
  1102. if($chengnuoshu){
  1103. $appoint_info->chengnuoshu = json_encode($chengnuoshu);
  1104. $appoint_info->save();
  1105. }
  1106. }
  1107. //如果有失信被执行人模块
  1108. if(in_array('shixin',$forms)){
  1109. $shixin = $request->input('shixin');
  1110. if(is_array($shixin)){
  1111. //删除掉没有成功返回路径的图片
  1112. foreach ($shixin as $k => $v){
  1113. if(!array_key_exists('response',$v)){
  1114. unset($shixin[$k]);
  1115. }
  1116. }
  1117. }
  1118. if($shixin){
  1119. $appoint_info->shixin = json_encode($shixin);
  1120. $appoint_info->save();
  1121. }
  1122. }
  1123. //如果有声明书模块
  1124. if(in_array('baokaoshengming',$forms)){
  1125. $baokaoshengming = $request->input('baokaoshengming');
  1126. if(is_array($baokaoshengming)){
  1127. //删除掉没有成功返回路径的图片
  1128. foreach ($baokaoshengming as $k => $v){
  1129. if(!array_key_exists('response',$v)){
  1130. unset($baokaoshengming[$k]);
  1131. }
  1132. }
  1133. }
  1134. if($baokaoshengming){
  1135. $appoint_info->baokaoshengming = json_encode($baokaoshengming);
  1136. $appoint_info->save();
  1137. }
  1138. }
  1139. DB::commit();
  1140. if($operation == 2){
  1141. $log = [
  1142. 'type' => 3,
  1143. 'appoint_id'=> $appoint_info->id,
  1144. 'uid' => $uid,
  1145. 'log' => '用户提交报名'
  1146. ];
  1147. RecruitAppointLog::create($log);
  1148. return ['status' => 1, 'msg' => '提交成功', 'data' => $appoint_info->id];
  1149. }else{
  1150. return ['status' => 1, 'msg' => '资料保存成功,请尽快完善并提交', 'data' => $appoint_info->id];
  1151. }
  1152. } catch (\Exception $e){
  1153. DB::rollback();
  1154. return ['status' => 0, 'msg' => $e->getMessage()];
  1155. }
  1156. }else{
  1157. //没有报名记录,进入增加阶段的处理流程
  1158. DB::beginTransaction();
  1159. try{
  1160. //20220726增加地区undefined选项处理
  1161. if($index = stripos($data['native_place'],',undefined')){
  1162. $data['native_place'] = substr($data['native_place'],0,$index);
  1163. }
  1164. if($index = stripos($data['house_register'],',undefined')){
  1165. $data['house_register'] = substr($data['house_register'],0,$index);
  1166. }
  1167. $data['uid'] = $uid;
  1168. $data['recruit_id'] = $recruit_id;
  1169. $result = RecruitAppointInfo::create($data);
  1170. //分模块解析数据
  1171. $forms = explode(',', $recruit['forms']);
  1172. //如果有加分模块
  1173. if(in_array('expand_special',$forms)){
  1174. $special = $request->input('special');
  1175. if($special['point_apply']){
  1176. if(is_array($special['material'])){
  1177. //删除掉没有成功返回路径的图片
  1178. foreach ($special['material'] as $k => $v){
  1179. if(!array_key_exists('response',$v)){
  1180. unset($special['material'][$k]);
  1181. }
  1182. }
  1183. }
  1184. switch ($recruit->special_condition_type){
  1185. case 0:
  1186. $special['point'] = 0;
  1187. break;
  1188. case 1:
  1189. $special_rule = json_decode($recruit->special_condition_value,true);
  1190. $conditions = array_column($special_rule['list'],'condition');
  1191. $special['point'] = 0;
  1192. if(array_key_exists('multi',$special_rule) && $special_rule['multi'] && is_array($special['condition'])){
  1193. foreach ($special['condition'] as $v){
  1194. $key = array_search($v,$conditions);
  1195. $rule_info = $special_rule['list'][$key];
  1196. $special['point'] += $rule_info['value'];
  1197. }
  1198. }else{
  1199. $key = array_search($special['condition'],$conditions);
  1200. $rule_info = $special_rule['list'][$key];
  1201. $special['point'] += $rule_info['value'];
  1202. }
  1203. break;
  1204. case 2:
  1205. $special_rule = json_decode($post_info['special'],true);
  1206. $conditions = array_column($special_rule['list'],'condition');
  1207. $special['point'] = 0;
  1208. if(array_key_exists('multi',$special_rule) && $special_rule['multi'] && is_array($special['condition'])){
  1209. foreach ($special['condition'] as $v){
  1210. $key = array_search($v,$conditions);
  1211. $rule_info = $special_rule['list'][$key];
  1212. $special['point'] += $rule_info['value'];
  1213. }
  1214. }else{
  1215. $key = array_search($special['condition'],$conditions);
  1216. $rule_info = $special_rule['list'][$key];
  1217. $special['point'] += $rule_info['value'];
  1218. }
  1219. break;
  1220. }
  1221. if(is_array($special['condition'])){
  1222. $special['condition'] = implode(',',$special['condition']);
  1223. }
  1224. $special['material'] = json_encode($special['material']);
  1225. $special['recruit_appoint_id'] = $result->id;
  1226. RecruitAppointExpandSpecial::create($special);
  1227. }
  1228. }
  1229. //如果有详情模块
  1230. if(in_array('detail',$forms) || in_array('internship',$forms)){
  1231. $detail = $request->input('detail');
  1232. $detail['recruit_appoint_id'] = $result->id;
  1233. RecruitAppointDetail::create($detail);
  1234. }
  1235. //如果有身份证明模块
  1236. if(in_array('identification',$forms) || in_array('internship',$forms)){
  1237. $identification = $request->input('identification');
  1238. if(is_array($identification)){
  1239. //删除掉没有成功返回路径的图片
  1240. foreach ($identification as $k => $v){
  1241. if(!array_key_exists('response',$v)){
  1242. unset($identification[$k]);
  1243. }
  1244. }
  1245. }
  1246. $result->identification = json_encode($identification);
  1247. $result->save();
  1248. }
  1249. //如果有教育证明模块
  1250. if(in_array('education_certification',$forms) || in_array('internship',$forms)){
  1251. $education_certification = $request->input('education_certification');
  1252. if(is_array($education_certification)){
  1253. //删除掉没有成功返回路径的图片
  1254. foreach ($education_certification as $k => $v){
  1255. if(!array_key_exists('response',$v)){
  1256. unset($education_certification[$k]);
  1257. }
  1258. }
  1259. }
  1260. $result->education_certification = json_encode($education_certification);
  1261. $result->save();
  1262. }
  1263. //如果有其他证明模块
  1264. if(in_array('other_certification',$forms) || in_array('internship',$forms)){
  1265. $other_certification = $request->input('other_certification');
  1266. if($other_certification){
  1267. if(is_array($other_certification)){
  1268. //删除掉没有成功返回路径的图片
  1269. foreach ($other_certification as $k => $v){
  1270. if(!array_key_exists('response',$v)){
  1271. unset($other_certification[$k]);
  1272. }
  1273. }
  1274. }
  1275. $result->other_certification = json_encode($other_certification);
  1276. $result->save();
  1277. }
  1278. }
  1279. //如果有承诺书模块
  1280. if(in_array('chengnuoshu',$forms)){
  1281. $chengnuoshu = $request->input('chengnuoshu');
  1282. if($chengnuoshu){
  1283. if(is_array($chengnuoshu)){
  1284. //删除掉没有成功返回路径的图片
  1285. foreach ($chengnuoshu as $k => $v){
  1286. if(!array_key_exists('response',$v)){
  1287. unset($chengnuoshu[$k]);
  1288. }
  1289. }
  1290. }
  1291. $result->chengnuoshu = json_encode($chengnuoshu);
  1292. $result->save();
  1293. }
  1294. }
  1295. //如果有失信被执行人模块
  1296. if(in_array('shixin',$forms)){
  1297. $shixin = $request->input('shixin');
  1298. if($shixin){
  1299. if(is_array($shixin)){
  1300. //删除掉没有成功返回路径的图片
  1301. foreach ($shixin as $k => $v){
  1302. if(!array_key_exists('response',$v)){
  1303. unset($shixin[$k]);
  1304. }
  1305. }
  1306. }
  1307. $result->shixin = json_encode($shixin);
  1308. $result->save();
  1309. }
  1310. }
  1311. //如果有声明书模块
  1312. if(in_array('baokaoshengming',$forms)){
  1313. $baokaoshengming = $request->input('baokaoshengming');
  1314. if($baokaoshengming){
  1315. if(is_array($baokaoshengming)){
  1316. //删除掉没有成功返回路径的图片
  1317. foreach ($baokaoshengming as $k => $v){
  1318. if(!array_key_exists('response',$v)){
  1319. unset($baokaoshengming[$k]);
  1320. }
  1321. }
  1322. }
  1323. $result->baokaoshengming = json_encode($baokaoshengming);
  1324. $result->save();
  1325. }
  1326. }
  1327. DB::commit();
  1328. if($operation == 2){
  1329. $log = [
  1330. 'type' => 3,
  1331. 'appoint_id'=> $result->id,
  1332. 'uid' => $uid,
  1333. 'log' => '用户首次提交报名'
  1334. ];
  1335. RecruitAppointLog::create($log);
  1336. return ['status' => 1, 'msg' => '提交成功', 'data' => $result->id];
  1337. }else{
  1338. return ['status' => 1, 'msg' => '资料保存成功,请尽快完善并提交', 'data' => $result->id];
  1339. }
  1340. } catch (\Exception $e){
  1341. DB::rollback();
  1342. return ['status' => 0, 'msg' => $e->getMessage()];
  1343. }
  1344. }
  1345. }
  1346. /**
  1347. * 获得当前登录的用户
  1348. * @return \Illuminate\Contracts\Auth\Authenticatable|null
  1349. */
  1350. public function getUser()
  1351. {
  1352. if (auth('web-member')->check()) {
  1353. $user = auth('web-member')->user();
  1354. } else {
  1355. $user = null;
  1356. }
  1357. return $user;
  1358. }
  1359. /**
  1360. * 检查用户基本信息
  1361. * @return array
  1362. */
  1363. public function checkUserBasicInfo()
  1364. {
  1365. $user = $this->getUser();
  1366. if (!empty($user)) {
  1367. $uid = $user->id;
  1368. } else {
  1369. $arr = ['status' => 401, 'msg'=>'请登录!'];
  1370. return $arr;
  1371. }
  1372. $info = RecruitAppointBasic::where('uid',$uid)->first();
  1373. if (empty($info)){
  1374. $arr = ['status'=>401,'msg'=>'请先完善招考基本信息','url'=> route('recruit.recruitInfo')];
  1375. return $arr;
  1376. }
  1377. return ['status' => 200, 'msg' => ''];
  1378. }
  1379. /**
  1380. * 个人中心招考页面
  1381. * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
  1382. */
  1383. public function person_recruit()
  1384. {
  1385. $user = auth('web-member')->user();
  1386. $list = RecruitAppointInfo::where('uid',$user->id)
  1387. ->join('recruit', 'recruit.id', '=', 'recruit_appoint_info.recruit_id', 'left')
  1388. ->join('recruit_post', 'recruit_post.id', '=', 'recruit_appoint_info.post_id', 'left')
  1389. ->select('recruit.name as recruit_name','recruit_appoint_info.*','recruit_post.code','recruit_post.name')
  1390. ->get();
  1391. return view('app.person.recruit')->with(['list' => $list,'total' => count($list)]);
  1392. }
  1393. /**
  1394. * 招考信息基础页
  1395. * @param Request $request
  1396. * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
  1397. */
  1398. public function recruit_info(Request $request)
  1399. {
  1400. $user = auth('web-member')->user();
  1401. if (!empty($user)) {
  1402. $uid = $user->id;
  1403. } else {
  1404. return redirect(route('login'));
  1405. }
  1406. $info = RecruitAppointBasic::where('uid',$user->id)->first();
  1407. if(!$info){
  1408. $info = [
  1409. 'realname' => '',
  1410. 'sex' => '0',
  1411. 'birthday' => '',
  1412. 'avatar' => '',
  1413. 'nation' => '',
  1414. 'native_place' => '',
  1415. 'political_affiliation' => '',
  1416. 'titles' => '',
  1417. 'work' => '',
  1418. 'house_register' => '',
  1419. 'join_time' => '',
  1420. 'edu_type' => '',
  1421. 'education' => '',
  1422. 'school' => '',
  1423. 'degree' => '',
  1424. 'pro' => '',
  1425. 'address' => '',
  1426. 'card' => '',
  1427. 'mobile' => '',
  1428. 'email' => '',
  1429. 'concat_name' => '',
  1430. 'concat_mobile' => '',
  1431. 'resume' => '',
  1432. 'family' => [
  1433. [
  1434. 'relation' => '',
  1435. 'realname' => '',
  1436. 'birthday' => '',
  1437. 'political_affiliation' => '',
  1438. 'work' => ''
  1439. ]
  1440. ],
  1441. 'is_push' => '1'
  1442. ];
  1443. }else{
  1444. $info->sex = (string)$info->sex;
  1445. $info->edu_type = (string)$info->edu_type;
  1446. $info->is_push = (string)$info->is_push;
  1447. $info->family = empty($info->family) ? [[
  1448. 'relation' => '',
  1449. 'realname' => '',
  1450. 'birthday' => '',
  1451. 'political_affiliation' => '',
  1452. 'work' => ''
  1453. ]] : json_decode($info->family);
  1454. }
  1455. $recruit_id = $request->input('recruit_id',0);
  1456. return view('app.person.recruit_info',[
  1457. 'info' => json_encode($info),
  1458. 'recruit_id'=> $recruit_id
  1459. ]);
  1460. }
  1461. /**
  1462. * 保存招考信息
  1463. * @param RecruitValidatorRequest $request
  1464. * @return \Illuminate\Http\JsonResponse
  1465. */
  1466. public function saveRecruitInfo(RecruitValidatorRequest $request)
  1467. {
  1468. $user = auth('web-member')->user();
  1469. $basic = RecruitAppointBasic::where('uid',$user->id)->first();
  1470. $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');
  1471. if(count($data['family']) > 0){
  1472. $data['family'] = json_encode($data['family']);
  1473. }
  1474. if($basic){
  1475. //更新基础信息
  1476. $res = RecruitAppointBasic::where('uid',$user->id)->update($data);
  1477. if (!$res) {
  1478. return response()->json(['status'=>0,'msg'=>'保存失败,请联系客服']);
  1479. }else{
  1480. return response()->json(['status'=>1,'msg'=>'个人基础信息保存成功,快去报名吧!']);
  1481. }
  1482. }else{
  1483. //新增基础信息
  1484. $data['uid'] = $user->id;
  1485. $res = RecruitAppointBasic::create($data);
  1486. if (!$res) {
  1487. return response()->json(['status'=>0,'msg'=>'保存失败,请联系客服']);
  1488. }else{
  1489. return response()->json(['status'=>1,'msg'=>'个人基础信息保存成功,快去报名吧!']);
  1490. }
  1491. }
  1492. }
  1493. /**
  1494. * 笔试准考证
  1495. * @param Request $request
  1496. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1497. */
  1498. public function pen_ticket(Request $request)
  1499. {
  1500. $user = $this->getUser();
  1501. if (!empty($user)) {
  1502. $uid = $user->id;
  1503. } else {
  1504. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1505. }
  1506. $recruit_id = $request->input('recruit_id');
  1507. $recruit = Recruit::where('id',$recruit_id)->first();
  1508. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  1509. if($appoint_info){
  1510. $pen_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',1)->first();
  1511. if($pen_ticket){
  1512. $health = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
  1513. if((!$health || $health->h_status == 0) && $recruit->pen_epidemic){
  1514. return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
  1515. }
  1516. $time = time();
  1517. if(strtotime($pen_ticket->ex_start) < $time && strtotime($pen_ticket->ex_end) > $time){
  1518. RecruitTicket::where('appoint_id',$appoint_info->id)->update(['ex_status' => 1]);
  1519. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1520. $name = $recruit->name_en;
  1521. $date = date("Y-m-d",strtotime($recruit->created_at));
  1522. //$filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
  1523. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1524. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/pen/" . $filename . '.pdf';
  1525. if(file_exists($file)){
  1526. header('Content-Description: File Transfer');
  1527. header('Content-Type: application/octet-stream');
  1528. header('Content-Disposition: attachment; filename='.basename($file));
  1529. header('Content-Transfer-Encoding: binary');
  1530. header('Expires: 0');
  1531. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1532. header('Pragma: public');
  1533. header('Content-Length: ' . filesize($file));
  1534. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1535. flush();
  1536. readfile($file);
  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. }else{
  1547. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1548. }
  1549. }
  1550. /**
  1551. * 审核准考证
  1552. * @param Request $request
  1553. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1554. */
  1555. public function check_ticket(Request $request)
  1556. {
  1557. $user = $this->getUser();
  1558. if (!empty($user)) {
  1559. $uid = $user->id;
  1560. } else {
  1561. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1562. }
  1563. $recruit_id = $request->input('recruit_id');
  1564. $recruit = Recruit::where('id',$recruit_id)->first();
  1565. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  1566. if($appoint_info){
  1567. $check_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',2)->first();
  1568. if($check_ticket){
  1569. $health = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
  1570. if((!$health || $health->h_status == 0) && $recruit->pen_epidemic){
  1571. return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
  1572. }$time = time();
  1573. if(strtotime($check_ticket->ex_start) < $time && strtotime($check_ticket->ex_end) > $time){
  1574. RecruitTicket::where('id',$check_ticket->id)->update(['ex_status' => 1]);
  1575. $recruit = Recruit::where('id',$recruit_id)->first();
  1576. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1577. $name = $recruit->name_en;
  1578. $date = date("Y-m-d",strtotime($recruit->created_at));
  1579. //$filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
  1580. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1581. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/computer/" . $filename . '.pdf';
  1582. if(file_exists($file)){
  1583. header('Content-Description: File Transfer');
  1584. header('Content-Type: application/octet-stream');
  1585. header('Content-Disposition: attachment; filename='.basename($file));
  1586. header('Content-Transfer-Encoding: binary');
  1587. header('Expires: 0');
  1588. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1589. header('Pragma: public');
  1590. header('Content-Length: ' . filesize($file));
  1591. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1592. flush();
  1593. readfile($file);
  1594. }
  1595. }else{
  1596. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1597. }
  1598. }else{
  1599. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1600. }
  1601. }else{
  1602. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1603. }
  1604. }
  1605. /**
  1606. * 面试准考证
  1607. * @param Request $request
  1608. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1609. */
  1610. public function face_ticket(Request $request)
  1611. {
  1612. $user = $this->getUser();
  1613. if (!empty($user)) {
  1614. $uid = $user->id;
  1615. } else {
  1616. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1617. }
  1618. $recruit_id = $request->input('recruit_id');
  1619. $recruit = Recruit::where('id',$recruit_id)->first();
  1620. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  1621. if($appoint_info){
  1622. $face_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',3)->first();
  1623. if($face_ticket){
  1624. $health = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
  1625. if((!$health || $health->h_status == 0) && $recruit->pen_epidemic){
  1626. return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
  1627. }$time = time();
  1628. if(strtotime($face_ticket->ex_start) < $time && strtotime($face_ticket->ex_end) > $time){
  1629. RecruitTicket::where('id',$face_ticket->id)->update(['ex_status' => 1]);
  1630. $recruit = Recruit::where('id',$recruit_id)->first();
  1631. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1632. $name = $recruit->name_en;
  1633. $date = date("Y-m-d",strtotime($recruit->created_at));
  1634. //$filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
  1635. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1636. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/face/" . $filename . '.pdf';
  1637. if(file_exists($file)){
  1638. header('Content-Description: File Transfer');
  1639. header('Content-Type: application/octet-stream');
  1640. header('Content-Disposition: attachment; filename='.basename($file));
  1641. header('Content-Transfer-Encoding: binary');
  1642. header('Expires: 0');
  1643. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1644. header('Pragma: public');
  1645. header('Content-Length: ' . filesize($file));
  1646. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1647. flush();
  1648. readfile($file);
  1649. }
  1650. }else{
  1651. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1652. }
  1653. }else{
  1654. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1655. }
  1656. }else{
  1657. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1658. }
  1659. }
  1660. /**
  1661. * 复试准考证
  1662. * @param Request $request
  1663. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1664. */
  1665. public function reexamine_ticket(Request $request)
  1666. {
  1667. $user = $this->getUser();
  1668. if (!empty($user)) {
  1669. $uid = $user->id;
  1670. } else {
  1671. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1672. }
  1673. $recruit_id = $request->input('recruit_id');
  1674. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  1675. if($appoint_info){
  1676. $reexamine_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',4)->first();
  1677. if($reexamine_ticket){
  1678. $time = time();
  1679. if(strtotime($reexamine_ticket->ex_start) < $time && strtotime($reexamine_ticket->ex_end) > $time){
  1680. RecruitTicket::where('id',$reexamine_ticket->id)->update(['ex_status' => 1]);
  1681. $recruit = Recruit::where('id',$recruit_id)->first();
  1682. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1683. $name = $recruit->name_en;
  1684. $date = date("Y-m-d",strtotime($recruit->created_at));
  1685. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1686. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/reexamine/" . $filename . '.pdf';
  1687. if(file_exists($file)){
  1688. header('Content-Description: File Transfer');
  1689. header('Content-Type: application/octet-stream');
  1690. header('Content-Disposition: attachment; filename='.basename($file));
  1691. header('Content-Transfer-Encoding: binary');
  1692. header('Expires: 0');
  1693. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1694. header('Pragma: public');
  1695. header('Content-Length: ' . filesize($file));
  1696. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1697. flush();
  1698. readfile($file);
  1699. }
  1700. }else{
  1701. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1702. }
  1703. }else{
  1704. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1705. }
  1706. }else{
  1707. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1708. }
  1709. }
  1710. /**
  1711. * 材料补登
  1712. * @param Request $request
  1713. */
  1714. public function material_supplement(Request $request)
  1715. {
  1716. $user = $this->getUser();
  1717. if (!empty($user)) {
  1718. $uid = $user->id;
  1719. } else {
  1720. return redirect(route('login'));
  1721. }
  1722. //招考id
  1723. $id = $request->input('id', 0);
  1724. if (!$id) {
  1725. return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
  1726. }
  1727. $recruit = Recruit::find($id);
  1728. if(!$recruit['status'] && !$user->recruit_test){
  1729. return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1730. }
  1731. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  1732. if(!$appoint_info){
  1733. return $this->showMessage('抱歉,您没有报名,无需考察审核!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1734. }
  1735. if($appoint_info->pen_audit != 1){
  1736. return $this->showMessage('抱歉,您未入闱,无需考察审核!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1737. }
  1738. $limit_time = 1694683800;
  1739. $time = time();
  1740. if( $time > $limit_time){
  1741. return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1742. }
  1743. $info = RecruitSupplement::where('appoint_id',$appoint_info->id)->where('type','supplement')->first();
  1744. if(!$info){
  1745. $info = [
  1746. 'appoint_id' => $appoint_info->id,
  1747. 'identification' => '',
  1748. //'household_register' => '',
  1749. //'education_certification' => '',
  1750. //'family_planning' => '',
  1751. 'chengxin' => '',
  1752. 'manage' => '',
  1753. 'status' => 3
  1754. ];
  1755. }else{
  1756. $info = $info->toArray();
  1757. if(json_decode($info['identification'])){
  1758. $identification = json_decode($info['identification'],true);
  1759. foreach ($identification as $k => $v){
  1760. if(array_key_exists('response',$v)){
  1761. $identification[$k]['url'] = $v['response']['path'];
  1762. }
  1763. }
  1764. }else{
  1765. $identification = [];
  1766. }
  1767. $info['identification'] = $identification;
  1768. if(json_decode($info['household_register'])){
  1769. $household_register = json_decode($info['household_register'],true);
  1770. foreach ($household_register as $k => $v){
  1771. if(array_key_exists('response',$v)){
  1772. $household_register[$k]['url'] = $v['response']['path'];
  1773. }
  1774. }
  1775. }else{
  1776. $household_register = [];
  1777. }
  1778. $info['household_register'] = $household_register;
  1779. if(json_decode($info['education_certification'])){
  1780. $education_certification = json_decode($info['education_certification'],true);
  1781. foreach ($education_certification as $k => $v){
  1782. if(array_key_exists('response',$v)){
  1783. $education_certification[$k]['url'] = $v['response']['path'];
  1784. }
  1785. }
  1786. }else{
  1787. $education_certification = [];
  1788. }
  1789. $info['education_certification'] = $education_certification;
  1790. if(json_decode($info['family_planning'])){
  1791. $family_planning = json_decode($info['family_planning'],true);
  1792. foreach ($family_planning as $k => $v){
  1793. if(array_key_exists('response',$v)){
  1794. $family_planning[$k]['url'] = $v['response']['path'];
  1795. }
  1796. }
  1797. }else{
  1798. $family_planning = [];
  1799. }
  1800. $info['family_planning'] = $family_planning;
  1801. if(json_decode($info['chengxin'])){
  1802. $chengxin = json_decode($info['chengxin'],true);
  1803. foreach ($chengxin as $k => $v){
  1804. if(array_key_exists('response',$v)){
  1805. $chengxin[$k]['url'] = $v['response']['path'];
  1806. }
  1807. }
  1808. }else{
  1809. $chengxin = [];
  1810. }
  1811. $info['chengxin'] = $chengxin;
  1812. if(json_decode($info['manage'])){
  1813. $manage = json_decode($info['manage'],true);
  1814. foreach ($manage as $k => $v){
  1815. if(array_key_exists('response',$v)){
  1816. $manage[$k]['url'] = $v['response']['path'];
  1817. }
  1818. }
  1819. }else{
  1820. $manage = [];
  1821. }
  1822. $info['manage'] = $manage;
  1823. }
  1824. $view_data['info'] = json_encode($info);
  1825. $view_data['title'] = $recruit->company;
  1826. return view('app.recruit.supplement',$view_data);
  1827. }
  1828. /**
  1829. * 健康信息登记
  1830. * @param Request $request
  1831. */
  1832. public function health_info(Request $request)
  1833. {
  1834. $user = $this->getUser();
  1835. if (!empty($user)) {
  1836. $uid = $user->id;
  1837. } else {
  1838. return redirect(route('login'));
  1839. }
  1840. //招考id
  1841. $id = $request->input('id', 0);
  1842. if (!$id) {
  1843. return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
  1844. }
  1845. $recruit = Recruit::find($id);
  1846. if(!$recruit['status'] && !$user->recruit_test){
  1847. return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1848. }
  1849. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  1850. if(!$appoint_info){
  1851. return $this->showMessage('抱歉,您没有报名,无需登记!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1852. }
  1853. if($appoint_info->audit != 3){
  1854. return $this->showMessage('抱歉,您无需登记!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1855. }
  1856. $time = time();
  1857. $type = $request->input('type',null);
  1858. $where = [];
  1859. if($type){
  1860. switch ($type){
  1861. case 'pen':
  1862. $start = strtotime($recruit->pen_health_start);
  1863. $end = strtotime($recruit->pen_health_end);
  1864. break;
  1865. case 'computer':
  1866. $start = strtotime($recruit->computer_health_start);
  1867. $end = strtotime($recruit->computer_health_end);
  1868. break;
  1869. case 'face':
  1870. $start = strtotime($recruit->face_health_start);
  1871. $end = strtotime($recruit->face_health_end);
  1872. break;
  1873. case 'reexamine':
  1874. $start = strtotime($recruit->reexamine_health_start);
  1875. $end = strtotime($recruit->reexamine_health_end);
  1876. break;
  1877. default:
  1878. $start = strtotime($recruit->supplement_start);
  1879. $end = strtotime($recruit->supplement_end);
  1880. break;
  1881. }
  1882. $where[] = ['type', '=', $type];
  1883. }else{
  1884. $start = strtotime($recruit->supplement_start);
  1885. $end = strtotime($recruit->supplement_end);
  1886. }
  1887. if($time > $end || $time < $start){
  1888. return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1889. }
  1890. $where[] = ['appoint_id', '=', $appoint_info->id];
  1891. $info = RecruitSupplement::where($where)->first();
  1892. if(!$info){
  1893. $info = [
  1894. 'appoint_id' => $appoint_info->id,
  1895. 'health_code' => '',
  1896. 'trip_code' => '',
  1897. 'type' => $type
  1898. ];
  1899. }else{
  1900. $info = $info->toArray();
  1901. if(json_decode($info['health_code'])){
  1902. $health_code = json_decode($info['health_code'],true);
  1903. foreach ($health_code as $k => $v){
  1904. if(array_key_exists('response',$v)){
  1905. $health_code[$k]['url'] = $v['response']['path'];
  1906. }
  1907. }
  1908. }else{
  1909. $health_code = [];
  1910. }
  1911. $info['health_code'] = $health_code;
  1912. if(json_decode($info['trip_code'])){
  1913. $trip_code = json_decode($info['trip_code'],true);
  1914. foreach ($trip_code as $k => $v){
  1915. if(array_key_exists('response',$v)){
  1916. $trip_code[$k]['url'] = $v['response']['path'];
  1917. }
  1918. }
  1919. }else{
  1920. $trip_code = [];
  1921. }
  1922. $info['trip_code'] = $trip_code;
  1923. }
  1924. $view_data['info'] = json_encode($info);
  1925. $view_data['title'] = $recruit->company;
  1926. return view('app.recruit.health',$view_data);
  1927. }
  1928. public function save_supplement(Request $request)
  1929. {
  1930. $user = $this->getUser();
  1931. if (!empty($user)) {
  1932. $uid = $user->id;
  1933. } else {
  1934. return redirect(route('login'));
  1935. }
  1936. $limit_time = 1694683800;
  1937. $time = time();
  1938. if( $time > $limit_time){
  1939. return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',38)), true, '上一页', '3');
  1940. }
  1941. $appoint_id = $request->input('appoint_id');
  1942. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',38)->where('id',$appoint_id)->first();
  1943. if(!$appoint_info){
  1944. return ['status' => 0, 'msg' => '抱歉,找不到您要补登的报名记录!'];
  1945. }
  1946. $info = RecruitSupplement::where('appoint_id',$appoint_id)->where('type','supplement')->first();
  1947. if($info){
  1948. if($info->status == 1){
  1949. return ['status' => 0, 'msg' => '材料已审核通过,不允许修改'];
  1950. }
  1951. if($info->status == 0){
  1952. return ['status' => 0, 'msg' => '材料审核中,不允许修改'];
  1953. }
  1954. //身份证明
  1955. $identification = $request->input('identification');
  1956. if(is_array($identification)){
  1957. //删除掉没有成功返回路径的图片
  1958. foreach ($identification as $k => $v){
  1959. if(!array_key_exists('response',$v)){
  1960. unset($identification[$k]);
  1961. }
  1962. }
  1963. }
  1964. $info->identification = json_encode($identification);
  1965. //户口簿
  1966. $household_register = $request->input('household_register');
  1967. if(is_array($household_register)){
  1968. //删除掉没有成功返回路径的图片
  1969. foreach ($household_register as $k => $v){
  1970. if(!array_key_exists('response',$v)){
  1971. unset($household_register[$k]);
  1972. }
  1973. }
  1974. }
  1975. $info->household_register = json_encode($household_register);
  1976. //学信网
  1977. $education_certification = $request->input('education_certification');
  1978. if(is_array($education_certification)){
  1979. //删除掉没有成功返回路径的图片
  1980. foreach ($education_certification as $k => $v){
  1981. if(!array_key_exists('response',$v)){
  1982. unset($education_certification[$k]);
  1983. }
  1984. }
  1985. }
  1986. $info->education_certification = json_encode($education_certification);
  1987. //计生
  1988. // $family_planning = $request->input('family_planning');
  1989. // if(is_array($family_planning)){
  1990. // //删除掉没有成功返回路径的图片
  1991. // foreach ($family_planning as $k => $v){
  1992. // if(!array_key_exists('response',$v)){
  1993. // unset($family_planning[$k]);
  1994. // }
  1995. // }
  1996. // }
  1997. // $info->family_planning = json_encode($family_planning);
  1998. //失信查询 情况
  1999. $chengxin = $request->input('chengxin');
  2000. if(is_array($chengxin)){
  2001. //删除掉没有成功返回路径的图片
  2002. foreach ($chengxin as $k => $v){
  2003. if(!array_key_exists('response',$v)){
  2004. unset($chengxin[$k]);
  2005. }
  2006. }
  2007. }
  2008. $info->chengxin = json_encode($chengxin);
  2009. //综治
  2010. $manage = $request->input('manage');
  2011. if(is_array($manage)){
  2012. //删除掉没有成功返回路径的图片
  2013. foreach ($manage as $k => $v){
  2014. if(!array_key_exists('response',$v)){
  2015. unset($manage[$k]);
  2016. }
  2017. }
  2018. }
  2019. $info->manage = json_encode($manage);
  2020. $info->status = 0;
  2021. $info->save();
  2022. $appoint_info->political_audit = 4;
  2023. $appoint_info->save();
  2024. return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
  2025. }else{
  2026. $data['appoint_id'] = $appoint_id;
  2027. //身份证明
  2028. $identification = $request->input('identification');
  2029. if(is_array($identification)){
  2030. //删除掉没有成功返回路径的图片
  2031. foreach ($identification as $k => $v){
  2032. if(!array_key_exists('response',$v)){
  2033. unset($identification[$k]);
  2034. }
  2035. }
  2036. }
  2037. $data['identification'] = json_encode($identification);
  2038. //户口簿
  2039. $household_register = $request->input('household_register');
  2040. if(is_array($household_register)){
  2041. //删除掉没有成功返回路径的图片
  2042. foreach ($household_register as $k => $v){
  2043. if(!array_key_exists('response',$v)){
  2044. unset($household_register[$k]);
  2045. }
  2046. }
  2047. }
  2048. $data['household_register'] = json_encode($household_register);
  2049. //学信网
  2050. $education_certification = $request->input('education_certification');
  2051. if(is_array($education_certification)){
  2052. //删除掉没有成功返回路径的图片
  2053. foreach ($education_certification as $k => $v){
  2054. if(!array_key_exists('response',$v)){
  2055. unset($education_certification[$k]);
  2056. }
  2057. }
  2058. }
  2059. $data['education_certification'] = json_encode($education_certification);
  2060. //计生
  2061. // $family_planning = $request->input('family_planning');
  2062. // if(is_array($family_planning)){sp
  2063. // //删除掉没有成功返回路径的图片
  2064. // foreach ($family_planning as $k => $v){
  2065. // if(!array_key_exists('response',$v)){
  2066. // unset($family_planning[$k]);
  2067. // }
  2068. // }
  2069. // }
  2070. // $data['family_planning'] = json_encode($family_planning);
  2071. //失信查询 情况
  2072. $chengxin = $request->input('chengxin');
  2073. if(is_array($chengxin)){
  2074. //删除掉没有成功返回路径的图片
  2075. foreach ($chengxin as $k => $v){
  2076. if(!array_key_exists('response',$v)){
  2077. unset($chengxin[$k]);
  2078. }
  2079. }
  2080. }
  2081. $data['chengxin'] = json_encode($chengxin);
  2082. //综治
  2083. $manage = $request->input('manage');
  2084. if(is_array($manage)){
  2085. //删除掉没有成功返回路径的图片
  2086. foreach ($manage as $k => $v){
  2087. if(!array_key_exists('response',$v)){
  2088. unset($manage[$k]);
  2089. }
  2090. }
  2091. }
  2092. $data['manage'] = json_encode($manage);
  2093. $data['status'] = 0;
  2094. $data['type'] = 'supplement';
  2095. $result = RecruitSupplement::create($data);
  2096. $appoint_info->political_audit = 4;
  2097. $appoint_info->save();
  2098. return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
  2099. }
  2100. return ['status' => 0, 'msg' => 'test', 'data' => ''];
  2101. }
  2102. public function save_healthinfo(Request $request)
  2103. {
  2104. $user = $this->getUser();
  2105. if (!empty($user)) {
  2106. $uid = $user->id;
  2107. } else {
  2108. return redirect(route('login'));
  2109. }
  2110. $appoint_id = $request->input('appoint_id');
  2111. $type = $request->input('type');
  2112. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('id',$appoint_id)->first();
  2113. if(!$appoint_info){
  2114. return ['status' => 0, 'msg' => '抱歉,找不到您要登记的报名记录!'];
  2115. }
  2116. $recruit = Recruit::where('id',$appoint_info->recruit_id)->first();
  2117. $info = RecruitSupplement::where('appoint_id',$appoint_id)->where('type',$type)->first();
  2118. if($info){
  2119. if($info->h_status == 1){
  2120. return ['status' => 0, 'msg' => '材料已审核通过,不允许修改'];
  2121. }
  2122. if($info->h_status == 0){
  2123. return ['status' => 0, 'msg' => '材料审核中,不允许修改'];
  2124. }
  2125. $health_code = $request->input('health_code');
  2126. if(is_array($health_code)){
  2127. //删除掉没有成功返回路径的图片
  2128. foreach ($health_code as $k => $v){
  2129. if(!array_key_exists('response',$v)){
  2130. unset($health_code[$k]);
  2131. }
  2132. }
  2133. }
  2134. $info->health_code = json_encode($health_code);
  2135. $trip_code = $request->input('trip_code');
  2136. if(is_array($trip_code)){
  2137. //删除掉没有成功返回路径的图片
  2138. foreach ($trip_code as $k => $v){
  2139. if(!array_key_exists('response',$v)){
  2140. unset($trip_code[$k]);
  2141. }
  2142. }
  2143. }
  2144. $info->trip_code = json_encode($trip_code);
  2145. $info->h_status = 0;
  2146. $appoint_info->health_audit = 4;
  2147. $appoint_info->save();
  2148. $info->save();
  2149. return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
  2150. }else{
  2151. $data['appoint_id'] = $appoint_id;
  2152. $data['type'] = $type;
  2153. $data['h_status'] = 0;
  2154. $appoint_info->health_audit = 4;
  2155. $health_code = $request->input('health_code');
  2156. if(is_array($health_code)){
  2157. //删除掉没有成功返回路径的图片
  2158. foreach ($health_code as $k => $v){
  2159. if(!array_key_exists('response',$v)){
  2160. unset($health_code[$k]);
  2161. }
  2162. }
  2163. }
  2164. $health_result = $this->baiduService->health_code(file_get_contents(base_path() . "/public" . $health_code[0]['response']['path']));
  2165. $health_msg = ['健康码自动审核通过'];
  2166. //$h_status = 1;
  2167. //$appoint_info->health_audit = 1;
  2168. if(!array_key_exists('error_msg',$health_result) && !array_key_exists('error_code',$health_result)){
  2169. if(array_key_exists('姓名',$health_result)){
  2170. if(stripos($health_result['姓名'][0]['word'],'*')>0){
  2171. return ['status' => 0, 'msg' => '请打开健康码的“眼睛开关”,显示完整个人信息'];
  2172. }
  2173. if($health_result['姓名'][0]['word'] != $appoint_info->realname){
  2174. array_push($health_msg,'抱歉,请上传您本人的健康码!');
  2175. }
  2176. }else{
  2177. array_push($health_msg,'健康码错误,识别不到姓名!');
  2178. }
  2179. if(array_key_exists('状态',$health_result)){
  2180. if($health_result['状态'][0]['word'] != '绿码'){
  2181. array_push($health_msg,'抱歉,您的健康码非绿码!');
  2182. }
  2183. }else{
  2184. array_push($health_msg,'健康码错误,识别不到状态!');
  2185. }
  2186. if(array_key_exists('更新时间',$health_result)){
  2187. $time = strtotime($health_result['更新时间'][0]['word']);
  2188. if($time < strtotime($recruit->pen_health_start) || $time > strtotime($recruit->pen_health_end)){
  2189. array_push($health_msg,'抱歉,请上传{$recruit->pen_health_start}至{$recruit->pen_health_end}之间的健康码!');
  2190. }
  2191. }else{
  2192. array_push($health_msg,'健康码错误,识别不到时间!');
  2193. }
  2194. //$data['h_status'] = $h_status;
  2195. $data['h_msg'] = implode(';',$health_msg);
  2196. //$appoint_info->health_audit = $h_status == 1 ? 1 : 4;
  2197. $data['health_code'] = json_encode($health_code);
  2198. }
  2199. $data['health_result'] = json_encode($health_result);
  2200. $trip_code = $request->input('trip_code');
  2201. if(is_array($trip_code)){
  2202. //删除掉没有成功返回路径的图片
  2203. foreach ($trip_code as $k => $v){
  2204. if(!array_key_exists('response',$v)){
  2205. unset($trip_code[$k]);
  2206. }
  2207. }
  2208. }
  2209. $trip_result = $this->baiduService->trip_code(file_get_contents(base_path() . "/public" . $trip_code[0]['response']['path']));
  2210. $trip_msg = [];
  2211. $trip_status = 0;
  2212. if(!array_key_exists('error_msg',$trip_result) && !array_key_exists('error_code',$trip_result)){
  2213. if(array_key_exists('途经地',$trip_result['result'])){
  2214. $fangyi_area = explode("\r\n",config('aix.fangyi.fangyi_zhaokao.fangyi_zhaokao.risk_area'));
  2215. $result = array_intersect($fangyi_area,$trip_result['result']['途经地'][0]['word']);
  2216. if(count($result) > 0){
  2217. array_push($trip_msg,'抱歉,您的行程中包含系统设置中高风险地区!');
  2218. $trip_status = 0;
  2219. }
  2220. }
  2221. if(array_key_exists('风险性',$trip_result['result']) && $trip_result['result']['风险性']){
  2222. array_push($trip_msg,'抱歉,您的行程可能含有风险!');
  2223. $trip_status = 0;
  2224. }
  2225. if(array_key_exists('更新时间',$trip_result['result'])){
  2226. $time = strtotime($trip_result['result']['更新时间'][0]['word'][0]);
  2227. if($time > strtotime($recruit->pen_health_start) || $recruit < ($recruit->pen_health_end)){
  2228. array_push($trip_msg,'抱歉,请上传{$recruit->pen_health_start}至{$recruit->pen_health_end}之间的行程码!');
  2229. $trip_status = 0;
  2230. }
  2231. }
  2232. $data['h_msg'] .= implode(';',$trip_msg);
  2233. }
  2234. $data['trip_result'] = json_encode($trip_result);
  2235. $data['trip_code'] = json_encode($trip_code);
  2236. $data['h_status'] = 0;
  2237. $appoint_info->health_audit = 4;
  2238. RecruitSupplement::create($data);
  2239. $appoint_info->save();
  2240. return ['status' => 1, 'msg' => '提交成功,请刷新查看审核结果', 'data' => ''];
  2241. }
  2242. return ['status' => 0, 'msg' => 'test', 'data' => ''];
  2243. }
  2244. public function post_select(Request $request)
  2245. {
  2246. $user = $this->getUser();
  2247. if (!empty($user)) {
  2248. $uid = $user->id;
  2249. } else {
  2250. return redirect(route('login'));
  2251. }
  2252. $recruit_id = $request->input('recruit_id');
  2253. //$appoint_id = $request->input('appoint_id');
  2254. $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  2255. if(!$info){
  2256. return $this->showMessage('抱歉,您无需择岗!', route('recruit.show',array('id',$recruit_id)), true, '上一页', '2');
  2257. }
  2258. //手动设置择岗时间段
  2259. $time = time();
  2260. if($time > 1695096000 || $time < 1694998800){
  2261. //if($time > 1694491200){
  2262. return $this->showMessage('抱歉,未到择岗时间!', route('recruit.show',array('id',$recruit_id)), true, '上一页', '2');
  2263. }
  2264. if($info->type == 1){
  2265. $option_list = [
  2266. [
  2267. 'id' => 1,
  2268. 'name' => '陈埭镇'
  2269. ],
  2270. [
  2271. 'id' => 2,
  2272. 'name' => '池店镇'
  2273. ],
  2274. [
  2275. 'id' => 3,
  2276. 'name' => '金井镇'
  2277. ],
  2278. [
  2279. 'id' => 4,
  2280. 'name' => '龙湖镇'
  2281. ]
  2282. ];
  2283. }else{
  2284. $option_list = [
  2285. [
  2286. 'id' => 5,
  2287. 'name' => '陈埭镇'
  2288. ],
  2289. [
  2290. 'id' => 6,
  2291. 'name' => '金井镇'
  2292. ],
  2293. [
  2294. 'id' => 7,
  2295. 'name' => '龙湖镇'
  2296. ]
  2297. ];
  2298. }
  2299. $select_list = [];
  2300. if($info->result){
  2301. $result = json_decode($info->result,true);
  2302. foreach ($result as $v){
  2303. $item['name'] = $v;
  2304. array_push($select_list,$item);
  2305. }
  2306. }
  2307. // $recruit_id = $request->input('recruit_id');
  2308. // $appoint_id = $request->input('appoint_id');
  2309. // $uid = $request->input('uid');
  2310. // $info = RecruitAppointSelect::where('uid',$uid)->first();
  2311. // if(!$info){
  2312. // $info = new \stdClass();
  2313. // $info->status = 0;
  2314. // $info->recruit_id = 8;
  2315. // $info->appoint_id = rand(0,999999);
  2316. // $info->uid = rand(0,999999);
  2317. // }else{
  2318. // $result = json_decode($info->result,true);
  2319. // foreach ($option_list as $k => $v){
  2320. // if(in_array($v['name'],$result)){
  2321. // $select_list[$k] = $v;
  2322. // unset($option_list[$k]);
  2323. // }
  2324. // }
  2325. // }
  2326. $view_data = ['info' => $info,'options_list' => json_encode($option_list),'select_list' => json_encode($select_list)];
  2327. return view('app.recruit.post_select',$view_data);
  2328. }
  2329. /**
  2330. * 放弃择岗
  2331. */
  2332. public function give_up_post(Request $request)
  2333. {
  2334. //以下为测试环境
  2335. // $recruit_id = $request->input('recruit_id');
  2336. // $appoint_id = $request->input('appoint_id');
  2337. // $uid = $request->input('uid');
  2338. // $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->where('appoint_id',$appoint_id)->first();
  2339. // if($info){
  2340. // return ['status' => 0, 'msg' => "测试数据重复,请重新点击生成测试数据!"];
  2341. // }
  2342. // RecruitAppointSelect::create(['recruit_id'=>$recruit_id,'appoint_id'=>$appoint_id,'uid'=>$uid,'status'=>-1]);
  2343. // return ['status' => 1, 'msg' => "放弃择岗成功!"];
  2344. //以下为正式环境再放开
  2345. $user = $this->getUser();
  2346. if (!empty($user)) {
  2347. $uid = $user->id;
  2348. } else {
  2349. return redirect(route('login'));
  2350. }
  2351. $recruit_id = $request->input('recruit_id');
  2352. $appoint_id = $request->input('appoint_id');
  2353. $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->where('appoint_id',$appoint_id)->first();
  2354. if($info == null){
  2355. return ['status' => 0, 'msg' => "抱歉,您无需择岗!"];
  2356. }
  2357. if($info->status != 0){
  2358. return ['status' => 0, 'msg' => "抱歉,您不是待择岗状态!"];
  2359. }
  2360. $info->status = -1;
  2361. $info->save();
  2362. return ['status' => 1, 'msg' => "放弃择岗成功!"];
  2363. }
  2364. public function comfirm_post(Request $request)
  2365. {
  2366. $user = $this->getUser();
  2367. if (!empty($user)) {
  2368. $uid = $user->id;
  2369. } else {
  2370. return redirect(route('login'));
  2371. }
  2372. $recruit_id = $request->input('recruit_id');
  2373. $appoint_id = $request->input('appoint_id');
  2374. $time = time();
  2375. if($time > 1695096000 || $time < 1694998800){
  2376. return ['status' => 0, 'msg' => "抱歉,未到择岗时间!"];
  2377. }
  2378. $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->where('appoint_id',$appoint_id)->first();
  2379. if($info->result){
  2380. return ['status' => 0, 'msg' => "择岗数据已提交!"];
  2381. }
  2382. // $data = [
  2383. // 'recruit_id' => $recruit_id,
  2384. // 'appoint_id' => $recruit_id,
  2385. // 'uid' => $uid,
  2386. // 'status' => 1
  2387. // ];
  2388. $result = [];
  2389. $select = $request->input('select');
  2390. if(is_array($select) && count($select) > 0){
  2391. foreach ($select as $v) {
  2392. array_push($result,$v['name']);
  2393. }
  2394. }
  2395. $info->result = json_encode($result);
  2396. $info->status = 1;
  2397. $info->save();
  2398. return ['status' => 1, 'msg' => "提交择岗意愿成功,请耐心等待结果!"];
  2399. }
  2400. public function select_result(Request $request)
  2401. {
  2402. return view('app.recruit.select_result');
  2403. }
  2404. public function get_select_result(Request $request)
  2405. {
  2406. $redis = Cache::getRedis();
  2407. $quota = $redis->get('recruit_quotaA');
  2408. if(!$quota){
  2409. $quota = [
  2410. [
  2411. 'name' => '陈埭镇',
  2412. 'value' => 2
  2413. ],
  2414. [
  2415. 'name' => '池店镇',
  2416. 'value' => 1
  2417. ],
  2418. [
  2419. 'name' => '金井镇',
  2420. 'value' => 2
  2421. ],
  2422. [
  2423. 'name' => '龙湖镇',
  2424. 'value' => 2
  2425. ]
  2426. ];
  2427. $redis->set('recruit_quotaA',json_encode($quota));
  2428. }else{
  2429. $quota = json_decode($quota,true);
  2430. }
  2431. $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();
  2432. $return_data = [
  2433. 'list' => []
  2434. ];
  2435. $array_column = array_column($quota,'name');
  2436. if(count($list) > 1){
  2437. $current = $list[0];
  2438. $next = $list[1];
  2439. }else{
  2440. $current = $list[0];
  2441. $next = false;
  2442. }
  2443. $person_select_result = json_decode($current->result,true);
  2444. $flag = 0;//是否择岗成功
  2445. foreach ($person_select_result as $val){
  2446. //寻找下标
  2447. $index = array_search($val,$array_column);
  2448. if($quota[$index]['value']){
  2449. if($next && $current->record == $next->record && $current->record2 == $next->record2 && $current->record3 == $next->record3 && $quota[$index]['value'] == 1){
  2450. //如果当前处理人员不是最后一个,且分数与下一名人员三个维度完全一样的话并且该人员欲择的岗位仅剩一位,则特殊处理
  2451. //查找同样分数人同样志愿
  2452. $next_select_result = json_decode($next->result,true);
  2453. //寻找下标
  2454. $current_index = array_search($val,$person_select_result);
  2455. $next_index = array_search($val,$next_select_result);
  2456. if($current_index > $next_index){
  2457. //如果当前人员对当前镇街的意向排序大于下一人,调换两个指针,先排序下一个人
  2458. $current = $next;
  2459. }
  2460. }
  2461. $quota_data = [
  2462. 'index' => $index,
  2463. 'old_value' => $quota[$index]['value']
  2464. ];
  2465. //有名额允许择岗
  2466. DB::table('recruit_appoint_select')->where('id',$current->id)->update(['select_result'=>$val,'status' => 1]);
  2467. $current->select_result = $val;
  2468. $quota[$index]['value']--;
  2469. $quota_data['new_value'] = $quota[$index]['value'];
  2470. $redis->set('recruit_quotaA',json_encode($quota));
  2471. $flag = 1;
  2472. break;
  2473. }
  2474. }
  2475. if(!$flag){
  2476. $current->select_result = '未匹配到志愿,本轮择岗不成功!';
  2477. DB::table('recruit_appoint_select')->where('id',$current->id)->update(['select_result'=>'未匹配到志愿,本轮择岗不成功!','status' => -2]);
  2478. }
  2479. $return_data['quota'] = $quota_data;
  2480. return ['status' => 1, 'msg' => '择岗排序成功', 'data' => $return_data];
  2481. }
  2482. public function select_init(Request $request)
  2483. {
  2484. $count = DB::table('recruit_appoint_select')->whereRaw('select_result is null and batch = 3 and type = 2')->count();
  2485. $redis = Cache::getRedis();
  2486. $quotaA = $redis->get('recruit_quotaA');
  2487. $quotaB = $redis->get('recruit_quotaB');
  2488. if(!$quotaA){
  2489. $quotaA = [
  2490. [
  2491. 'name' => '梅岭街道',
  2492. 'value' => 3
  2493. ],
  2494. [
  2495. 'name' => '西园街道',
  2496. 'value' => 3
  2497. ],
  2498. [
  2499. 'name' => '罗山街道',
  2500. 'value' => 3
  2501. ],
  2502. [
  2503. 'name' => '新塘街道',
  2504. 'value' => 3
  2505. ],
  2506. [
  2507. 'name' => '陈埭镇',
  2508. 'value' => 10
  2509. ],
  2510. [
  2511. 'name' => '池店镇',
  2512. 'value' => 7
  2513. ],
  2514. [
  2515. 'name' => '安海镇',
  2516. 'value' => 5
  2517. ],
  2518. [
  2519. 'name' => '内坑镇',
  2520. 'value' => 3
  2521. ],
  2522. [
  2523. 'name' => '金井镇',
  2524. 'value' => 3
  2525. ],
  2526. [
  2527. 'name' => '龙湖镇',
  2528. 'value' => 5
  2529. ],
  2530. [
  2531. 'name' => '经济开发区',
  2532. 'value' => 5
  2533. ]
  2534. ];
  2535. $redis->set('recruit_quota',json_encode($quotaA));
  2536. }
  2537. if(!$quotaB){
  2538. $quotaB = [
  2539. [
  2540. 'name' => '青阳街道',
  2541. 'value' => 7
  2542. ],
  2543. [
  2544. 'name' => '梅岭街道',
  2545. 'value' => 14
  2546. ],
  2547. [
  2548. 'name' => '西园街道',
  2549. 'value' => 11
  2550. ],
  2551. [
  2552. 'name' => '罗山街道',
  2553. 'value' => 7
  2554. ],
  2555. [
  2556. 'name' => '灵源街道',
  2557. 'value' => 3
  2558. ],
  2559. [
  2560. 'name' => '新塘街道',
  2561. 'value' => 13
  2562. ],
  2563. [
  2564. 'name' => '陈埭镇',
  2565. 'value' => 49
  2566. ],
  2567. [
  2568. 'name' => '池店镇',
  2569. 'value' => 23
  2570. ],
  2571. [
  2572. 'name' => '安海镇',
  2573. 'value' => 16
  2574. ],
  2575. [
  2576. 'name' => '磁灶镇',
  2577. 'value' => 2
  2578. ],
  2579. [
  2580. 'name' => '内坑镇',
  2581. 'value' => 4
  2582. ],
  2583. [
  2584. 'name' => '紫帽镇',
  2585. 'value' => 8
  2586. ],
  2587. [
  2588. 'name' => '永和镇',
  2589. 'value' => 5
  2590. ],
  2591. [
  2592. 'name' => '金井镇',
  2593. 'value' => 11
  2594. ],
  2595. [
  2596. 'name' => '龙湖镇',
  2597. 'value' => 41
  2598. ],
  2599. [
  2600. 'name' => '经济开发区',
  2601. 'value' => 18
  2602. ]
  2603. ];
  2604. $redis->set('recruit_quota',json_encode($quotaB));
  2605. }
  2606. $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();
  2607. return ['status' => 1, 'msg' => '获取初始化信息成功', 'data' => ['count' => $count, 'quota' => $quotaB, 'list' => $list]];
  2608. }
  2609. public function interviewer_random(Request $request)
  2610. {
  2611. $model = $request->input('model',1);
  2612. $number1 = $request->input('number1',5);//考官人数
  2613. $number2 = $request->input('number2',1);//替补人数
  2614. $where[] = ['id','>',0];
  2615. switch ($model){
  2616. case '0':
  2617. $list = DB::table('recruit_interviewer')->get()->toArray();
  2618. shuffle($list);
  2619. $result = array_slice($list, 0, $number1+$number2);
  2620. break;
  2621. case '1':
  2622. $list = DB::table('recruit_interviewer')->get()->toArray();
  2623. shuffle($list);
  2624. $count = $number1;
  2625. for ($i = 0; $i < $count; $i++){
  2626. if(!$list[$i]->status){
  2627. $list[] = $list[$i];
  2628. unset($list[$i]);
  2629. $count++;
  2630. }
  2631. }
  2632. $result = array_slice($list, 0, $number1+$number2);
  2633. break;
  2634. case '2':
  2635. $list = DB::table('recruit_interviewer')->where('status',1)->get()->toArray();
  2636. shuffle($list);
  2637. $result = array_slice($list, 0, $number1+$number2);
  2638. break;
  2639. default:
  2640. $list = DB::table('recruit_interviewer')->get()->toArray();
  2641. shuffle($list);
  2642. for ($i = 0; $i < $number1; $i++){
  2643. dd($list[$i]);
  2644. if(!$list[$i]->status){
  2645. $list[] = $list[$i];
  2646. unset($list[$i]);
  2647. }
  2648. }
  2649. $result = array_slice($list, 0, $number1+$number2);
  2650. break;
  2651. }
  2652. $return_data = [
  2653. 'list' => $result,
  2654. 'number1' => $number1,
  2655. 'number2' => $number2
  2656. ];
  2657. return view('app.recruit.interviewer', $return_data);
  2658. }
  2659. public function supplement_info(Request $request)
  2660. {
  2661. $user = $this->getUser();
  2662. if (!empty($user)) {
  2663. $uid = $user->id;
  2664. } else {
  2665. return redirect(route('login'));
  2666. }
  2667. //招考id
  2668. $id = $request->input('id', 0);
  2669. if (!$id) {
  2670. return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
  2671. }
  2672. $recruit = Recruit::find($id);
  2673. if(!$recruit['status']){
  2674. return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2675. }
  2676. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  2677. if(!$appoint_info){
  2678. return $this->showMessage('抱歉,您没有报名,无需补充信息!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2679. }
  2680. $supplement_info = DB::table("recruit_supplement_cunwu")->where('uid',$uid)->where('appoint_id',$appoint_info->id)->first();
  2681. if($supplement_info){
  2682. return $this->showMessage('您已登记信息,无需再次登记!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2683. }
  2684. $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];//写死用户
  2685. if(!in_array($uid,$uids)){
  2686. return $this->showMessage('您无需登记信息!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2687. }
  2688. // $limit_time = 1661961599;
  2689. // $time = time();
  2690. // if( $time > $limit_time){
  2691. // return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2692. // }
  2693. $view_data = [];
  2694. //$view_data['info'] = json_encode($info);
  2695. $view_data['title'] = $recruit->company;
  2696. $view_data['id'] = $id;
  2697. return view('app.recruit.supplement_info',$view_data);
  2698. }
  2699. public function save_supplement_info(Request $request){
  2700. $user = $this->getUser();
  2701. if (!empty($user)) {
  2702. $uid = $user->id;
  2703. } else {
  2704. return redirect(route('login'));
  2705. }
  2706. //招考id
  2707. $id = $request->input('recruit_id', 0);
  2708. if (!$id) {
  2709. return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
  2710. }
  2711. $recruit = Recruit::find($id);
  2712. if(!$recruit['status']){
  2713. return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
  2714. }
  2715. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  2716. if(!$appoint_info){
  2717. return ['status' => 0, 'msg' => '抱歉,您没有报名,无需补充信息!', 'data' => ''];
  2718. }
  2719. if($request->input('marriage') == '已婚'){
  2720. if($request->input('spouse_card_type') == '' || $request->input('spouse_card') == '' || $request->input('spouse_realname') == '' || $request->input('spouse_mobile') == ''){
  2721. return ['status' => 0, 'msg' => '请完善配偶信息!', 'data' => ''];
  2722. }
  2723. }
  2724. $data = [
  2725. 'uid' => $uid,
  2726. 'appoint_id' => $appoint_info->id,
  2727. 'street' => $request->input('street'),
  2728. 'realname' => $request->input('realname'),
  2729. 'sex' => $request->input('sex'),
  2730. 'house' => $request->input('house'),
  2731. 'nation' => $request->input('nation'),
  2732. 'native' => $request->input('native'),
  2733. 'marriage' => $request->input('marriage'),
  2734. 'spouse_card_type' => $request->input('spouse_card_type'),
  2735. 'spouse_card' => $request->input('spouse_card'),
  2736. 'spouse_realname' => $request->input('spouse_realname'),
  2737. 'spouse_mobile' => $request->input('spouse_mobile'),
  2738. 'political' => $request->input('political'),
  2739. 'bank_card' => $request->input('bank_card'),
  2740. 'bank_open' => $request->input('bank_open'),
  2741. 'card' => $request->input('card'),
  2742. 'card_endtime' => $request->input('card_endtime'),
  2743. 'mobile' => $request->input('mobile'),
  2744. 'edu' => $request->input('education'),
  2745. 'pro' => $request->input('pro'),
  2746. 'address' => $request->input('address'),
  2747. 'funds' => $request->input('funds')
  2748. ];
  2749. DB::table('recruit_supplement_cunwu')->insert($data);
  2750. return ['status' => 1, 'msg' => '提交成功!', 'data' => ''];
  2751. }
  2752. public function comfirm_pen(Request $request){
  2753. $user = $this->getUser();
  2754. if (!empty($user)) {
  2755. $uid = $user->id;
  2756. } else {
  2757. return redirect(route('login'));
  2758. }
  2759. //招考id
  2760. $id = $request->input('recruit_id', 0);
  2761. if (!$id) {
  2762. return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
  2763. }
  2764. $recruit = Recruit::find($id);
  2765. if(!$recruit['status']){
  2766. return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
  2767. }
  2768. if(!$recruit->pen_comfirm){
  2769. return ['status' => 0, 'msg' => '该项目无须确认笔试考试!', 'data' => ''];
  2770. }
  2771. $appoint_info = RecruitAppointInfo::where('recruit_id',$id)->where('uid',$uid)->first();
  2772. if(!$appoint_info){
  2773. return ['status' => 0, 'msg' => '找不到您的报名记录,请检查!', 'data' => ''];
  2774. }
  2775. if($appoint_info->audit != 3){
  2776. return ['status' => 0, 'msg' => '您的报名未审核通过,无需确认!', 'data' => ''];
  2777. }
  2778. $time = time();
  2779. if(strtotime($recruit->pen_comfirm_start) > $time || strtotime($recruit->pen_comfirm_end) < $time){
  2780. return ['status' => 0, 'msg' => '未在笔试确认时间段!', 'data' => ''];
  2781. }
  2782. if($appoint_info->pen_audit != -2){
  2783. return ['status' => 0, 'msg' => '您已确认参加笔试,无需再次确认!', 'data' => ''];
  2784. }
  2785. $appoint_info->update(['pen_audit' => -1]);
  2786. $log = [
  2787. 'type' => 3,
  2788. 'appoint_id'=> $appoint_info->id,
  2789. 'uid' => $uid,
  2790. 'log' => '用户确认参加笔试'
  2791. ];
  2792. RecruitAppointLog::create($log);
  2793. return ['status' => 1, 'msg' => '确认成功', 'data' => $appoint_info->id];
  2794. }
  2795. public function supplementary_entry(Request $request){
  2796. $user = $this->getUser();
  2797. if (!empty($user)) {
  2798. $uid = $user->id;
  2799. } else {
  2800. return redirect(route('login'));
  2801. }
  2802. //招考id
  2803. $id = $request->input('recruit_id', 0);
  2804. if (!$id) {
  2805. return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
  2806. }
  2807. $recruit = Recruit::find($id);
  2808. if(!$recruit['status']){
  2809. return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
  2810. }
  2811. $appoint_info = RecruitAppointInfo::where('recruit_id',$id)->where('uid',$uid)->first();
  2812. if(!$appoint_info){
  2813. return ['status' => 0, 'msg' => '找不到您的报名记录,请检查!', 'data' => ''];
  2814. }
  2815. $time = time();
  2816. if($time > 1680969600){
  2817. return ['status' => 0, 'msg' => '已停止补充报名!', 'data' => ''];
  2818. }
  2819. if($appoint_info->adjust_limit){
  2820. $appoint_info->update(['adjust' => 1]);
  2821. return ['status' => 1, 'msg' => '补充报名成功!', 'data' => ''];
  2822. }else{
  2823. return ['status' => 0, 'msg' => '您无需补充报名!', 'data' => ''];
  2824. }
  2825. }
  2826. }