IndexController.php 142 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083
  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::where('status',1)->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', ['id', $recruit['id']]), true, '上一页', '3');
  345. }
  346. if ($recruit['current'] != 1 && $recruit['current'] != 2) {
  347. return $this->showMessage('抱歉,该项目报名通道已关闭,如有疑问,请联系客服!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
  348. }
  349. if($recruit['limit_times'] == 1){
  350. $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $id)->first();
  351. }else{
  352. $appoint_info_id = $request->input('appoint_info_id', 0);
  353. $appoint_info = null;
  354. if($appoint_info_id > 0){
  355. $appoint_info = RecruitAppointInfo::where('id', $appoint_info_id)->first();
  356. }
  357. }
  358. $time = time();
  359. $formDisabled = 0;
  360. $view_data['module'] = $forms = explode(',', $recruit['forms']);
  361. //查询报名表是否已有记录
  362. if ($appoint_info) {
  363. if (in_array('internship', $forms)) {
  364. //如果已有该场次的报名记录,读取录入的数据集合
  365. $user_info = $appoint_info;
  366. $user_info['sex'] = (string)$user_info['sex'];
  367. $user_info['adjust'] = (string)$user_info['adjust'];
  368. $user_info['edu_type'] = (string)$user_info['edu_type'];
  369. $user_info['family'] = json_decode($user_info['family']);
  370. $detail = RecruitAppointDetail::where('recruit_appoint_id', $user_info['id'])->first();
  371. if ($detail) {
  372. $user_info['detail'] = $detail->toArray();
  373. } else {
  374. $user_info['detail'] = [
  375. 'rewards_and_punishments' => '',
  376. 'introduce' => '',
  377. ];
  378. }
  379. if (json_decode($user_info['identification'])) {
  380. $identification = json_decode($user_info['identification'], true);
  381. foreach ($identification as $k => $v) {
  382. if (array_key_exists('response', $v)) {
  383. $identification[$k]['url'] = $v['response']['path'];
  384. }
  385. }
  386. } else {
  387. $identification = [];
  388. }
  389. $user_info['identification'] = $identification;
  390. if (json_decode($user_info['education_certification'])) {
  391. $education_certification = json_decode($user_info['education_certification'], true);
  392. foreach ($education_certification as $k => $v) {
  393. if (array_key_exists('response', $v)) {
  394. $education_certification[$k]['url'] = $v['response']['path'];
  395. }
  396. }
  397. } else {
  398. $education_certification = [];
  399. }
  400. $user_info['education_certification'] = $education_certification;
  401. if (json_decode($user_info['other_certification'])) {
  402. $other_certification = json_decode($user_info['other_certification'], true);
  403. foreach ($other_certification as $k => $v) {
  404. if (array_key_exists('response', $v)) {
  405. $other_certification[$k]['url'] = $v['response']['path'];
  406. }
  407. }
  408. } else {
  409. $other_certification = [];
  410. }
  411. $user_info['other_certification'] = $other_certification;
  412. if (json_decode($user_info['hj_certification'])) {
  413. $hj_certification = json_decode($user_info['hj_certification'], true);
  414. foreach ($hj_certification as $k => $v) {
  415. if (array_key_exists('response', $v)) {
  416. $hj_certification[$k]['url'] = $v['response']['path'];
  417. }
  418. }
  419. } else {
  420. $hj_certification = [];
  421. }
  422. $user_info['hj_certification'] = $hj_certification;
  423. if (json_decode($user_info['chengnuoshu'])) {
  424. $chengnuoshu = json_decode($user_info['chengnuoshu'], true);
  425. foreach ($chengnuoshu as $k => $v) {
  426. if (array_key_exists('response', $v)) {
  427. $chengnuoshu[$k]['url'] = $v['response']['path'];
  428. }
  429. }
  430. } else {
  431. $chengnuoshu = [];
  432. }
  433. $user_info['chengnuoshu'] = $chengnuoshu;
  434. if (json_decode($user_info['shixin'])) {
  435. $shixin = json_decode($user_info['shixin'], true);
  436. foreach ($shixin as $k => $v) {
  437. if (array_key_exists('response', $v)) {
  438. $shixin[$k]['url'] = $v['response']['path'];
  439. }
  440. }
  441. } else {
  442. $shixin = [];
  443. }
  444. $user_info['shixin'] = $shixin;
  445. if (json_decode($user_info['baokaoshengming'])) {
  446. $baokaoshengming = json_decode($user_info['baokaoshengming'], true);
  447. foreach ($baokaoshengming as $k => $v) {
  448. if (array_key_exists('response', $v)) {
  449. $baokaoshengming[$k]['url'] = $v['response']['path'];
  450. }
  451. }
  452. } else {
  453. $baokaoshengming = [];
  454. }
  455. $user_info['baokaoshengming'] = $baokaoshengming;
  456. //获取最新的报名审核信息
  457. $logs = RecruitAppointLog::where('appoint_id', $user_info->id)->where('step', 1)->where('type', 2)->orderBy('created_at', 'desc')->first();
  458. if ($logs) {
  459. $user_info['audit_log'] = $logs->log;
  460. } else {
  461. $user_info['audit_log'] = '';
  462. }
  463. } else {
  464. //如果已有该场次的报名记录,读取录入的数据集合
  465. $user_info = $appoint_info;
  466. $user_info['sex'] = (string)$user_info['sex'];
  467. $user_info['edu_type'] = (string)$user_info['edu_type'];
  468. $user_info['family'] = json_decode($user_info['family']);
  469. if (in_array('expand_special', $forms)) {
  470. $special = RecruitAppointExpandSpecial::where('recruit_appoint_id', $user_info['id'])->first();
  471. if ($special) {
  472. if (strpos($special['condition'], ',') !== false) {
  473. $special['condition'] = explode(',', $special['condition']);
  474. }
  475. $material = json_decode($special['material'], true);
  476. if (is_array($material)) {
  477. foreach ($material as $k => $v) {
  478. if (array_key_exists('response', $v)) {
  479. if (array_key_exists('path', $v['response'])) {
  480. $material[$k]['url'] = $v['response']['path'];
  481. }
  482. }
  483. }
  484. }
  485. } else {
  486. $material = [];
  487. $special = [
  488. 'point_apply' => '0',
  489. 'condition' => '',
  490. ];
  491. }
  492. $user_info['special'] = [
  493. 'point_apply' => (string)$special['point_apply'],
  494. 'condition' => $special['condition'],
  495. 'material' => $material,
  496. ];
  497. }
  498. if (in_array('detail', $forms)) {
  499. $detail = RecruitAppointDetail::where('recruit_appoint_id', $user_info['id'])->first();
  500. if ($detail) {
  501. $user_info['detail'] = $detail->toArray();
  502. } else {
  503. $user_info['detail'] = [
  504. 'train' => '',
  505. 'rewards_and_punishments' => '',
  506. 'introduce' => '',
  507. ];
  508. }
  509. }
  510. //如果有身份证明模块
  511. if (in_array('identification', $forms)) {
  512. if (json_decode($user_info['identification'])) {
  513. $identification = json_decode($user_info['identification'], true);
  514. foreach ($identification as $k => $v) {
  515. if (array_key_exists('response', $v)) {
  516. if (array_key_exists('path', $v['response'])) {
  517. $identification[$k]['url'] = $v['response']['path'];
  518. }
  519. }
  520. }
  521. } else {
  522. $identification = [];
  523. }
  524. $user_info['identification'] = $identification;
  525. }
  526. //如果有教育证明模块
  527. if (in_array('education_certification', $forms)) {
  528. if (json_decode($user_info['education_certification'])) {
  529. $education_certification = json_decode($user_info['education_certification'], true);
  530. foreach ($education_certification as $k => $v) {
  531. if (array_key_exists('response', $v)) {
  532. if (array_key_exists('path', $v['response'])) {
  533. $education_certification[$k]['url'] = $v['response']['path'];
  534. }
  535. }
  536. }
  537. } else {
  538. $education_certification = [];
  539. }
  540. $user_info['education_certification'] = $education_certification;
  541. }
  542. //如果有其他证明模块
  543. if (in_array('other_certification', $forms)) {
  544. if (json_decode($user_info['other_certification'])) {
  545. $other_certification = json_decode($user_info['other_certification'], true);
  546. foreach ($other_certification as $k => $v) {
  547. if (array_key_exists('response', $v)) {
  548. if (array_key_exists('path', $v['response'])) {
  549. $other_certification[$k]['url'] = $v['response']['path'];
  550. }
  551. }
  552. }
  553. } else {
  554. $other_certification = [];
  555. }
  556. $user_info['other_certification'] = $other_certification;
  557. }
  558. //如果有户籍证明模块
  559. if (in_array('hj_certification', $forms)) {
  560. if (json_decode($user_info['hj_certification'])) {
  561. $hj_certification = json_decode($user_info['hj_certification'], true);
  562. foreach ($hj_certification as $k => $v) {
  563. if (array_key_exists('response', $v)) {
  564. if (array_key_exists('path', $v['response'])) {
  565. $hj_certification[$k]['url'] = $v['response']['path'];
  566. }
  567. }
  568. }
  569. } else {
  570. $hj_certification = [];
  571. }
  572. $user_info['hj_certification'] = $hj_certification;
  573. }
  574. //如果有承诺书模块
  575. if (in_array('chengnuoshu', $forms)) {
  576. if (json_decode($user_info['chengnuoshu'])) {
  577. $chengnuoshu = json_decode($user_info['chengnuoshu'], true);
  578. foreach ($chengnuoshu as $k => $v) {
  579. if (array_key_exists('response', $v)) {
  580. if (array_key_exists('path', $v['response'])) {
  581. $chengnuoshu[$k]['url'] = $v['response']['path'];
  582. }
  583. }
  584. }
  585. } else {
  586. $chengnuoshu = [];
  587. }
  588. $user_info['chengnuoshu'] = $chengnuoshu;
  589. }
  590. //如果有失信被执行人模块
  591. if (in_array('shixin', $forms)) {
  592. if (json_decode($user_info['shixin'])) {
  593. $shixin = json_decode($user_info['shixin'], true);
  594. foreach ($shixin as $k => $v) {
  595. if (array_key_exists('response', $v)) {
  596. if (array_key_exists('path', $v['response'])) {
  597. $shixin[$k]['url'] = $v['response']['path'];
  598. }
  599. }
  600. }
  601. } else {
  602. $shixin = [];
  603. }
  604. $user_info['shixin'] = $shixin;
  605. }
  606. //如果有声明书模块
  607. if (in_array('baokaoshengming', $forms)) {
  608. if (json_decode($user_info['baokaoshengming'])) {
  609. $baokaoshengming = json_decode($user_info['baokaoshengming'], true);
  610. foreach ($baokaoshengming as $k => $v) {
  611. if (array_key_exists('response', $v)) {
  612. if (array_key_exists('path', $v['response'])) {
  613. $baokaoshengming[$k]['url'] = $v['response']['path'];
  614. }
  615. }
  616. }
  617. } else {
  618. $baokaoshengming = [];
  619. }
  620. $user_info['baokaoshengming'] = $baokaoshengming;
  621. }
  622. //获取最新的报名审核信息
  623. $logs = RecruitAppointLog::where('appoint_id', $user_info->id)->where('step', 1)->where('type', 2)->orderBy('created_at', 'desc')->first();
  624. if ($logs) {
  625. $user_info['audit_log'] = $logs->log;
  626. } else {
  627. $user_info['audit_log'] = '';
  628. }
  629. //获取提交报名的次数
  630. // $number = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',3)->count();
  631. // $post_number = $number+1;//todo
  632. }
  633. $appoint_info_id = $appoint_info->id;
  634. } else {
  635. //实习专场
  636. if (in_array('internship', $forms)) {
  637. $user_info = json_encode([
  638. 'id' => 0,
  639. 'recruit_id' => $id,
  640. 'operation' => 1,
  641. 'realname' => '',
  642. 'sex' => '1',
  643. 'birthday' => '',
  644. 'card' => '',
  645. 'nation' => '',
  646. 'native_place' => '',
  647. 'political_affiliation' => '',
  648. 'join_time' => '',
  649. 'house_register' => '',
  650. 'education' => '',
  651. 'school' => '',
  652. 'pro' => '',
  653. 'adjust' => '',
  654. 'mobile' => '',
  655. 'email' => '',
  656. 'address' => '',
  657. 'post_id' => '',
  658. 'concat_name' => '',
  659. 'concat_mobile' => '',
  660. 'resume' => '',
  661. 'avatar' => '',
  662. 'family' => [
  663. [
  664. 'relation' => '',
  665. 'realname' => '',
  666. 'birthday' => '',
  667. 'political_affiliation' => '',
  668. 'work' => '',
  669. ],
  670. ],
  671. 'detail' => [
  672. 'rewards_and_punishments' => '',
  673. 'introduce' => '',
  674. ],
  675. 'identification' => [],
  676. 'education_certification' => [],
  677. 'other_certification' => [],
  678. 'hj_certification' => [],
  679. 'chengnuoshu' => [],
  680. 'baokaoshengming' => [],
  681. 'shixin' => [],
  682. ]);
  683. } else {
  684. //如果没有,结合基础数据及模块表单信息,制作数据对象
  685. $user_info = RecruitAppointBasic::where('uid', $uid)->first();
  686. if (!$user_info) {
  687. //没有基础信息跳转完善route('person.recruitInfo')
  688. return $this->showMessage('请先完善招考基础信息!', route('recruit.recruitInfo', ['recruit_id', $id]), true, '上一页', '3');
  689. }
  690. $user_info['sex'] = (string)$user_info['sex'];
  691. $user_info['edu_type'] = (string)$user_info['edu_type'];
  692. $user_info['family'] = json_decode($user_info['family']);
  693. if (in_array('expand_special', $forms)) {
  694. $user_info['special'] = [
  695. 'point_apply' => '0',
  696. 'condition' => '',
  697. 'material' => [],
  698. ];
  699. }
  700. if (in_array('detail', $forms)) {
  701. $user_info['detail'] = [
  702. 'train' => '',
  703. 'rewards_and_punishments' => '',
  704. 'introduce' => '',
  705. ];
  706. }
  707. if (in_array('identification', $forms)) {
  708. $user_info['identification'] = [];
  709. }
  710. if (in_array('education_certification', $forms)) {
  711. $user_info['education_certification'] = [];
  712. }
  713. if (in_array('other_certification', $forms)) {
  714. $user_info['other_certification'] = [];
  715. }
  716. if (in_array('hj_certification', $forms)) {
  717. $user_info['hj_certification'] = [];
  718. }
  719. if (in_array('chengnuoshu', $forms)) {
  720. $user_info['chengnuoshu'] = [];
  721. }
  722. if (in_array('shixin', $forms)) {
  723. $user_info['shixin'] = [];
  724. }
  725. if (in_array('baokaoshengming', $forms)) {
  726. $user_info['baokaoshengming'] = [];
  727. }
  728. $user_info['recruit_id'] = $id;
  729. $user_info['operation'] = 1;
  730. }
  731. $appoint_info_id = 0;
  732. }
  733. //招考岗位
  734. $where_post[] = ['recruit_id', '=', $id];
  735. $where_post[] = ['status', '=', 1];
  736. $recruit_post = RecruitPost::where($where_post)->get();
  737. $post = [];
  738. $post_limit = [];
  739. $post_special = [];
  740. foreach ($recruit_post as $value) {
  741. $item = [
  742. 'value' => $value['id'],
  743. 'label' => $value['code'] . " " . $value['name'],
  744. ];
  745. $post_limit[$value['id']] = json_decode($value['limit']);
  746. $post_special[$value['id']] = json_decode($value['special']);
  747. array_push($post, $item);
  748. }
  749. $view_data['id'] = $id;
  750. $view_data['appoint_info'] = $user_info;
  751. $view_data['post'] = json_encode($post);
  752. // $view_data['post_number'] = $post_number;
  753. // $view_data['post_times'] = $recruit['post_times'];
  754. $view_data['post_limit'] = json_encode($post_limit);
  755. $view_data['post_special'] = json_encode($post_special);
  756. $view_data['formDisable'] = $formDisabled;
  757. $view_data['title'] = $recruit->company;
  758. $view_data['special_condition_type'] = $recruit->special_condition_type;
  759. $view_data['special_condition_value'] = json_decode($recruit->special_condition_value, true);
  760. return view('app.recruit.sign_up', $view_data);
  761. }
  762. public function preview(Request $request)
  763. {
  764. $modules = $request->input('modules');
  765. $view_data['module'] = $forms = explode(',', $modules);
  766. return view('app.recruit.preview', $view_data);
  767. }
  768. /**
  769. * 提交报名的处理程序
  770. * @param Request $request
  771. * @return array|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\think\response\Redirect|void
  772. */
  773. public function saveSignUp(Request $request)
  774. {
  775. $user = $this->getUser();
  776. if (!empty($user)) {
  777. $uid = $user->id;
  778. } else {
  779. return redirect(route('login'));
  780. }
  781. $recruit_id = $request->input('recruit_id', 0);
  782. if (!$recruit_id) {
  783. return response()->json(['status' => 0, 'msg' => '请选择项目!']);
  784. }
  785. $recruit = Recruit::find($recruit_id);
  786. // if(!$recruit['status']){
  787. // return response()->json(['status' => 0,'msg' => '抱歉,该项目状态不正确,请联系客服!']);
  788. // }
  789. if ($recruit['current'] != 1 && $recruit['current'] != 2) {
  790. return response()->json(['status' => 0, 'msg' => '抱歉,该项目报名通道已关闭,如有疑问,请联系客服!']);
  791. }
  792. $card = $request->input('card');
  793. $appointinfo_exist = RecruitAppointInfo::where('card', $card)->where('uid', '<>', $uid)->where('recruit_id', $recruit_id)->first();
  794. //兆丰建设两场公告二而一例外
  795. if ($recruit_id == 25 || $recruit_id == 26) {
  796. $special = RecruitAppointInfo::where('card', $card)->where('uid', '<>', $uid)->whereIn('recruit_id', [25, 26])->first();
  797. $appointinfo_exist = $appointinfo_exist & $special;
  798. }
  799. if ($appointinfo_exist) {
  800. return response()->json(['status' => 0, 'msg' => '您的证件已有其他账号的报名记录,请检查!']);
  801. }
  802. if($recruit['limit_times'] == 1){
  803. $time = time();
  804. $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $recruit_id)->first();
  805. if (($time < strtotime($recruit['apply_start']) || strtotime($recruit['apply_end']) < $time)) {//过了招考时间
  806. if (!$appoint_info) {
  807. return response()->json(['status' => 0, 'msg' => '抱歉,该项目已过报名时间!']);
  808. }
  809. if (($time < strtotime($recruit['audit_start']) || strtotime($recruit['audit_end']) < $time)) {//过了审核时间
  810. return response()->json(['status' => 0, 'msg' => '抱歉,该项目已过审核时间,无法继续报名!']);
  811. }
  812. //如果有报名记录,先查询首次报名是什么时候
  813. $first_post = RecruitAppointLog::where('type', 3)->where('uid', $uid)->orderBy('created_at', 'asc')->first();
  814. if (!$first_post) {//没有记录代表只是暂存
  815. return response()->json(['status' => 0, 'msg' => '抱歉,该项目已过报名时间!']);
  816. }
  817. }
  818. }else{
  819. $time = time();
  820. $id = $request->input('id');
  821. if($id > 0){
  822. $appoint_info = RecruitAppointInfo::where('id', $id)->first();
  823. }else{
  824. $post_id = $request->input('post_id');
  825. $appoint_info_post = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $recruit_id)->where('post_id',$post_id)->first();
  826. if($appoint_info_post){
  827. return response()->json(['status' => 0, 'msg' => '相同岗位已存在报名记录,请检查 !']);
  828. }
  829. $appoint_info_count = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $recruit_id)->count();
  830. if($appoint_info_count >= $recruit['limit_times']){
  831. return response()->json(['status' => 0, 'msg' => '超过报名次数上限!']);
  832. }
  833. $appoint_info = null;
  834. }
  835. if (($time < strtotime($recruit['apply_start']) || strtotime($recruit['apply_end']) < $time)) {//过了招考时间
  836. if($id == 0){
  837. return response()->json(['status' => 0, 'msg' => '抱歉,该项目已过报名时间!']);
  838. }
  839. $first_post = RecruitAppointLog::where('appoint_id',$id)->where('type', 3)->where('uid', $uid)->orderBy('created_at', 'asc')->first();
  840. if (!$first_post) {//没有记录代表只是暂存
  841. return response()->json(['status' => 0, 'msg' => '抱歉,该项目已过报名时间!']);
  842. }
  843. }
  844. }
  845. $data = $request->only('realname', 'sex', 'birthday', 'avatar', 'nation', 'native_place', 'political_affiliation', 'titles', 'join_time', 'work', 'house_register', 'education', 'school', 'degree', 'pro', 'address', 'card_type', 'card', 'mobile', 'email', 'concat_name', 'concat_mobile', 'resume', 'post_id', 'adjust', 'remark', 'graduation');
  846. if (!array_key_exists('post_id', $data)) {
  847. return response()->json(['status' => 0, 'msg' => '请选择报考岗位']);
  848. }
  849. $post_info = RecruitPost::where('id', $data['post_id'])->where('recruit_id', $recruit_id)->first();
  850. if (!$post_info['status'] || $post_info['deleted_at'] != null) {
  851. return response()->json(['status' => 0, 'msg' => '该岗位已失效']);
  852. }
  853. //获取操作符,是暂存还是提交
  854. $operation = $request->input('operation');
  855. if ($operation == 1) {
  856. $data['audit'] = 0;//暂存
  857. } else {
  858. //基础信息的检查
  859. $rules = [
  860. 'realname' => 'required',
  861. 'sex' => 'required',
  862. 'birthday' => 'required',
  863. 'avatar' => 'required',
  864. 'nation' => 'required',
  865. 'native_place' => 'required',
  866. 'political_affiliation' => 'required',
  867. 'post_id' => 'required',
  868. 'house_register' => 'required',
  869. //'edu_type' => 'required',
  870. 'education' => 'required',
  871. 'school' => 'required',
  872. 'graduation' => 'required',
  873. 'address' => 'required',
  874. 'mobile' => 'required',
  875. 'email' => 'required',
  876. 'card_type' => 'required',
  877. 'card' => 'required',
  878. 'concat_name' => 'required',
  879. 'concat_mobile' => 'required',
  880. 'resume' => 'required',
  881. ];
  882. $messages = [
  883. 'realname.required' => '请填写姓名',
  884. 'sex.required' => '请填写性别',
  885. 'birthday.required' => '请填写出生日期',
  886. 'avatar.required' => '请上传彩色免冠照',
  887. 'nation.required' => '请填写民族',
  888. 'native_place.required' => '请填写籍贯',
  889. 'political_affiliation.required' => '请选择政治面貌',
  890. 'post_id.required' => '请选择报名岗位',
  891. 'house_register.required' => '请填写户籍所在地',
  892. //'edu_type.required' => '请选择教育类型',
  893. 'education.required' => '请输入学历',
  894. 'school.required' => '请输入毕业院校',
  895. 'graduation.required' => '请填写毕业时间',
  896. 'address.required' => '请填写通信地址',
  897. 'mobile.required' => '请填写手机号码',
  898. 'email.required' => '请填写电子邮箱',
  899. 'card_type.required' => '请选择证件类型',
  900. 'card.required' => '请填写身份证号码',
  901. 'resume.required' => '请填写个人简历',
  902. 'concat_name.required' => '请填写联系人姓名',
  903. 'concat_mobile.required' => '请填写联系人手机号码',
  904. ];
  905. $create_data = $request->all();
  906. $validator = Validator::make($create_data, $rules, $messages);
  907. if ($validator->fails()) {
  908. $msg = $validator->errors()->all();
  909. return response()->json(['status' => 0, 'msg' => $msg[0]]);
  910. }
  911. $data['audit'] = 1;//提交
  912. }
  913. if (strlen($data['card']) == 18) {
  914. //身份证判断出生日期和性别
  915. $year = substr($data['card'], 6, 4);
  916. $month = substr($data['card'], 10, 2);
  917. $day = substr($data['card'], 12, 2);
  918. if ($year . '-' . $month . '-' . $day != $data['birthday']) {
  919. $data['birthday'] = $year . '-' . $month . '-' . $day;
  920. }
  921. if (intval(substr($data['card'], 16, 1)) % 2 == 0) {
  922. $data['sex'] = 0;
  923. } else {
  924. $data['sex'] = 1;
  925. }
  926. }
  927. try {
  928. if (!empty($post_info['limit']) && json_decode($post_info['limit'])) {
  929. //岗位限制条件的判断
  930. $post_limit = json_decode($post_info['limit'], true);
  931. if (is_array($post_limit)) {
  932. foreach ($post_limit as $k => $v) {
  933. if ($k == 'birthday') {
  934. $value = str_replace('-', '', $data[$k]);
  935. } else {
  936. $value = $data[$k];
  937. }
  938. switch ($v['op']) {
  939. case '=':
  940. if ($value != $v['value']) {
  941. return response()->json(['status' => 0, 'msg' => $v['msg']]);
  942. }
  943. break;
  944. case '>':
  945. if ($value <= $v['value']) {
  946. return response()->json(['status' => 0, 'msg' => $v['msg']]);
  947. }
  948. break;
  949. case '>=':
  950. if ($value < $v['value']) {
  951. return response()->json(['status' => 0, 'msg' => $v['msg']]);
  952. }
  953. break;
  954. case '<':
  955. if ($value >= $v['value']) {
  956. return response()->json(['status' => 0, 'msg' => $v['msg']]);
  957. }
  958. break;
  959. case '<=':
  960. if ($value > $v['value']) {
  961. return response()->json(['status' => 0, 'msg' => $v['msg']]);
  962. }
  963. break;
  964. case '!=':
  965. if ($value == $v['value']) {
  966. return response()->json(['status' => 0, 'msg' => $v['msg']]);
  967. }
  968. break;
  969. case 'like':
  970. if (strpos($value, $v['value']) === false) {
  971. return response()->json(['status' => 0, 'msg' => $v['msg']]);
  972. }
  973. break;
  974. case 'in':
  975. if (strpos($v['value'], $value) === false) {
  976. return response()->json(['status' => 0, 'msg' => $v['msg']]);
  977. }
  978. break;
  979. }
  980. }
  981. }
  982. }
  983. } catch (\Exception $e) {
  984. error_log(serialize($data), 3, '/data/wwwroot/jucai/sms');
  985. return ['status' => 0, 'msg' => '数据有误,请联系客服'];
  986. }
  987. //前置审核 判断完成,先将数据入报名信息基础表
  988. //解析家庭成员数据
  989. $familys = $request->input('family');
  990. $family = [];
  991. if (is_array($familys)) {
  992. foreach ($familys as $value) {
  993. 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)) {
  994. return ['status' => 0, 'msg' => '请填写完整的家庭成员信息'];
  995. }
  996. $item = [
  997. 'relation' => $value['relation'],
  998. 'realname' => $value['realname'],
  999. 'birthday' => $value['birthday'],
  1000. 'political_affiliation' => $value['political_affiliation'],
  1001. 'work' => $value['work'],
  1002. ];
  1003. array_push($family, $item);
  1004. }
  1005. }
  1006. $forms = explode(',', $recruit['forms']);
  1007. if (in_array('expand_special', $forms)) {
  1008. $special = $request->input('special');
  1009. if ($special['point_apply'] && is_array($special['condition']) && count($special['condition']) == 0) {
  1010. return response()->json(['status' => 0, 'msg' => '加分条件不能为空']);
  1011. }
  1012. if ($special['point_apply'] && ($special['condition'] == '')) {
  1013. return response()->json(['status' => 0, 'msg' => '加分条件不能为空']);
  1014. }
  1015. }
  1016. $data['family'] = json_encode($family);
  1017. if ($appoint_info) {
  1018. //如果已有报名记录,进入修改阶段的处理流程
  1019. DB::beginTransaction();
  1020. try {
  1021. RecruitAppointInfo::where('id', $appoint_info->id)->update($data);
  1022. //分模块解析数据
  1023. //如果有加分模块
  1024. if (in_array('expand_special', $forms)) {
  1025. $special = $request->input('special');
  1026. if ($special['point_apply']) {//如果申请加分
  1027. if (!array_key_exists('material', $special)) {
  1028. return response()->json(['status' => 0, 'msg' => '加分佐证材料不能为空!']);
  1029. }
  1030. //删除掉没有成功返回路径的图片
  1031. if (is_array($special['material'])) {
  1032. foreach ($special['material'] as $k => $v) {
  1033. if (!array_key_exists('response', $v)) {
  1034. unset($special['material'][$k]);
  1035. }
  1036. }
  1037. }
  1038. switch ($recruit->special_condition_type) {
  1039. case 0:
  1040. $special['point'] = 0;
  1041. break;
  1042. case 1:
  1043. $special_rule = json_decode($recruit->special_condition_value, true);
  1044. $conditions = array_column($special_rule['list'], 'condition');
  1045. $special['point'] = 0;
  1046. if (array_key_exists('multi', $special_rule) && $special_rule['multi'] && is_array($special['condition'])) {
  1047. foreach ($special['condition'] as $v) {
  1048. $key = array_search($v, $conditions);
  1049. $rule_info = $special_rule['list'][$key];
  1050. $special['point'] += $rule_info['value'];
  1051. }
  1052. } else {
  1053. $key = array_search($special['condition'], $conditions);
  1054. $rule_info = $special_rule['list'][$key];
  1055. $special['point'] += $rule_info['value'];
  1056. }
  1057. break;
  1058. case 2:
  1059. $special_rule = json_decode($post_info['special'], true);
  1060. $conditions = array_column($special_rule['list'], 'condition');
  1061. $special['point'] = 0;
  1062. if (array_key_exists('multi', $special_rule) && $special_rule['multi'] && is_array($special['condition'])) {
  1063. foreach ($special['condition'] as $v) {
  1064. $key = array_search($v, $conditions);
  1065. $rule_info = $special_rule['list'][$key];
  1066. $special['point'] += $rule_info['value'];
  1067. }
  1068. } else {
  1069. $key = array_search($special['condition'], $conditions);
  1070. $rule_info = $special_rule['list'][$key];
  1071. $special['point'] += $rule_info['value'];
  1072. }
  1073. break;
  1074. }
  1075. if (is_array($special['condition'])) {
  1076. $special['condition'] = implode(',', $special['condition']);
  1077. }
  1078. $special['material'] = json_encode($special['material']);
  1079. $hasRecord = RecruitAppointExpandSpecial::where('recruit_appoint_id', $appoint_info->id)->first();
  1080. if ($hasRecord) {
  1081. RecruitAppointExpandSpecial::where('recruit_appoint_id', $appoint_info->id)->update($special);
  1082. } else {
  1083. $special['recruit_appoint_id'] = $appoint_info->id;
  1084. RecruitAppointExpandSpecial::create($special);
  1085. }
  1086. } else {
  1087. RecruitAppointExpandSpecial::where('recruit_appoint_id', $appoint_info->id)->update(['point_apply' => 0, 'condition' => '', 'point' => 0, 'material' => null]);
  1088. }
  1089. }
  1090. //如果有详情模块
  1091. if (in_array('detail', $forms) || in_array('internship', $forms)) {
  1092. $detail = $request->input('detail');
  1093. $hasRecord = RecruitAppointDetail::where('recruit_appoint_id', $appoint_info->id)->first();
  1094. if ($hasRecord) {
  1095. RecruitAppointDetail::where('recruit_appoint_id', $appoint_info->id)->update($detail);
  1096. } else {
  1097. $detail['recruit_appoint_id'] = $appoint_info->id;
  1098. RecruitAppointDetail::create($detail);
  1099. }
  1100. }
  1101. //如果有身份证明模块
  1102. if (in_array('identification', $forms) || in_array('internship', $forms)) {
  1103. $identification = $request->input('identification');
  1104. if (is_array($identification)) {
  1105. //删除掉没有成功返回路径的图片
  1106. foreach ($identification as $k => $v) {
  1107. if (!array_key_exists('response', $v)) {
  1108. unset($identification[$k]);
  1109. }
  1110. }
  1111. }
  1112. $appoint_info->identification = json_encode($identification);
  1113. $appoint_info->save();
  1114. }
  1115. //如果有教育证明模块
  1116. if (in_array('education_certification', $forms) || in_array('internship', $forms)) {
  1117. $education_certification = $request->input('education_certification');
  1118. if (is_array($education_certification)) {
  1119. //删除掉没有成功返回路径的图片
  1120. foreach ($education_certification as $k => $v) {
  1121. if (!array_key_exists('response', $v)) {
  1122. unset($education_certification[$k]);
  1123. }
  1124. }
  1125. }
  1126. $appoint_info->education_certification = json_encode($education_certification);
  1127. $appoint_info->save();
  1128. }
  1129. //如果有其他证明模块
  1130. if (in_array('other_certification', $forms) || in_array('internship', $forms)) {
  1131. $other_certification = $request->input('other_certification');
  1132. if (is_array($other_certification)) {
  1133. //删除掉没有成功返回路径的图片
  1134. foreach ($other_certification as $k => $v) {
  1135. if (!array_key_exists('response', $v)) {
  1136. unset($other_certification[$k]);
  1137. }
  1138. }
  1139. }
  1140. if ($other_certification) {
  1141. $appoint_info->other_certification = json_encode($other_certification);
  1142. $appoint_info->save();
  1143. }
  1144. }
  1145. //如果有其他证明模块
  1146. if (in_array('hj_certification', $forms)) {
  1147. $hj_certification = $request->input('hj_certification');
  1148. if (is_array($hj_certification)) {
  1149. //删除掉没有成功返回路径的图片
  1150. foreach ($hj_certification as $k => $v) {
  1151. if (!array_key_exists('response', $v)) {
  1152. unset($hj_certification[$k]);
  1153. }
  1154. }
  1155. }
  1156. if ($hj_certification) {
  1157. $appoint_info->hj_certification = json_encode($hj_certification);
  1158. $appoint_info->save();
  1159. }
  1160. }
  1161. //如果有承诺书模块
  1162. if (in_array('chengnuoshu', $forms)) {
  1163. $chengnuoshu = $request->input('chengnuoshu');
  1164. if (is_array($chengnuoshu)) {
  1165. //删除掉没有成功返回路径的图片
  1166. foreach ($chengnuoshu as $k => $v) {
  1167. if (!array_key_exists('response', $v)) {
  1168. unset($chengnuoshu[$k]);
  1169. }
  1170. }
  1171. }
  1172. if ($chengnuoshu) {
  1173. $appoint_info->chengnuoshu = json_encode($chengnuoshu);
  1174. $appoint_info->save();
  1175. }
  1176. }
  1177. //如果有失信被执行人模块
  1178. if (in_array('shixin', $forms)) {
  1179. $shixin = $request->input('shixin');
  1180. if (is_array($shixin)) {
  1181. //删除掉没有成功返回路径的图片
  1182. foreach ($shixin as $k => $v) {
  1183. if (!array_key_exists('response', $v)) {
  1184. unset($shixin[$k]);
  1185. }
  1186. }
  1187. }
  1188. if ($shixin) {
  1189. $appoint_info->shixin = json_encode($shixin);
  1190. $appoint_info->save();
  1191. }
  1192. }
  1193. //如果有声明书模块
  1194. if (in_array('baokaoshengming', $forms)) {
  1195. $baokaoshengming = $request->input('baokaoshengming');
  1196. if (is_array($baokaoshengming)) {
  1197. //删除掉没有成功返回路径的图片
  1198. foreach ($baokaoshengming as $k => $v) {
  1199. if (!array_key_exists('response', $v)) {
  1200. unset($baokaoshengming[$k]);
  1201. }
  1202. }
  1203. }
  1204. if ($baokaoshengming) {
  1205. $appoint_info->baokaoshengming = json_encode($baokaoshengming);
  1206. $appoint_info->save();
  1207. }
  1208. }
  1209. DB::commit();
  1210. if ($operation == 2) {
  1211. $log = [
  1212. 'type' => 3,
  1213. 'appoint_id' => $appoint_info->id,
  1214. 'uid' => $uid,
  1215. 'log' => '用户提交报名',
  1216. ];
  1217. RecruitAppointLog::create($log);
  1218. if (empty($recruit->qr_code)) {
  1219. return ['status' => 1, 'msg' => '提交成功', 'data' => $appoint_info->id, 'is_html' => 0];
  1220. } else {
  1221. return ['status' => 1, 'msg' => "<h3 style='text-align: center'>提交成功,添加工作人员企业微信了解后续信息</h3><p style='text-align: center'><img src='{$recruit->qr_code}' width='240' height='240' /></p>", 'data' => $appoint_info->id, 'is_html' => 1];
  1222. }
  1223. } else {
  1224. return ['status' => 1, 'msg' => '资料保存成功,请尽快完善并提交', 'data' => $appoint_info->id];
  1225. }
  1226. } catch (\Exception $e) {
  1227. DB::rollback();
  1228. return ['status' => 0, 'msg' => $e->getMessage()];
  1229. }
  1230. } else {
  1231. //没有报名记录,进入增加阶段的处理流程
  1232. DB::beginTransaction();
  1233. try {
  1234. //20220726增加地区undefined选项处理
  1235. if ($index = stripos($data['native_place'], ',undefined')) {
  1236. $data['native_place'] = substr($data['native_place'], 0, $index);
  1237. }
  1238. if ($index = stripos($data['house_register'], ',undefined')) {
  1239. $data['house_register'] = substr($data['house_register'], 0, $index);
  1240. }
  1241. $data['uid'] = $uid;
  1242. $data['recruit_id'] = $recruit_id;
  1243. $result = RecruitAppointInfo::create($data);
  1244. //分模块解析数据
  1245. $forms = explode(',', $recruit['forms']);
  1246. //如果有加分模块
  1247. if (in_array('expand_special', $forms)) {
  1248. $special = $request->input('special');
  1249. if ($special['point_apply']) {
  1250. if (is_array($special['material'])) {
  1251. //删除掉没有成功返回路径的图片
  1252. foreach ($special['material'] as $k => $v) {
  1253. if (!array_key_exists('response', $v)) {
  1254. unset($special['material'][$k]);
  1255. }
  1256. }
  1257. }
  1258. switch ($recruit->special_condition_type) {
  1259. case 0:
  1260. $special['point'] = 0;
  1261. break;
  1262. case 1:
  1263. $special_rule = json_decode($recruit->special_condition_value, true);
  1264. $conditions = array_column($special_rule['list'], 'condition');
  1265. $special['point'] = 0;
  1266. if (array_key_exists('multi', $special_rule) && $special_rule['multi'] && is_array($special['condition'])) {
  1267. foreach ($special['condition'] as $v) {
  1268. $key = array_search($v, $conditions);
  1269. $rule_info = $special_rule['list'][$key];
  1270. $special['point'] += $rule_info['value'];
  1271. }
  1272. } else {
  1273. $key = array_search($special['condition'], $conditions);
  1274. $rule_info = $special_rule['list'][$key];
  1275. $special['point'] += $rule_info['value'];
  1276. }
  1277. break;
  1278. case 2:
  1279. $special_rule = json_decode($post_info['special'], true);
  1280. $conditions = array_column($special_rule['list'], 'condition');
  1281. $special['point'] = 0;
  1282. if (array_key_exists('multi', $special_rule) && $special_rule['multi'] && is_array($special['condition'])) {
  1283. foreach ($special['condition'] as $v) {
  1284. $key = array_search($v, $conditions);
  1285. $rule_info = $special_rule['list'][$key];
  1286. $special['point'] += $rule_info['value'];
  1287. }
  1288. } else {
  1289. $key = array_search($special['condition'], $conditions);
  1290. $rule_info = $special_rule['list'][$key];
  1291. $special['point'] += $rule_info['value'];
  1292. }
  1293. break;
  1294. }
  1295. if (is_array($special['condition'])) {
  1296. $special['condition'] = implode(',', $special['condition']);
  1297. }
  1298. $special['material'] = json_encode($special['material']);
  1299. $special['recruit_appoint_id'] = $result->id;
  1300. RecruitAppointExpandSpecial::create($special);
  1301. }
  1302. }
  1303. //如果有详情模块
  1304. if (in_array('detail', $forms) || in_array('internship', $forms)) {
  1305. $detail = $request->input('detail');
  1306. $detail['recruit_appoint_id'] = $result->id;
  1307. RecruitAppointDetail::create($detail);
  1308. }
  1309. //如果有身份证明模块
  1310. if (in_array('identification', $forms) || in_array('internship', $forms)) {
  1311. $identification = $request->input('identification');
  1312. if (is_array($identification)) {
  1313. //删除掉没有成功返回路径的图片
  1314. foreach ($identification as $k => $v) {
  1315. if (!array_key_exists('response', $v)) {
  1316. unset($identification[$k]);
  1317. }
  1318. }
  1319. }
  1320. $result->identification = json_encode($identification);
  1321. $result->save();
  1322. }
  1323. //如果有教育证明模块
  1324. if (in_array('education_certification', $forms) || in_array('internship', $forms)) {
  1325. $education_certification = $request->input('education_certification');
  1326. if (is_array($education_certification)) {
  1327. //删除掉没有成功返回路径的图片
  1328. foreach ($education_certification as $k => $v) {
  1329. if (!array_key_exists('response', $v)) {
  1330. unset($education_certification[$k]);
  1331. }
  1332. }
  1333. }
  1334. $result->education_certification = json_encode($education_certification);
  1335. $result->save();
  1336. }
  1337. //如果有其他证明模块
  1338. if (in_array('other_certification', $forms) || in_array('internship', $forms)) {
  1339. $other_certification = $request->input('other_certification');
  1340. if ($other_certification) {
  1341. if (is_array($other_certification)) {
  1342. //删除掉没有成功返回路径的图片
  1343. foreach ($other_certification as $k => $v) {
  1344. if (!array_key_exists('response', $v)) {
  1345. unset($other_certification[$k]);
  1346. }
  1347. }
  1348. }
  1349. $result->other_certification = json_encode($other_certification);
  1350. $result->save();
  1351. }
  1352. }
  1353. //如果有户籍证明模块
  1354. if (in_array('hj_certification', $forms)) {
  1355. $hj_certification = $request->input('hj_certification');
  1356. if ($hj_certification) {
  1357. if (is_array($hj_certification)) {
  1358. //删除掉没有成功返回路径的图片
  1359. foreach ($hj_certification as $k => $v) {
  1360. if (!array_key_exists('response', $v)) {
  1361. unset($hj_certification[$k]);
  1362. }
  1363. }
  1364. }
  1365. $result->hj_certification = json_encode($hj_certification);
  1366. $result->save();
  1367. }
  1368. }
  1369. //如果有承诺书模块
  1370. if (in_array('chengnuoshu', $forms)) {
  1371. $chengnuoshu = $request->input('chengnuoshu');
  1372. if ($chengnuoshu) {
  1373. if (is_array($chengnuoshu)) {
  1374. //删除掉没有成功返回路径的图片
  1375. foreach ($chengnuoshu as $k => $v) {
  1376. if (!array_key_exists('response', $v)) {
  1377. unset($chengnuoshu[$k]);
  1378. }
  1379. }
  1380. }
  1381. $result->chengnuoshu = json_encode($chengnuoshu);
  1382. $result->save();
  1383. }
  1384. }
  1385. //如果有失信被执行人模块
  1386. if (in_array('shixin', $forms)) {
  1387. $shixin = $request->input('shixin');
  1388. if ($shixin) {
  1389. if (is_array($shixin)) {
  1390. //删除掉没有成功返回路径的图片
  1391. foreach ($shixin as $k => $v) {
  1392. if (!array_key_exists('response', $v)) {
  1393. unset($shixin[$k]);
  1394. }
  1395. }
  1396. }
  1397. $result->shixin = json_encode($shixin);
  1398. $result->save();
  1399. }
  1400. }
  1401. //如果有声明书模块
  1402. if (in_array('baokaoshengming', $forms)) {
  1403. $baokaoshengming = $request->input('baokaoshengming');
  1404. if ($baokaoshengming) {
  1405. if (is_array($baokaoshengming)) {
  1406. //删除掉没有成功返回路径的图片
  1407. foreach ($baokaoshengming as $k => $v) {
  1408. if (!array_key_exists('response', $v)) {
  1409. unset($baokaoshengming[$k]);
  1410. }
  1411. }
  1412. }
  1413. $result->baokaoshengming = json_encode($baokaoshengming);
  1414. $result->save();
  1415. }
  1416. }
  1417. DB::commit();
  1418. if ($operation == 2) {
  1419. $log = [
  1420. 'type' => 3,
  1421. 'appoint_id' => $result->id,
  1422. 'uid' => $uid,
  1423. 'log' => '用户首次提交报名',
  1424. ];
  1425. RecruitAppointLog::create($log);
  1426. if (empty($recruit->qr_code)) {
  1427. return ['status' => 1, 'msg' => '提交成功', 'data' => $result->id, 'is_html' => 0];
  1428. } else {
  1429. return ['status' => 1, 'msg' => "<h3 style='text-align: center'>提交成功,添加工作人员企业微信了解后续信息</h3><p><img src='/storage/{$recruit->qr_code}' width='240' height='240' /></p>", 'data' => $result->id, 'is_html' => 1];
  1430. }
  1431. //return ['status' => 1, 'msg' => '提交成功', 'data' => $result->id];
  1432. } else {
  1433. return ['status' => 1, 'msg' => '资料保存成功,请尽快完善并提交', 'data' => $result->id];
  1434. }
  1435. } catch (\Exception $e) {
  1436. DB::rollback();
  1437. return ['status' => 0, 'msg' => $e->getMessage()];
  1438. }
  1439. }
  1440. }
  1441. /**
  1442. * 获得当前登录的用户
  1443. * @return \Illuminate\Contracts\Auth\Authenticatable|null
  1444. */
  1445. public function getUser()
  1446. {
  1447. if (auth('web-member')->check()) {
  1448. $user = auth('web-member')->user();
  1449. } else {
  1450. $user = null;
  1451. }
  1452. return $user;
  1453. }
  1454. /**
  1455. * 检查用户基本信息
  1456. * @return array
  1457. */
  1458. public function checkUserBasicInfo()
  1459. {
  1460. $user = $this->getUser();
  1461. if (!empty($user)) {
  1462. $uid = $user->id;
  1463. } else {
  1464. $arr = ['status' => 401, 'msg' => '请登录!'];
  1465. return $arr;
  1466. }
  1467. $info = RecruitAppointBasic::where('uid', $uid)->first();
  1468. if (empty($info)) {
  1469. $arr = ['status' => 401, 'msg' => '请先完善招考基本信息', 'url' => route('recruit.recruitInfo')];
  1470. return $arr;
  1471. }
  1472. return ['status' => 200, 'msg' => ''];
  1473. }
  1474. /**
  1475. * 个人中心招考页面
  1476. * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
  1477. */
  1478. public function person_recruit()
  1479. {
  1480. $user = auth('web-member')->user();
  1481. $list = RecruitAppointInfo::where('uid', $user->id)
  1482. ->join('recruit', 'recruit.id', '=', 'recruit_appoint_info.recruit_id', 'left')
  1483. ->join('recruit_post', 'recruit_post.id', '=', 'recruit_appoint_info.post_id', 'left')
  1484. ->select('recruit.name as recruit_name', 'recruit_appoint_info.*', 'recruit_post.code', 'recruit_post.name')
  1485. ->get();
  1486. return view('app.person.recruit')->with(['list' => $list, 'total' => count($list)]);
  1487. }
  1488. /**
  1489. * 招考信息基础页
  1490. * @param Request $request
  1491. * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
  1492. */
  1493. public function recruit_info(Request $request)
  1494. {
  1495. $user = auth('web-member')->user();
  1496. if (!empty($user)) {
  1497. $uid = $user->id;
  1498. } else {
  1499. return redirect(route('login'));
  1500. }
  1501. $info = RecruitAppointBasic::where('uid', $user->id)->first();
  1502. if (!$info) {
  1503. $info = [
  1504. 'realname' => '',
  1505. 'sex' => '0',
  1506. 'birthday' => '',
  1507. 'avatar' => '',
  1508. 'nation' => '',
  1509. 'native_place' => '',
  1510. 'political_affiliation' => '',
  1511. 'titles' => '',
  1512. 'work' => '',
  1513. 'house_register' => '',
  1514. 'join_time' => '',
  1515. 'edu_type' => '',
  1516. 'education' => '',
  1517. 'school' => '',
  1518. 'degree' => '',
  1519. 'pro' => '',
  1520. 'address' => '',
  1521. 'card' => '',
  1522. 'mobile' => '',
  1523. 'email' => '',
  1524. 'concat_name' => '',
  1525. 'concat_mobile' => '',
  1526. 'resume' => '',
  1527. 'family' => [
  1528. [
  1529. 'relation' => '',
  1530. 'realname' => '',
  1531. 'birthday' => '',
  1532. 'political_affiliation' => '',
  1533. 'work' => '',
  1534. ],
  1535. ],
  1536. 'is_push' => '1',
  1537. ];
  1538. } else {
  1539. $info->sex = (string)$info->sex;
  1540. $info->edu_type = (string)$info->edu_type;
  1541. $info->is_push = (string)$info->is_push;
  1542. $info->family = empty($info->family) ? [[
  1543. 'relation' => '',
  1544. 'realname' => '',
  1545. 'birthday' => '',
  1546. 'political_affiliation' => '',
  1547. 'work' => '',
  1548. ]] : json_decode($info->family);
  1549. }
  1550. $recruit_id = $request->input('recruit_id', 0);
  1551. return view('app.person.recruit_info', [
  1552. 'info' => json_encode($info),
  1553. 'recruit_id' => $recruit_id,
  1554. ]);
  1555. }
  1556. /**
  1557. * 保存招考信息
  1558. * @param RecruitValidatorRequest $request
  1559. * @return \Illuminate\Http\JsonResponse
  1560. */
  1561. public function saveRecruitInfo(RecruitValidatorRequest $request)
  1562. {
  1563. $user = auth('web-member')->user();
  1564. $basic = RecruitAppointBasic::where('uid', $user->id)->first();
  1565. $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');
  1566. if (count($data['family']) > 0) {
  1567. $data['family'] = json_encode($data['family']);
  1568. }
  1569. if ($basic) {
  1570. //更新基础信息
  1571. $res = RecruitAppointBasic::where('uid', $user->id)->update($data);
  1572. if (!$res) {
  1573. return response()->json(['status' => 0, 'msg' => '保存失败,请联系客服']);
  1574. } else {
  1575. return response()->json(['status' => 1, 'msg' => '个人基础信息保存成功,快去报名吧!']);
  1576. }
  1577. } else {
  1578. //新增基础信息
  1579. $data['uid'] = $user->id;
  1580. $res = RecruitAppointBasic::create($data);
  1581. if (!$res) {
  1582. return response()->json(['status' => 0, 'msg' => '保存失败,请联系客服']);
  1583. } else {
  1584. return response()->json(['status' => 1, 'msg' => '个人基础信息保存成功,快去报名吧!']);
  1585. }
  1586. }
  1587. }
  1588. /**
  1589. * 笔试准考证
  1590. * @param Request $request
  1591. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1592. */
  1593. public function pen_ticket(Request $request)
  1594. {
  1595. $user = $this->getUser();
  1596. if (!empty($user)) {
  1597. $uid = $user->id;
  1598. } else {
  1599. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1600. }
  1601. $recruit_id = $request->input('recruit_id');
  1602. $recruit = Recruit::where('id', $recruit_id)->first();
  1603. $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $recruit_id)->first();
  1604. if ($appoint_info) {
  1605. $pen_ticket = RecruitTicket::where('appoint_id', $appoint_info->id)->where('ex_type', 1)->first();
  1606. if ($pen_ticket) {
  1607. $health = RecruitSupplement::where('appoint_id', $appoint_info->id)->first();
  1608. if ((!$health || $health->h_status == 0) && $recruit->pen_epidemic) {
  1609. return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
  1610. }
  1611. $time = time();
  1612. if (strtotime($pen_ticket->ex_start) < $time && strtotime($pen_ticket->ex_end) > $time) {
  1613. RecruitTicket::where('appoint_id', $appoint_info->id)->update(['ex_status' => 1]);
  1614. $post_data = RecruitPost::where('recruit_id', $recruit_id)->where('status', 1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1615. $name = $recruit->name_en;
  1616. $date = date("Y-m-d", strtotime($recruit->created_at));
  1617. //$filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
  1618. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1619. // return view('app.recruit.recruit_ticket', [
  1620. // 'title' => "{$filename}.docx",
  1621. // 'url' => "https://www.jucai.gov.cn/storage/recruit/ticket/word/{$date}/{$name}/pen/{$filename}.docx",
  1622. // ]);
  1623. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/pen/" . $filename . '.pdf';
  1624. if (file_exists($file)) {
  1625. header('Content-Description: File Transfer');
  1626. header('Content-Type: application/octet-stream');
  1627. header('Content-Disposition: attachment; filename=' . basename($file));
  1628. header('Content-Transfer-Encoding: binary');
  1629. header('Expires: 0');
  1630. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1631. header('Pragma: public');
  1632. header('Content-Length: ' . filesize($file));
  1633. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1634. flush();
  1635. readfile($file);
  1636. } else {
  1637. return $this->showMessage('准考证不存在,请联系管理员!', route('home'), true, '上一页', '3');
  1638. }
  1639. } else {
  1640. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1641. }
  1642. } else {
  1643. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1644. }
  1645. } else {
  1646. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1647. }
  1648. }
  1649. /**
  1650. * 审核准考证
  1651. * @param Request $request
  1652. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1653. */
  1654. public function check_ticket(Request $request)
  1655. {
  1656. $user = $this->getUser();
  1657. if (!empty($user)) {
  1658. $uid = $user->id;
  1659. } else {
  1660. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1661. }
  1662. $recruit_id = $request->input('recruit_id');
  1663. $recruit = Recruit::where('id', $recruit_id)->first();
  1664. $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $recruit_id)->first();
  1665. if ($appoint_info) {
  1666. $check_ticket = RecruitTicket::where('appoint_id', $appoint_info->id)->where('ex_type', 2)->first();
  1667. if ($check_ticket) {
  1668. $health = RecruitSupplement::where('appoint_id', $appoint_info->id)->first();
  1669. if ((!$health || $health->h_status == 0) && $recruit->pen_epidemic) {
  1670. return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
  1671. }
  1672. $time = time();
  1673. if (strtotime($check_ticket->ex_start) < $time && strtotime($check_ticket->ex_end) > $time) {
  1674. RecruitTicket::where('id', $check_ticket->id)->update(['ex_status' => 1]);
  1675. $recruit = Recruit::where('id', $recruit_id)->first();
  1676. $post_data = RecruitPost::where('recruit_id', $recruit_id)->where('status', 1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1677. $name = $recruit->name_en;
  1678. $date = date("Y-m-d", strtotime($recruit->created_at));
  1679. //$filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
  1680. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1681. // return view('app.recruit.recruit_ticket', [
  1682. // 'title' => "{$filename}.docx",
  1683. // 'url' => "https://www.jucai.gov.cn/storage/recruit/ticket/word/{$date}/{$name}/computer/{$filename}.docx",
  1684. // ]);
  1685. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/computer/" . $filename . '.pdf';
  1686. if (file_exists($file)) {
  1687. header('Content-Description: File Transfer');
  1688. header('Content-Type: application/octet-stream');
  1689. header('Content-Disposition: attachment; filename=' . basename($file));
  1690. header('Content-Transfer-Encoding: binary');
  1691. header('Expires: 0');
  1692. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1693. header('Pragma: public');
  1694. header('Content-Length: ' . filesize($file));
  1695. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1696. flush();
  1697. readfile($file);
  1698. }
  1699. } else {
  1700. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1701. }
  1702. } else {
  1703. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1704. }
  1705. } else {
  1706. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1707. }
  1708. }
  1709. /**
  1710. * 面试准考证
  1711. * @param Request $request
  1712. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1713. */
  1714. public function face_ticket(Request $request)
  1715. {
  1716. $user = $this->getUser();
  1717. if (!empty($user)) {
  1718. $uid = $user->id;
  1719. } else {
  1720. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1721. }
  1722. $recruit_id = $request->input('recruit_id');
  1723. $recruit = Recruit::where('id', $recruit_id)->first();
  1724. $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $recruit_id)->first();
  1725. if ($appoint_info) {
  1726. $face_ticket = RecruitTicket::where('appoint_id', $appoint_info->id)->where('ex_type', 3)->first();
  1727. if ($face_ticket) {
  1728. $health = RecruitSupplement::where('appoint_id', $appoint_info->id)->first();
  1729. if ((!$health || $health->h_status == 0) && $recruit->pen_epidemic) {
  1730. return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
  1731. }
  1732. $time = time();
  1733. if (strtotime($face_ticket->ex_start) < $time && strtotime($face_ticket->ex_end) > $time) {
  1734. RecruitTicket::where('id', $face_ticket->id)->update(['ex_status' => 1]);
  1735. $recruit = Recruit::where('id', $recruit_id)->first();
  1736. $post_data = RecruitPost::where('recruit_id', $recruit_id)->where('status', 1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1737. $name = $recruit->name_en;
  1738. $date = date("Y-m-d", strtotime($recruit->created_at));
  1739. //$filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
  1740. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1741. // return view('app.recruit.recruit_ticket', [
  1742. // 'title' => "{$filename}.docx",
  1743. // 'url' => "https://www.jucai.gov.cn/storage/recruit/ticket/word/{$date}/{$name}/face/{$filename}.docx",
  1744. // ]);
  1745. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/face/" . $filename . '.pdf';
  1746. if (file_exists($file)) {
  1747. header('Content-Description: File Transfer');
  1748. header('Content-Type: application/octet-stream');
  1749. header('Content-Disposition: attachment; filename=' . basename($file));
  1750. header('Content-Transfer-Encoding: binary');
  1751. header('Expires: 0');
  1752. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1753. header('Pragma: public');
  1754. header('Content-Length: ' . filesize($file));
  1755. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1756. flush();
  1757. readfile($file);
  1758. }
  1759. } else {
  1760. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1761. }
  1762. } else {
  1763. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1764. }
  1765. } else {
  1766. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1767. }
  1768. }
  1769. /**
  1770. * 复试准考证
  1771. * @param Request $request
  1772. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1773. */
  1774. public function reexamine_ticket(Request $request)
  1775. {
  1776. $user = $this->getUser();
  1777. if (!empty($user)) {
  1778. $uid = $user->id;
  1779. } else {
  1780. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1781. }
  1782. $recruit_id = $request->input('recruit_id');
  1783. $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $recruit_id)->first();
  1784. if ($appoint_info) {
  1785. $reexamine_ticket = RecruitTicket::where('appoint_id', $appoint_info->id)->where('ex_type', 4)->first();
  1786. if ($reexamine_ticket) {
  1787. $time = time();
  1788. if (strtotime($reexamine_ticket->ex_start) < $time && strtotime($reexamine_ticket->ex_end) > $time) {
  1789. RecruitTicket::where('id', $reexamine_ticket->id)->update(['ex_status' => 1]);
  1790. $recruit = Recruit::where('id', $recruit_id)->first();
  1791. $post_data = RecruitPost::where('recruit_id', $recruit_id)->where('status', 1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1792. $name = $recruit->name_en;
  1793. $date = date("Y-m-d", strtotime($recruit->created_at));
  1794. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1795. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/reexamine/" . $filename . '.pdf';
  1796. if (file_exists($file)) {
  1797. header('Content-Description: File Transfer');
  1798. header('Content-Type: application/octet-stream');
  1799. header('Content-Disposition: attachment; filename=' . basename($file));
  1800. header('Content-Transfer-Encoding: binary');
  1801. header('Expires: 0');
  1802. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1803. header('Pragma: public');
  1804. header('Content-Length: ' . filesize($file));
  1805. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1806. flush();
  1807. readfile($file);
  1808. }
  1809. } else {
  1810. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1811. }
  1812. } else {
  1813. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1814. }
  1815. } else {
  1816. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1817. }
  1818. }
  1819. /**
  1820. * 材料补登
  1821. * @param Request $request
  1822. */
  1823. public function material_supplement(Request $request)
  1824. {
  1825. $user = $this->getUser();
  1826. if (!empty($user)) {
  1827. $uid = $user->id;
  1828. } else {
  1829. return redirect(route('login'));
  1830. }
  1831. //招考id
  1832. $id = $request->input('id', 0);
  1833. if (!$id) {
  1834. return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
  1835. }
  1836. $recruit = Recruit::find($id);
  1837. if (!$recruit['status'] && !$user->recruit_test) {
  1838. return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
  1839. }
  1840. $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $id)->first();
  1841. if (!$appoint_info) {
  1842. return $this->showMessage('抱歉,您没有报名,无需考察审核!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
  1843. }
  1844. if ($appoint_info->pen_audit != 1) {
  1845. return $this->showMessage('抱歉,您未入闱,无需考察审核!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
  1846. }
  1847. $limit_time = 1726824600;
  1848. $time = time();
  1849. if ($time > $limit_time) {
  1850. return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
  1851. }
  1852. $info = RecruitSupplement::where('appoint_id', $appoint_info->id)->where('type', 'supplement')->first();
  1853. if (!$info) {
  1854. $info = [
  1855. 'appoint_id' => $appoint_info->id,
  1856. 'identification' => '',
  1857. //'household_register' => '',
  1858. //'education_certification' => '',
  1859. //'family_planning' => '',
  1860. 'chengxin' => '',
  1861. 'manage' => '',
  1862. 'status' => 3,
  1863. ];
  1864. } else {
  1865. $info = $info->toArray();
  1866. if (json_decode($info['identification'])) {
  1867. $identification = json_decode($info['identification'], true);
  1868. foreach ($identification as $k => $v) {
  1869. if (array_key_exists('response', $v)) {
  1870. $identification[$k]['url'] = $v['response']['path'];
  1871. }
  1872. }
  1873. } else {
  1874. $identification = [];
  1875. }
  1876. $info['identification'] = $identification;
  1877. if (json_decode($info['household_register'])) {
  1878. $household_register = json_decode($info['household_register'], true);
  1879. foreach ($household_register as $k => $v) {
  1880. if (array_key_exists('response', $v)) {
  1881. $household_register[$k]['url'] = $v['response']['path'];
  1882. }
  1883. }
  1884. } else {
  1885. $household_register = [];
  1886. }
  1887. $info['household_register'] = $household_register;
  1888. if (json_decode($info['education_certification'])) {
  1889. $education_certification = json_decode($info['education_certification'], true);
  1890. foreach ($education_certification as $k => $v) {
  1891. if (array_key_exists('response', $v)) {
  1892. $education_certification[$k]['url'] = $v['response']['path'];
  1893. }
  1894. }
  1895. } else {
  1896. $education_certification = [];
  1897. }
  1898. $info['education_certification'] = $education_certification;
  1899. if (json_decode($info['family_planning'])) {
  1900. $family_planning = json_decode($info['family_planning'], true);
  1901. foreach ($family_planning as $k => $v) {
  1902. if (array_key_exists('response', $v)) {
  1903. $family_planning[$k]['url'] = $v['response']['path'];
  1904. }
  1905. }
  1906. } else {
  1907. $family_planning = [];
  1908. }
  1909. $info['family_planning'] = $family_planning;
  1910. if (json_decode($info['chengxin'])) {
  1911. $chengxin = json_decode($info['chengxin'], true);
  1912. foreach ($chengxin as $k => $v) {
  1913. if (array_key_exists('response', $v)) {
  1914. $chengxin[$k]['url'] = $v['response']['path'];
  1915. }
  1916. }
  1917. } else {
  1918. $chengxin = [];
  1919. }
  1920. $info['chengxin'] = $chengxin;
  1921. if (json_decode($info['manage'])) {
  1922. $manage = json_decode($info['manage'], true);
  1923. foreach ($manage as $k => $v) {
  1924. if (array_key_exists('response', $v)) {
  1925. $manage[$k]['url'] = $v['response']['path'];
  1926. }
  1927. }
  1928. } else {
  1929. $manage = [];
  1930. }
  1931. $info['manage'] = $manage;
  1932. }
  1933. $view_data['info'] = json_encode($info);
  1934. $view_data['title'] = $recruit->company;
  1935. return view('app.recruit.supplement', $view_data);
  1936. }
  1937. /**
  1938. * 健康信息登记
  1939. * @param Request $request
  1940. */
  1941. public function health_info(Request $request)
  1942. {
  1943. $user = $this->getUser();
  1944. if (!empty($user)) {
  1945. $uid = $user->id;
  1946. } else {
  1947. return redirect(route('login'));
  1948. }
  1949. //招考id
  1950. $id = $request->input('id', 0);
  1951. if (!$id) {
  1952. return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
  1953. }
  1954. $recruit = Recruit::find($id);
  1955. if (!$recruit['status'] && !$user->recruit_test) {
  1956. return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
  1957. }
  1958. $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $id)->first();
  1959. if (!$appoint_info) {
  1960. return $this->showMessage('抱歉,您没有报名,无需登记!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
  1961. }
  1962. if ($appoint_info->audit != 3) {
  1963. return $this->showMessage('抱歉,您无需登记!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
  1964. }
  1965. $time = time();
  1966. $type = $request->input('type', null);
  1967. $where = [];
  1968. if ($type) {
  1969. switch ($type) {
  1970. case 'pen':
  1971. $start = strtotime($recruit->pen_health_start);
  1972. $end = strtotime($recruit->pen_health_end);
  1973. break;
  1974. case 'computer':
  1975. $start = strtotime($recruit->computer_health_start);
  1976. $end = strtotime($recruit->computer_health_end);
  1977. break;
  1978. case 'face':
  1979. $start = strtotime($recruit->face_health_start);
  1980. $end = strtotime($recruit->face_health_end);
  1981. break;
  1982. case 'reexamine':
  1983. $start = strtotime($recruit->reexamine_health_start);
  1984. $end = strtotime($recruit->reexamine_health_end);
  1985. break;
  1986. default:
  1987. $start = strtotime($recruit->supplement_start);
  1988. $end = strtotime($recruit->supplement_end);
  1989. break;
  1990. }
  1991. $where[] = ['type', '=', $type];
  1992. } else {
  1993. $start = strtotime($recruit->supplement_start);
  1994. $end = strtotime($recruit->supplement_end);
  1995. }
  1996. if ($time > $end || $time < $start) {
  1997. return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
  1998. }
  1999. $where[] = ['appoint_id', '=', $appoint_info->id];
  2000. $info = RecruitSupplement::where($where)->first();
  2001. if (!$info) {
  2002. $info = [
  2003. 'appoint_id' => $appoint_info->id,
  2004. 'health_code' => '',
  2005. 'trip_code' => '',
  2006. 'type' => $type,
  2007. ];
  2008. } else {
  2009. $info = $info->toArray();
  2010. if (json_decode($info['health_code'])) {
  2011. $health_code = json_decode($info['health_code'], true);
  2012. foreach ($health_code as $k => $v) {
  2013. if (array_key_exists('response', $v)) {
  2014. $health_code[$k]['url'] = $v['response']['path'];
  2015. }
  2016. }
  2017. } else {
  2018. $health_code = [];
  2019. }
  2020. $info['health_code'] = $health_code;
  2021. if (json_decode($info['trip_code'])) {
  2022. $trip_code = json_decode($info['trip_code'], true);
  2023. foreach ($trip_code as $k => $v) {
  2024. if (array_key_exists('response', $v)) {
  2025. $trip_code[$k]['url'] = $v['response']['path'];
  2026. }
  2027. }
  2028. } else {
  2029. $trip_code = [];
  2030. }
  2031. $info['trip_code'] = $trip_code;
  2032. }
  2033. $view_data['info'] = json_encode($info);
  2034. $view_data['title'] = $recruit->company;
  2035. return view('app.recruit.health', $view_data);
  2036. }
  2037. public function save_supplement(Request $request)
  2038. {
  2039. $user = $this->getUser();
  2040. if (!empty($user)) {
  2041. $uid = $user->id;
  2042. } else {
  2043. return redirect(route('login'));
  2044. }
  2045. $limit_time = 1726824600;
  2046. $time = time();
  2047. if ($time > $limit_time) {
  2048. return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show', ['id', 38]), true, '上一页', '3');
  2049. }
  2050. $appoint_id = $request->input('appoint_id');
  2051. $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', 68)->where('id', $appoint_id)->first();
  2052. if (!$appoint_info) {
  2053. return ['status' => 0, 'msg' => '抱歉,找不到您要补登的报名记录!'];
  2054. }
  2055. $info = RecruitSupplement::where('appoint_id', $appoint_id)->where('type', 'supplement')->first();
  2056. if ($info) {
  2057. if ($info->status == 1) {
  2058. return ['status' => 0, 'msg' => '材料已审核通过,不允许修改'];
  2059. }
  2060. if ($info->status == 0) {
  2061. return ['status' => 0, 'msg' => '材料审核中,不允许修改'];
  2062. }
  2063. //身份证明
  2064. $identification = $request->input('identification');
  2065. if (is_array($identification)) {
  2066. //删除掉没有成功返回路径的图片
  2067. foreach ($identification as $k => $v) {
  2068. if (!array_key_exists('response', $v)) {
  2069. unset($identification[$k]);
  2070. }
  2071. }
  2072. }
  2073. $info->identification = json_encode($identification);
  2074. //户口簿
  2075. $household_register = $request->input('household_register');
  2076. if (is_array($household_register)) {
  2077. //删除掉没有成功返回路径的图片
  2078. foreach ($household_register as $k => $v) {
  2079. if (!array_key_exists('response', $v)) {
  2080. unset($household_register[$k]);
  2081. }
  2082. }
  2083. }
  2084. $info->household_register = json_encode($household_register);
  2085. //学信网
  2086. $education_certification = $request->input('education_certification');
  2087. if (is_array($education_certification)) {
  2088. //删除掉没有成功返回路径的图片
  2089. foreach ($education_certification as $k => $v) {
  2090. if (!array_key_exists('response', $v)) {
  2091. unset($education_certification[$k]);
  2092. }
  2093. }
  2094. }
  2095. $info->education_certification = json_encode($education_certification);
  2096. //计生
  2097. // $family_planning = $request->input('family_planning');
  2098. // if(is_array($family_planning)){
  2099. // //删除掉没有成功返回路径的图片
  2100. // foreach ($family_planning as $k => $v){
  2101. // if(!array_key_exists('response',$v)){
  2102. // unset($family_planning[$k]);
  2103. // }
  2104. // }
  2105. // }
  2106. // $info->family_planning = json_encode($family_planning);
  2107. //失信查询 情况
  2108. $chengxin = $request->input('chengxin');
  2109. if (is_array($chengxin)) {
  2110. //删除掉没有成功返回路径的图片
  2111. foreach ($chengxin as $k => $v) {
  2112. if (!array_key_exists('response', $v)) {
  2113. unset($chengxin[$k]);
  2114. }
  2115. }
  2116. }
  2117. $info->chengxin = json_encode($chengxin);
  2118. //综治
  2119. $manage = $request->input('manage');
  2120. if (is_array($manage)) {
  2121. //删除掉没有成功返回路径的图片
  2122. foreach ($manage as $k => $v) {
  2123. if (!array_key_exists('response', $v)) {
  2124. unset($manage[$k]);
  2125. }
  2126. }
  2127. }
  2128. $info->manage = json_encode($manage);
  2129. $info->status = 0;
  2130. $info->save();
  2131. $appoint_info->political_audit = 4;
  2132. $appoint_info->save();
  2133. return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
  2134. } else {
  2135. $data['appoint_id'] = $appoint_id;
  2136. //身份证明
  2137. $identification = $request->input('identification');
  2138. if (is_array($identification)) {
  2139. //删除掉没有成功返回路径的图片
  2140. foreach ($identification as $k => $v) {
  2141. if (!array_key_exists('response', $v)) {
  2142. unset($identification[$k]);
  2143. }
  2144. }
  2145. }
  2146. $data['identification'] = json_encode($identification);
  2147. //户口簿
  2148. $household_register = $request->input('household_register');
  2149. if (is_array($household_register)) {
  2150. //删除掉没有成功返回路径的图片
  2151. foreach ($household_register as $k => $v) {
  2152. if (!array_key_exists('response', $v)) {
  2153. unset($household_register[$k]);
  2154. }
  2155. }
  2156. }
  2157. $data['household_register'] = json_encode($household_register);
  2158. //学信网
  2159. $education_certification = $request->input('education_certification');
  2160. if (is_array($education_certification)) {
  2161. //删除掉没有成功返回路径的图片
  2162. foreach ($education_certification as $k => $v) {
  2163. if (!array_key_exists('response', $v)) {
  2164. unset($education_certification[$k]);
  2165. }
  2166. }
  2167. }
  2168. $data['education_certification'] = json_encode($education_certification);
  2169. //计生
  2170. // $family_planning = $request->input('family_planning');
  2171. // if(is_array($family_planning)){sp
  2172. // //删除掉没有成功返回路径的图片
  2173. // foreach ($family_planning as $k => $v){
  2174. // if(!array_key_exists('response',$v)){
  2175. // unset($family_planning[$k]);
  2176. // }
  2177. // }
  2178. // }
  2179. // $data['family_planning'] = json_encode($family_planning);
  2180. //失信查询 情况
  2181. $chengxin = $request->input('chengxin');
  2182. if (is_array($chengxin)) {
  2183. //删除掉没有成功返回路径的图片
  2184. foreach ($chengxin as $k => $v) {
  2185. if (!array_key_exists('response', $v)) {
  2186. unset($chengxin[$k]);
  2187. }
  2188. }
  2189. }
  2190. $data['chengxin'] = json_encode($chengxin);
  2191. //综治
  2192. $manage = $request->input('manage');
  2193. if (is_array($manage)) {
  2194. //删除掉没有成功返回路径的图片
  2195. foreach ($manage as $k => $v) {
  2196. if (!array_key_exists('response', $v)) {
  2197. unset($manage[$k]);
  2198. }
  2199. }
  2200. }
  2201. $data['manage'] = json_encode($manage);
  2202. $data['status'] = 0;
  2203. $data['type'] = 'supplement';
  2204. $result = RecruitSupplement::create($data);
  2205. $appoint_info->political_audit = 4;
  2206. $appoint_info->save();
  2207. return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
  2208. }
  2209. return ['status' => 0, 'msg' => 'test', 'data' => ''];
  2210. }
  2211. public function save_healthinfo(Request $request)
  2212. {
  2213. $user = $this->getUser();
  2214. if (!empty($user)) {
  2215. $uid = $user->id;
  2216. } else {
  2217. return redirect(route('login'));
  2218. }
  2219. $appoint_id = $request->input('appoint_id');
  2220. $type = $request->input('type');
  2221. $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('id', $appoint_id)->first();
  2222. if (!$appoint_info) {
  2223. return ['status' => 0, 'msg' => '抱歉,找不到您要登记的报名记录!'];
  2224. }
  2225. $recruit = Recruit::where('id', $appoint_info->recruit_id)->first();
  2226. $info = RecruitSupplement::where('appoint_id', $appoint_id)->where('type', $type)->first();
  2227. if ($info) {
  2228. if ($info->h_status == 1) {
  2229. return ['status' => 0, 'msg' => '材料已审核通过,不允许修改'];
  2230. }
  2231. if ($info->h_status == 0) {
  2232. return ['status' => 0, 'msg' => '材料审核中,不允许修改'];
  2233. }
  2234. $health_code = $request->input('health_code');
  2235. if (is_array($health_code)) {
  2236. //删除掉没有成功返回路径的图片
  2237. foreach ($health_code as $k => $v) {
  2238. if (!array_key_exists('response', $v)) {
  2239. unset($health_code[$k]);
  2240. }
  2241. }
  2242. }
  2243. $info->health_code = json_encode($health_code);
  2244. $trip_code = $request->input('trip_code');
  2245. if (is_array($trip_code)) {
  2246. //删除掉没有成功返回路径的图片
  2247. foreach ($trip_code as $k => $v) {
  2248. if (!array_key_exists('response', $v)) {
  2249. unset($trip_code[$k]);
  2250. }
  2251. }
  2252. }
  2253. $info->trip_code = json_encode($trip_code);
  2254. $info->h_status = 0;
  2255. $appoint_info->health_audit = 4;
  2256. $appoint_info->save();
  2257. $info->save();
  2258. return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
  2259. } else {
  2260. $data['appoint_id'] = $appoint_id;
  2261. $data['type'] = $type;
  2262. $data['h_status'] = 0;
  2263. $appoint_info->health_audit = 4;
  2264. $health_code = $request->input('health_code');
  2265. if (is_array($health_code)) {
  2266. //删除掉没有成功返回路径的图片
  2267. foreach ($health_code as $k => $v) {
  2268. if (!array_key_exists('response', $v)) {
  2269. unset($health_code[$k]);
  2270. }
  2271. }
  2272. }
  2273. $health_result = $this->baiduService->health_code(file_get_contents(base_path() . "/public" . $health_code[0]['response']['path']));
  2274. $health_msg = ['健康码自动审核通过'];
  2275. //$h_status = 1;
  2276. //$appoint_info->health_audit = 1;
  2277. if (!array_key_exists('error_msg', $health_result) && !array_key_exists('error_code', $health_result)) {
  2278. if (array_key_exists('姓名', $health_result)) {
  2279. if (stripos($health_result['姓名'][0]['word'], '*') > 0) {
  2280. return ['status' => 0, 'msg' => '请打开健康码的“眼睛开关”,显示完整个人信息'];
  2281. }
  2282. if ($health_result['姓名'][0]['word'] != $appoint_info->realname) {
  2283. array_push($health_msg, '抱歉,请上传您本人的健康码!');
  2284. }
  2285. } else {
  2286. array_push($health_msg, '健康码错误,识别不到姓名!');
  2287. }
  2288. if (array_key_exists('状态', $health_result)) {
  2289. if ($health_result['状态'][0]['word'] != '绿码') {
  2290. array_push($health_msg, '抱歉,您的健康码非绿码!');
  2291. }
  2292. } else {
  2293. array_push($health_msg, '健康码错误,识别不到状态!');
  2294. }
  2295. if (array_key_exists('更新时间', $health_result)) {
  2296. $time = strtotime($health_result['更新时间'][0]['word']);
  2297. if ($time < strtotime($recruit->pen_health_start) || $time > strtotime($recruit->pen_health_end)) {
  2298. array_push($health_msg, '抱歉,请上传{$recruit->pen_health_start}至{$recruit->pen_health_end}之间的健康码!');
  2299. }
  2300. } else {
  2301. array_push($health_msg, '健康码错误,识别不到时间!');
  2302. }
  2303. //$data['h_status'] = $h_status;
  2304. $data['h_msg'] = implode(';', $health_msg);
  2305. //$appoint_info->health_audit = $h_status == 1 ? 1 : 4;
  2306. $data['health_code'] = json_encode($health_code);
  2307. }
  2308. $data['health_result'] = json_encode($health_result);
  2309. $trip_code = $request->input('trip_code');
  2310. if (is_array($trip_code)) {
  2311. //删除掉没有成功返回路径的图片
  2312. foreach ($trip_code as $k => $v) {
  2313. if (!array_key_exists('response', $v)) {
  2314. unset($trip_code[$k]);
  2315. }
  2316. }
  2317. }
  2318. $trip_result = $this->baiduService->trip_code(file_get_contents(base_path() . "/public" . $trip_code[0]['response']['path']));
  2319. $trip_msg = [];
  2320. $trip_status = 0;
  2321. if (!array_key_exists('error_msg', $trip_result) && !array_key_exists('error_code', $trip_result)) {
  2322. if (array_key_exists('途经地', $trip_result['result'])) {
  2323. $fangyi_area = explode("\r\n", config('aix.fangyi.fangyi_zhaokao.fangyi_zhaokao.risk_area'));
  2324. $result = array_intersect($fangyi_area, $trip_result['result']['途经地'][0]['word']);
  2325. if (count($result) > 0) {
  2326. array_push($trip_msg, '抱歉,您的行程中包含系统设置中高风险地区!');
  2327. $trip_status = 0;
  2328. }
  2329. }
  2330. if (array_key_exists('风险性', $trip_result['result']) && $trip_result['result']['风险性']) {
  2331. array_push($trip_msg, '抱歉,您的行程可能含有风险!');
  2332. $trip_status = 0;
  2333. }
  2334. if (array_key_exists('更新时间', $trip_result['result'])) {
  2335. $time = strtotime($trip_result['result']['更新时间'][0]['word'][0]);
  2336. if ($time > strtotime($recruit->pen_health_start) || $recruit < ($recruit->pen_health_end)) {
  2337. array_push($trip_msg, '抱歉,请上传{$recruit->pen_health_start}至{$recruit->pen_health_end}之间的行程码!');
  2338. $trip_status = 0;
  2339. }
  2340. }
  2341. $data['h_msg'] .= implode(';', $trip_msg);
  2342. }
  2343. $data['trip_result'] = json_encode($trip_result);
  2344. $data['trip_code'] = json_encode($trip_code);
  2345. $data['h_status'] = 0;
  2346. $appoint_info->health_audit = 4;
  2347. RecruitSupplement::create($data);
  2348. $appoint_info->save();
  2349. return ['status' => 1, 'msg' => '提交成功,请刷新查看审核结果', 'data' => ''];
  2350. }
  2351. return ['status' => 0, 'msg' => 'test', 'data' => ''];
  2352. }
  2353. public function post_select(Request $request)
  2354. {
  2355. $user = $this->getUser();
  2356. if (!empty($user)) {
  2357. $uid = $user->id;
  2358. } else {
  2359. return redirect(route('login'));
  2360. }
  2361. $recruit_id = $request->input('recruit_id');
  2362. //$appoint_id = $request->input('appoint_id');
  2363. $info = RecruitAppointSelect::where('uid', $uid)->where('recruit_id', $recruit_id)->first();
  2364. if (!$info) {
  2365. return $this->showMessage('抱歉,您无需择岗!', route('recruit.show', ['id', $recruit_id]), true, '上一页', '2');
  2366. }
  2367. //手动设置择岗时间段
  2368. $time = time();
  2369. if ($time > 1727150400 || $time < 1727053200) {
  2370. //if($time > 1694491200){
  2371. return $this->showMessage('抱歉,未到择岗时间!', route('recruit.show', ['id', $recruit_id]), true, '上一页', '2');
  2372. }
  2373. $option_list = [
  2374. [
  2375. 'id' => 1,
  2376. 'name' => '陈埭镇',
  2377. ],
  2378. [
  2379. 'id' => 2,
  2380. 'name' => '金井镇',
  2381. ],
  2382. [
  2383. 'id' => 3,
  2384. 'name' => '深沪镇'
  2385. ]
  2386. ];
  2387. $select_list = [];
  2388. if ($info->result) {
  2389. $result = json_decode($info->result, true);
  2390. foreach ($result as $v) {
  2391. $item['name'] = $v;
  2392. array_push($select_list, $item);
  2393. }
  2394. }
  2395. // $recruit_id = $request->input('recruit_id');
  2396. // $appoint_id = $request->input('appoint_id');
  2397. // $uid = $request->input('uid');
  2398. // $info = RecruitAppointSelect::where('uid',$uid)->first();
  2399. // if(!$info){
  2400. // $info = new \stdClass();
  2401. // $info->status = 0;
  2402. // $info->recruit_id = 8;
  2403. // $info->appoint_id = rand(0,999999);
  2404. // $info->uid = rand(0,999999);
  2405. // }else{
  2406. // $result = json_decode($info->result,true);
  2407. // foreach ($option_list as $k => $v){
  2408. // if(in_array($v['name'],$result)){
  2409. // $select_list[$k] = $v;
  2410. // unset($option_list[$k]);
  2411. // }
  2412. // }
  2413. // }
  2414. $view_data = ['info' => $info, 'options_list' => json_encode($option_list), 'select_list' => json_encode($select_list)];
  2415. return view('app.recruit.post_select', $view_data);
  2416. }
  2417. /**
  2418. * 放弃择岗
  2419. */
  2420. public function give_up_post(Request $request)
  2421. {
  2422. //以下为测试环境
  2423. // $recruit_id = $request->input('recruit_id');
  2424. // $appoint_id = $request->input('appoint_id');
  2425. // $uid = $request->input('uid');
  2426. // $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->where('appoint_id',$appoint_id)->first();
  2427. // if($info){
  2428. // return ['status' => 0, 'msg' => "测试数据重复,请重新点击生成测试数据!"];
  2429. // }
  2430. // RecruitAppointSelect::create(['recruit_id'=>$recruit_id,'appoint_id'=>$appoint_id,'uid'=>$uid,'status'=>-1]);
  2431. // return ['status' => 1, 'msg' => "放弃择岗成功!"];
  2432. //以下为正式环境再放开
  2433. $user = $this->getUser();
  2434. if (!empty($user)) {
  2435. $uid = $user->id;
  2436. } else {
  2437. return redirect(route('login'));
  2438. }
  2439. $recruit_id = $request->input('recruit_id');
  2440. $appoint_id = $request->input('appoint_id');
  2441. $info = RecruitAppointSelect::where('uid', $uid)->where('recruit_id', $recruit_id)->where('appoint_id', $appoint_id)->first();
  2442. if ($info == null) {
  2443. return ['status' => 0, 'msg' => "抱歉,您无需择岗!"];
  2444. }
  2445. if ($info->status != 0) {
  2446. return ['status' => 0, 'msg' => "抱歉,您不是待择岗状态!"];
  2447. }
  2448. $info->status = -1;
  2449. $info->save();
  2450. return ['status' => 1, 'msg' => "放弃择岗成功!"];
  2451. }
  2452. public function comfirm_post(Request $request)
  2453. {
  2454. $user = $this->getUser();
  2455. if (!empty($user)) {
  2456. $uid = $user->id;
  2457. } else {
  2458. return redirect(route('login'));
  2459. }
  2460. $recruit_id = $request->input('recruit_id');
  2461. $appoint_id = $request->input('appoint_id');
  2462. $time = time();
  2463. if ($time > 1727150400 || $time < 1727053200) {
  2464. return ['status' => 0, 'msg' => "抱歉,未到择岗时间!"];
  2465. }
  2466. $info = RecruitAppointSelect::where('uid', $uid)->where('recruit_id', $recruit_id)->where('appoint_id', $appoint_id)->first();
  2467. if ($info->result) {
  2468. return ['status' => 0, 'msg' => "择岗数据已提交!"];
  2469. }
  2470. // $data = [
  2471. // 'recruit_id' => $recruit_id,
  2472. // 'appoint_id' => $recruit_id,
  2473. // 'uid' => $uid,
  2474. // 'status' => 1
  2475. // ];
  2476. $result = [];
  2477. $select = $request->input('select');
  2478. if (is_array($select) && count($select) > 0) {
  2479. foreach ($select as $v) {
  2480. array_push($result, $v['name']);
  2481. }
  2482. }
  2483. $info->result = json_encode($result);
  2484. $info->status = 1;
  2485. $info->save();
  2486. return ['status' => 1, 'msg' => "提交择岗意愿成功,请耐心等待结果!"];
  2487. }
  2488. public function select_result(Request $request)
  2489. {
  2490. $redis = Cache::getRedis();
  2491. $redis->set('recruit_quota_batch5', '');
  2492. return view('app.recruit.select_result');
  2493. }
  2494. public function get_select_result(Request $request)
  2495. {
  2496. $redis = Cache::getRedis();
  2497. $quot_batch5 = $redis->get('recruit_quota_batch5');
  2498. if (!$quot_batch5) {
  2499. $quot_batch5 = [
  2500. [
  2501. 'name' => '陈埭镇',
  2502. 'value' => 21,
  2503. ],
  2504. [
  2505. 'name' => '金井镇',
  2506. 'value' => 3
  2507. ],
  2508. [
  2509. 'name' => '深沪镇',
  2510. 'value' => 2
  2511. ]
  2512. ];
  2513. $redis->set('recruit_quotaA', json_encode($quot_batch5));
  2514. } else {
  2515. $quot_batch5 = json_decode($quot_batch5, true);
  2516. }
  2517. $list = DB::table('recruit_appoint_select as a')->leftJoin('recruit_appoint_info as b', 'a.appoint_id', '=', 'b.id')->leftJoin('recruit_ticket as c', 'a.appoint_id', '=', 'c.appoint_id')->whereRaw('a.select_result is null and a.batch=5 and a.result is not null')->select(['b.realname', 'c.ex_number', 'a.result', 'a.select_result', 'a.id', 'a.record', 'a.record2', 'a.record3'])->orderBy('record', 'desc')->orderBy('record2', 'desc')->orderBy('record3', 'desc')->limit(2)->get()->toArray();
  2518. $return_data = [
  2519. 'list' => [],
  2520. ];
  2521. $array_column = array_column($quot_batch5, 'name');
  2522. if (count($list) > 1) {
  2523. $current = $list[0];
  2524. $next = $list[1];
  2525. } else {
  2526. $current = $list[0];
  2527. $next = false;
  2528. }
  2529. $person_select_result = json_decode($current->result, true);
  2530. $flag = 0;//是否择岗成功
  2531. foreach ($person_select_result as $val) {
  2532. //寻找下标
  2533. $index = array_search($val, $array_column);
  2534. if ($quot_batch5[$index]['value']) {
  2535. if ($next && $current->record == $next->record && $current->record2 == $next->record2 && $current->record3 == $next->record3 && $quot_batch5[$index]['value'] == 1) {
  2536. //如果当前处理人员不是最后一个,且分数与下一名人员三个维度完全一样的话并且该人员欲择的岗位仅剩一位,则特殊处理
  2537. //查找同样分数人同样志愿
  2538. $next_select_result = json_decode($next->result, true);
  2539. //寻找下标
  2540. $current_index = array_search($val, $person_select_result);
  2541. $next_index = array_search($val, $next_select_result);
  2542. if ($current_index > $next_index) {
  2543. //如果当前人员对当前镇街的意向排序大于下一人,调换两个指针,先排序下一个人
  2544. $current = $next;
  2545. }
  2546. }
  2547. $quota_data = [
  2548. 'index' => $index,
  2549. 'old_value' => $quot_batch5[$index]['value'],
  2550. ];
  2551. //有名额允许择岗
  2552. DB::table('recruit_appoint_select')->where('id', $current->id)->update(['select_result' => $val, 'status' => 1]);
  2553. $current->select_result = $val;
  2554. $quot_batch5[$index]['value']--;
  2555. $quota_data['new_value'] = $quot_batch5[$index]['value'];
  2556. $redis->set('recruit_quota_batch4', json_encode($quot_batch5));
  2557. $flag = 1;
  2558. break;
  2559. }
  2560. }
  2561. if (!$flag) {
  2562. $quota_data = [
  2563. 'index' => $index,
  2564. 'old_value' => $quot_batch5[$index]['value'],
  2565. ];
  2566. $current->select_result = '未匹配到志愿,本轮择岗不成功!';
  2567. DB::table('recruit_appoint_select')->where('id', $current->id)->update(['select_result' => '未匹配到志愿,本轮择岗不成功!', 'status' => -2]);
  2568. }
  2569. $return_data['quota'] = $quota_data;
  2570. return ['status' => 1, 'msg' => '择岗排序成功', 'data' => $return_data];
  2571. }
  2572. public function select_init(Request $request)
  2573. {
  2574. $count = DB::table('recruit_appoint_select')->whereRaw('select_result is null and batch = 5 and type = 1 and result is not null')->count();
  2575. $redis = Cache::getRedis();
  2576. $quot_batch5 = $redis->get('recruit_quota_batch4');
  2577. if (!$quot_batch5) {
  2578. $quot_batch5 = [
  2579. [
  2580. 'name' => '陈埭镇',
  2581. 'value' => 21,
  2582. ],
  2583. [
  2584. 'name' => '金井镇',
  2585. 'value' => 3
  2586. ],
  2587. [
  2588. 'name' => '深沪镇',
  2589. 'value' => 2
  2590. ]
  2591. ];
  2592. $redis->set('recruit_quota_batch5', json_encode($quot_batch5));
  2593. }
  2594. $list = DB::table('recruit_appoint_select as a')->leftJoin('recruit_appoint_info as b', 'a.appoint_id', '=', 'b.id')->leftJoin('recruit_ticket as c', 'a.appoint_id', '=', 'c.appoint_id')->whereRaw('a.select_result is not null and a.batch=5 and type = 1')->select(['b.realname', 'c.ex_number', 'a.result', 'a.select_result', 'a.id'])->orderBy('record', 'desc')->get();
  2595. return ['status' => 1, 'msg' => '获取初始化信息成功', 'data' => ['count' => $count, 'quota' => $quot_batch5, 'list' => $list]];
  2596. }
  2597. public function interviewer_random(Request $request)
  2598. {
  2599. $model = $request->input('model', 1);
  2600. $number1 = $request->input('number1', 5);//考官人数
  2601. $number2 = $request->input('number2', 1);//替补人数
  2602. $where[] = ['id', '>', 0];
  2603. switch ($model) {
  2604. case '0':
  2605. $list = DB::table('recruit_interviewer')->get()->toArray();
  2606. shuffle($list);
  2607. $result = array_slice($list, 0, $number1 + $number2);
  2608. break;
  2609. case '1':
  2610. $list = DB::table('recruit_interviewer')->get()->toArray();
  2611. shuffle($list);
  2612. $count = $number1;
  2613. for ($i = 0; $i < $count; $i++) {
  2614. if (!$list[$i]->status) {
  2615. $list[] = $list[$i];
  2616. unset($list[$i]);
  2617. $count++;
  2618. }
  2619. }
  2620. $result = array_slice($list, 0, $number1 + $number2);
  2621. break;
  2622. case '2':
  2623. $list = DB::table('recruit_interviewer')->where('status', 1)->get()->toArray();
  2624. shuffle($list);
  2625. $result = array_slice($list, 0, $number1 + $number2);
  2626. break;
  2627. default:
  2628. $list = DB::table('recruit_interviewer')->get()->toArray();
  2629. shuffle($list);
  2630. for ($i = 0; $i < $number1; $i++) {
  2631. dd($list[$i]);
  2632. if (!$list[$i]->status) {
  2633. $list[] = $list[$i];
  2634. unset($list[$i]);
  2635. }
  2636. }
  2637. $result = array_slice($list, 0, $number1 + $number2);
  2638. break;
  2639. }
  2640. $return_data = [
  2641. 'list' => $result,
  2642. 'number1' => $number1,
  2643. 'number2' => $number2,
  2644. ];
  2645. return view('app.recruit.interviewer', $return_data);
  2646. }
  2647. public function supplement_info(Request $request)
  2648. {
  2649. $user = $this->getUser();
  2650. if (!empty($user)) {
  2651. $uid = $user->id;
  2652. } else {
  2653. return redirect(route('login'));
  2654. }
  2655. //招考id
  2656. $id = $request->input('id', 0);
  2657. if (!$id) {
  2658. return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
  2659. }
  2660. $recruit = Recruit::find($id);
  2661. if (!$recruit['status']) {
  2662. return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
  2663. }
  2664. $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $id)->first();
  2665. if (!$appoint_info) {
  2666. return $this->showMessage('抱歉,您没有报名,无需补充信息!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
  2667. }
  2668. $supplement_info = DB::table("recruit_supplement_cunwu")->where('uid', $uid)->where('appoint_id', $appoint_info->id)->first();
  2669. if ($supplement_info) {
  2670. return $this->showMessage('您已登记信息,无需再次登记!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
  2671. }
  2672. $uids = [167780,168696,56609,168696,164951,169813,161935,169412,169307,169628,169331,170471,161935,170718,175771,175856,169628,56609,168696,176871,169412,169813,177014,161935,152626,176994,176703,176432,170471,177272,179103,179206,179165,179873,179863,179715,180131,161935,180616,170718,180766,175856,180810,169412,177272,167988,181121,181175,168696,182354,56609,184859,161935,176994,169813,169412,187369,159298,169628,181175,187450,167988,187572,187578,187573,179863,187753,187577,152626,187875,187815,149975,187821,180131,187934,176871,168696,186519,170718,188160,176994,169813,161935,180616,188342,188411,177014,188455,188450,177272,184859,168696,181121,189428,189446,189410,182354,182354,184859,184859,187572,190509,161935,170718,184859,182354,191077,187450,191077,169813,191538,191954,191396,152626,182354,192121,189446,192223,192271,170718,170718,192769,192798,192674,192774,192800,180131,179863,169412,192560,186519,56609,170471,188160,168696,159298,187572,192868,169628,192874,192775,192892,181175,167988,192914,192922,192925,159772,192930,192945,192752,192652,188411,192958,179715,192959,192834,192987,192739,192392,152626,188450,193038,192542,192452,193055,192788,187369,193072,176703,193079,193069,193084,192803,192668,187875,193103,187578,191396,175771,193113,193135,193132,191077,193151,191954,187381,193130,193169,188035,179103,176432,182354,180766,189410,192855,179165,175642,193202,193141,193248,193239,193244,193252,192978,192888,187753,185725,143917,177272,187821,193326,193334,193331,187573,180616,193350,192813,193357,192926,193212,187815,193361,193158,193150,176994,193389,184118,176896,193408,192811,189446,193416,193423,170718,187934,192955,169307,180810,193428,149975,187577,186473,192720,175856,161935,187935,159058,193526,187450,192271,169813,193570,193578,193225,193594,193606,181121,169331,193616,184859,190509,193640,192751,193574,167780,193695,192133,193714,192523,193718,193717,193720,189428,179873,177014,188342,193742,188455,176871,191538,193787,192223,193789,185725,182354,186519,193135];//写死用户
  2673. if (!in_array($uid, $uids)) {
  2674. return $this->showMessage('您无需登记信息!', route('recruit.show', ['id', $recruit['id']]), true, '上一页', '3');
  2675. }
  2676. // $limit_time = 1661961599;
  2677. // $time = time();
  2678. // if( $time > $limit_time){
  2679. // return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2680. // }
  2681. $view_data = [];
  2682. //$view_data['info'] = json_encode($info);
  2683. $view_data['title'] = $recruit->company;
  2684. $view_data['id'] = $id;
  2685. return view('app.recruit.supplement_info', $view_data);
  2686. }
  2687. public function save_supplement_info(Request $request)
  2688. {
  2689. $user = $this->getUser();
  2690. if (!empty($user)) {
  2691. $uid = $user->id;
  2692. } else {
  2693. return redirect(route('login'));
  2694. }
  2695. //招考id
  2696. $id = $request->input('recruit_id', 0);
  2697. if (!$id) {
  2698. return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
  2699. }
  2700. $recruit = Recruit::find($id);
  2701. if (!$recruit['status']) {
  2702. return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
  2703. }
  2704. $appoint_info = RecruitAppointInfo::where('uid', $uid)->where('recruit_id', $id)->first();
  2705. if (!$appoint_info) {
  2706. return ['status' => 0, 'msg' => '抱歉,您没有报名,无需补充信息!', 'data' => ''];
  2707. }
  2708. if ($request->input('marriage') == '已婚') {
  2709. if ($request->input('spouse_card_type') == '' || $request->input('spouse_card') == '' || $request->input('spouse_realname') == '' || $request->input('spouse_mobile') == '') {
  2710. return ['status' => 0, 'msg' => '请完善配偶信息!', 'data' => ''];
  2711. }
  2712. }
  2713. $data = [
  2714. 'uid' => $uid,
  2715. 'appoint_id' => $appoint_info->id,
  2716. 'street' => $request->input('street'),
  2717. 'realname' => $request->input('realname'),
  2718. 'sex' => $request->input('sex'),
  2719. 'house' => $request->input('house'),
  2720. 'nation' => $request->input('nation'),
  2721. 'native' => $request->input('native'),
  2722. 'marriage' => $request->input('marriage'),
  2723. 'spouse_card_type' => $request->input('spouse_card_type'),
  2724. 'spouse_card' => $request->input('spouse_card'),
  2725. 'spouse_realname' => $request->input('spouse_realname'),
  2726. 'spouse_mobile' => $request->input('spouse_mobile'),
  2727. 'political' => $request->input('political'),
  2728. 'bank_card' => $request->input('bank_card'),
  2729. 'bank_open' => $request->input('bank_open'),
  2730. 'card' => $request->input('card'),
  2731. 'card_endtime' => $request->input('card_endtime'),
  2732. 'mobile' => $request->input('mobile'),
  2733. 'edu' => $request->input('education'),
  2734. 'pro' => $request->input('pro'),
  2735. 'address' => $request->input('address'),
  2736. 'funds' => $request->input('funds'),
  2737. ];
  2738. DB::table('recruit_supplement_cunwu')->insert($data);
  2739. return ['status' => 1, 'msg' => '提交成功!', 'data' => ''];
  2740. }
  2741. public function comfirm_pen(Request $request)
  2742. {
  2743. $user = $this->getUser();
  2744. if (!empty($user)) {
  2745. $uid = $user->id;
  2746. } else {
  2747. return redirect(route('login'));
  2748. }
  2749. //招考id
  2750. $id = $request->input('recruit_id', 0);
  2751. if (!$id) {
  2752. return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
  2753. }
  2754. $recruit = Recruit::find($id);
  2755. if (!$recruit['status']) {
  2756. return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
  2757. }
  2758. if (!$recruit->pen_comfirm) {
  2759. return ['status' => 0, 'msg' => '该项目无须确认笔试考试!', 'data' => ''];
  2760. }
  2761. $appoint_info = RecruitAppointInfo::where('recruit_id', $id)->where('uid', $uid)->first();
  2762. if (!$appoint_info) {
  2763. return ['status' => 0, 'msg' => '找不到您的报名记录,请检查!', 'data' => ''];
  2764. }
  2765. if ($appoint_info->audit != 3) {
  2766. return ['status' => 0, 'msg' => '您的报名未审核通过,无需确认!', 'data' => ''];
  2767. }
  2768. $time = time();
  2769. if (strtotime($recruit->pen_comfirm_start) > $time || strtotime($recruit->pen_comfirm_end) < $time) {
  2770. return ['status' => 0, 'msg' => '未在笔试确认时间段!', 'data' => ''];
  2771. }
  2772. if ($appoint_info->pen_audit != -2) {
  2773. return ['status' => 0, 'msg' => '您已确认参加笔试,无需再次确认!', 'data' => ''];
  2774. }
  2775. $appoint_info->update(['pen_audit' => -1]);
  2776. $log = [
  2777. 'type' => 3,
  2778. 'appoint_id' => $appoint_info->id,
  2779. 'uid' => $uid,
  2780. 'log' => '用户确认参加笔试',
  2781. ];
  2782. RecruitAppointLog::create($log);
  2783. return ['status' => 1, 'msg' => '确认成功', 'data' => $appoint_info->id];
  2784. }
  2785. public function supplementary_entry(Request $request)
  2786. {
  2787. $user = $this->getUser();
  2788. if (!empty($user)) {
  2789. $uid = $user->id;
  2790. } else {
  2791. return redirect(route('login'));
  2792. }
  2793. //招考id
  2794. $id = $request->input('recruit_id', 0);
  2795. if (!$id) {
  2796. return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
  2797. }
  2798. $recruit = Recruit::find($id);
  2799. if (!$recruit['status']) {
  2800. return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
  2801. }
  2802. $appoint_info = RecruitAppointInfo::where('recruit_id', $id)->where('uid', $uid)->first();
  2803. if (!$appoint_info) {
  2804. return ['status' => 0, 'msg' => '找不到您的报名记录,请检查!', 'data' => ''];
  2805. }
  2806. $time = time();
  2807. if ($time > 1680969600) {
  2808. return ['status' => 0, 'msg' => '已停止补充报名!', 'data' => ''];
  2809. }
  2810. if ($appoint_info->adjust_limit) {
  2811. $appoint_info->update(['adjust' => 1]);
  2812. return ['status' => 1, 'msg' => '补充报名成功!', 'data' => ''];
  2813. } else {
  2814. return ['status' => 0, 'msg' => '您无需补充报名!', 'data' => ''];
  2815. }
  2816. }
  2817. public function show_sign_limit(Request $request){
  2818. $user = $this->getUser();
  2819. if (!empty($user)) {
  2820. $uid = $user->id;
  2821. } else {
  2822. return redirect(route('login'));
  2823. }
  2824. //招考id
  2825. $id = $request->input('recruit_id', 0);
  2826. if (!$id) {
  2827. return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
  2828. }
  2829. $recruit = Recruit::find($id);
  2830. if (!$recruit['status']) {
  2831. return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
  2832. }
  2833. $list = RecruitAppointInfo::where('uid', $user->id)
  2834. ->join('recruit', 'recruit.id', '=', 'recruit_appoint_info.recruit_id', 'left')
  2835. ->join('recruit_post', 'recruit_post.id', '=', 'recruit_appoint_info.post_id', 'left')
  2836. ->select('recruit.name as recruit_name', 'recruit_appoint_info.*', 'recruit_post.code', 'recruit_post.name')
  2837. ->where('recruit_appoint_info.recruit_id','=',$id)
  2838. ->get();
  2839. $html = view('app.recruit.show_sign_limit')->with(['list' => $list , 'total' => count($list)])->render();
  2840. return response()->json(['code' => 1, 'data' => $html]);
  2841. }
  2842. }