IndexController.php 141 KB

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