IndexController.php 135 KB

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