IndexController.php 140 KB

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