IndexController.php 129 KB

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