IndexController.php 142 KB

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