IndexController.php 144 KB

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