IndexController.php 129 KB

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