IndexController.php 129 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959
  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'] && ($special['condition'] == '' ) || count($special['condition']) == 0){
  950. return response()->json(['status' => 0,'msg' => '加分条件不能为空']);
  951. }
  952. }
  953. $data['family'] = json_encode($family);
  954. if($appoint_info){
  955. //如果已有报名记录,进入修改阶段的处理流程
  956. DB::beginTransaction();
  957. try{
  958. RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->update($data);
  959. //分模块解析数据
  960. //如果有加分模块
  961. if(in_array('expand_special',$forms)){
  962. $special = $request->input('special');
  963. if($special['point_apply']){//如果申请加分
  964. if(!array_key_exists('material',$special)){
  965. return response()->json(['status' => 0,'msg' => '加分佐证材料不能为空!']);
  966. }
  967. //删除掉没有成功返回路径的图片
  968. if(is_array($special['material'])){
  969. foreach ($special['material'] as $k => $v){
  970. if(!array_key_exists('response',$v)){
  971. unset($special['material'][$k]);
  972. }
  973. }
  974. }
  975. $special['point'] = 0;
  976. if(is_array($special['condition'])){
  977. $special['condition'] = implode(',',$special['condition']);
  978. }
  979. $special['material'] = json_encode($special['material']);
  980. $hasRecord = RecruitAppointExpandSpecial::where('recruit_appoint_id',$appoint_info->id)->first();
  981. if($hasRecord){
  982. RecruitAppointExpandSpecial::where('recruit_appoint_id',$appoint_info->id)->update($special);
  983. }else{
  984. $special['recruit_appoint_id'] = $appoint_info->id;
  985. RecruitAppointExpandSpecial::create($special);
  986. }
  987. }
  988. }
  989. //如果有详情模块
  990. if(in_array('detail',$forms) || in_array('internship',$forms)){
  991. $detail = $request->input('detail');
  992. $hasRecord = RecruitAppointDetail::where('recruit_appoint_id',$appoint_info->id)->first();
  993. if($hasRecord){
  994. RecruitAppointDetail::where('recruit_appoint_id',$appoint_info->id)->update($detail);
  995. }else{
  996. $detail['recruit_appoint_id'] = $appoint_info->id;
  997. RecruitAppointDetail::create($detail);
  998. }
  999. }
  1000. //如果有身份证明模块
  1001. if(in_array('identification',$forms) || in_array('internship',$forms)){
  1002. $identification = $request->input('identification');
  1003. if(is_array($identification)){
  1004. //删除掉没有成功返回路径的图片
  1005. foreach ($identification as $k => $v){
  1006. if(!array_key_exists('response',$v)){
  1007. unset($identification[$k]);
  1008. }
  1009. }
  1010. }
  1011. $appoint_info->identification = json_encode($identification);
  1012. $appoint_info->save();
  1013. }
  1014. //如果有教育证明模块
  1015. if(in_array('education_certification',$forms) || in_array('internship',$forms)){
  1016. $education_certification = $request->input('education_certification');
  1017. if(is_array($education_certification)){
  1018. //删除掉没有成功返回路径的图片
  1019. foreach ($education_certification as $k => $v){
  1020. if(!array_key_exists('response',$v)){
  1021. unset($education_certification[$k]);
  1022. }
  1023. }
  1024. }
  1025. $appoint_info->education_certification = json_encode($education_certification);
  1026. $appoint_info->save();
  1027. }
  1028. //如果有其他证明模块
  1029. if(in_array('other_certification',$forms) || in_array('internship',$forms)){
  1030. $other_certification = $request->input('other_certification');
  1031. if(is_array($other_certification)){
  1032. //删除掉没有成功返回路径的图片
  1033. foreach ($other_certification as $k => $v){
  1034. if(!array_key_exists('response',$v)){
  1035. unset($other_certification[$k]);
  1036. }
  1037. }
  1038. }
  1039. if($other_certification){
  1040. $appoint_info->other_certification = json_encode($other_certification);
  1041. $appoint_info->save();
  1042. }
  1043. }
  1044. //如果有承诺书模块
  1045. if(in_array('chengnuoshu',$forms)){
  1046. $chengnuoshu = $request->input('chengnuoshu');
  1047. if(is_array($chengnuoshu)){
  1048. //删除掉没有成功返回路径的图片
  1049. foreach ($chengnuoshu as $k => $v){
  1050. if(!array_key_exists('response',$v)){
  1051. unset($chengnuoshu[$k]);
  1052. }
  1053. }
  1054. }
  1055. if($chengnuoshu){
  1056. $appoint_info->chengnuoshu = json_encode($chengnuoshu);
  1057. $appoint_info->save();
  1058. }
  1059. }
  1060. //如果有失信被执行人模块
  1061. if(in_array('shixin',$forms)){
  1062. $shixin = $request->input('shixin');
  1063. if(is_array($shixin)){
  1064. //删除掉没有成功返回路径的图片
  1065. foreach ($shixin as $k => $v){
  1066. if(!array_key_exists('response',$v)){
  1067. unset($shixin[$k]);
  1068. }
  1069. }
  1070. }
  1071. if($shixin){
  1072. $appoint_info->shixin = json_encode($shixin);
  1073. $appoint_info->save();
  1074. }
  1075. }
  1076. //如果有声明书模块
  1077. if(in_array('baokaoshengming',$forms)){
  1078. $baokaoshengming = $request->input('baokaoshengming');
  1079. if(is_array($baokaoshengming)){
  1080. //删除掉没有成功返回路径的图片
  1081. foreach ($baokaoshengming as $k => $v){
  1082. if(!array_key_exists('response',$v)){
  1083. unset($baokaoshengming[$k]);
  1084. }
  1085. }
  1086. }
  1087. if($baokaoshengming){
  1088. $appoint_info->baokaoshengming = json_encode($baokaoshengming);
  1089. $appoint_info->save();
  1090. }
  1091. }
  1092. DB::commit();
  1093. if($operation == 2){
  1094. $log = [
  1095. 'type' => 3,
  1096. 'appoint_id'=> $appoint_info->id,
  1097. 'uid' => $uid,
  1098. 'log' => '用户提交报名'
  1099. ];
  1100. RecruitAppointLog::create($log);
  1101. return ['status' => 1, 'msg' => '提交成功', 'data' => $appoint_info->id];
  1102. }else{
  1103. return ['status' => 1, 'msg' => '资料保存成功,请尽快完善并提交', 'data' => $appoint_info->id];
  1104. }
  1105. } catch (\Exception $e){
  1106. DB::rollback();
  1107. return ['status' => 0, 'msg' => $e->getMessage()];
  1108. }
  1109. }else{
  1110. //没有报名记录,进入增加阶段的处理流程
  1111. DB::beginTransaction();
  1112. try{
  1113. //20220726增加地区undefined选项处理
  1114. if($index = stripos($data['native_place'],',undefined')){
  1115. $data['native_place'] = substr($data['native_place'],0,$index);
  1116. }
  1117. if($index = stripos($data['house_register'],',undefined')){
  1118. $data['house_register'] = substr($data['house_register'],0,$index);
  1119. }
  1120. $data['uid'] = $uid;
  1121. $data['recruit_id'] = $recruit_id;
  1122. $result = RecruitAppointInfo::create($data);
  1123. //分模块解析数据
  1124. $forms = explode(',', $recruit['forms']);
  1125. //如果有加分模块
  1126. if(in_array('expand_special',$forms)){
  1127. $special = $request->input('special');
  1128. if($special['point_apply']){
  1129. if(is_array($special['material'])){
  1130. //删除掉没有成功返回路径的图片
  1131. foreach ($special['material'] as $k => $v){
  1132. if(!array_key_exists('response',$v)){
  1133. unset($special['material'][$k]);
  1134. }
  1135. }
  1136. }
  1137. if(is_array($special['condition'])){
  1138. $special['condition'] = implode(',',$special['condition']);
  1139. }
  1140. $special['material'] = json_encode($special['material']);
  1141. $special['recruit_appoint_id'] = $appoint_info->id;
  1142. RecruitAppointExpandSpecial::create($special);
  1143. }
  1144. }
  1145. //如果有详情模块
  1146. if(in_array('detail',$forms) || in_array('internship',$forms)){
  1147. $detail = $request->input('detail');
  1148. $detail['recruit_appoint_id'] = $result->id;
  1149. RecruitAppointDetail::create($detail);
  1150. }
  1151. //如果有身份证明模块
  1152. if(in_array('identification',$forms) || in_array('internship',$forms)){
  1153. $identification = $request->input('identification');
  1154. if(is_array($identification)){
  1155. //删除掉没有成功返回路径的图片
  1156. foreach ($identification as $k => $v){
  1157. if(!array_key_exists('response',$v)){
  1158. unset($identification[$k]);
  1159. }
  1160. }
  1161. }
  1162. $result->identification = json_encode($identification);
  1163. $result->save();
  1164. }
  1165. //如果有教育证明模块
  1166. if(in_array('education_certification',$forms) || in_array('internship',$forms)){
  1167. $education_certification = $request->input('education_certification');
  1168. if(is_array($education_certification)){
  1169. //删除掉没有成功返回路径的图片
  1170. foreach ($education_certification as $k => $v){
  1171. if(!array_key_exists('response',$v)){
  1172. unset($education_certification[$k]);
  1173. }
  1174. }
  1175. }
  1176. $result->education_certification = json_encode($education_certification);
  1177. $result->save();
  1178. }
  1179. //如果有其他证明模块
  1180. if(in_array('other_certification',$forms) || in_array('internship',$forms)){
  1181. $other_certification = $request->input('other_certification');
  1182. if($other_certification){
  1183. if(is_array($other_certification)){
  1184. //删除掉没有成功返回路径的图片
  1185. foreach ($other_certification as $k => $v){
  1186. if(!array_key_exists('response',$v)){
  1187. unset($other_certification[$k]);
  1188. }
  1189. }
  1190. }
  1191. $result->other_certification = json_encode($other_certification);
  1192. $result->save();
  1193. }
  1194. }
  1195. //如果有承诺书模块
  1196. if(in_array('chengnuoshu',$forms)){
  1197. $chengnuoshu = $request->input('chengnuoshu');
  1198. if($chengnuoshu){
  1199. if(is_array($chengnuoshu)){
  1200. //删除掉没有成功返回路径的图片
  1201. foreach ($chengnuoshu as $k => $v){
  1202. if(!array_key_exists('response',$v)){
  1203. unset($chengnuoshu[$k]);
  1204. }
  1205. }
  1206. }
  1207. $result->chengnuoshu = json_encode($chengnuoshu);
  1208. $result->save();
  1209. }
  1210. }
  1211. //如果有失信被执行人模块
  1212. if(in_array('shixin',$forms)){
  1213. $shixin = $request->input('shixin');
  1214. if($shixin){
  1215. if(is_array($shixin)){
  1216. //删除掉没有成功返回路径的图片
  1217. foreach ($shixin as $k => $v){
  1218. if(!array_key_exists('response',$v)){
  1219. unset($shixin[$k]);
  1220. }
  1221. }
  1222. }
  1223. $result->shixin = json_encode($shixin);
  1224. $result->save();
  1225. }
  1226. }
  1227. //如果有声明书模块
  1228. if(in_array('baokaoshengming',$forms)){
  1229. $baokaoshengming = $request->input('baokaoshengming');
  1230. if($baokaoshengming){
  1231. if(is_array($baokaoshengming)){
  1232. //删除掉没有成功返回路径的图片
  1233. foreach ($baokaoshengming as $k => $v){
  1234. if(!array_key_exists('response',$v)){
  1235. unset($baokaoshengming[$k]);
  1236. }
  1237. }
  1238. }
  1239. $result->baokaoshengming = json_encode($baokaoshengming);
  1240. $result->save();
  1241. }
  1242. }
  1243. DB::commit();
  1244. if($operation == 2){
  1245. $log = [
  1246. 'type' => 3,
  1247. 'appoint_id'=> $result->id,
  1248. 'uid' => $uid,
  1249. 'log' => '用户首次提交报名'
  1250. ];
  1251. RecruitAppointLog::create($log);
  1252. return ['status' => 1, 'msg' => '提交成功', 'data' => $result->id];
  1253. }else{
  1254. return ['status' => 1, 'msg' => '资料保存成功,请尽快完善并提交', 'data' => $result->id];
  1255. }
  1256. } catch (\Exception $e){
  1257. DB::rollback();
  1258. return ['status' => 0, 'msg' => $e->getMessage()];
  1259. }
  1260. }
  1261. }
  1262. /**
  1263. * 获得当前登录的用户
  1264. * @return \Illuminate\Contracts\Auth\Authenticatable|null
  1265. */
  1266. public function getUser()
  1267. {
  1268. if (auth('web-member')->check()) {
  1269. $user = auth('web-member')->user();
  1270. } else {
  1271. $user = null;
  1272. }
  1273. return $user;
  1274. }
  1275. /**
  1276. * 检查用户基本信息
  1277. * @return array
  1278. */
  1279. public function checkUserBasicInfo()
  1280. {
  1281. $user = $this->getUser();
  1282. if (!empty($user)) {
  1283. $uid = $user->id;
  1284. } else {
  1285. $arr = ['status' => 401, 'msg'=>'请登录!'];
  1286. return $arr;
  1287. }
  1288. $info = RecruitAppointBasic::where('uid',$uid)->first();
  1289. if (empty($info)){
  1290. $arr = ['status'=>401,'msg'=>'请先完善招考基本信息','url'=> route('recruit.recruitInfo')];
  1291. return $arr;
  1292. }
  1293. return ['status' => 200, 'msg' => ''];
  1294. }
  1295. /**
  1296. * 个人中心招考页面
  1297. * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
  1298. */
  1299. public function person_recruit()
  1300. {
  1301. $user = auth('web-member')->user();
  1302. $list = RecruitAppointInfo::where('uid',$user->id)
  1303. ->join('recruit', 'recruit.id', '=', 'recruit_appoint_info.recruit_id', 'left')
  1304. ->join('recruit_post', 'recruit_post.id', '=', 'recruit_appoint_info.post_id', 'left')
  1305. ->select('recruit.name as recruit_name','recruit_appoint_info.*','recruit_post.code','recruit_post.name')
  1306. ->get();
  1307. return view('app.person.recruit')->with(['list' => $list,'total' => count($list)]);
  1308. }
  1309. /**
  1310. * 招考信息基础页
  1311. * @param Request $request
  1312. * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|\think\response\View
  1313. */
  1314. public function recruit_info(Request $request)
  1315. {
  1316. $user = auth('web-member')->user();
  1317. if (!empty($user)) {
  1318. $uid = $user->id;
  1319. } else {
  1320. return redirect(route('login'));
  1321. }
  1322. $info = RecruitAppointBasic::where('uid',$user->id)->first();
  1323. if(!$info){
  1324. $info = [
  1325. 'realname' => '',
  1326. 'sex' => '0',
  1327. 'birthday' => '',
  1328. 'avatar' => '',
  1329. 'nation' => '',
  1330. 'native_place' => '',
  1331. 'political_affiliation' => '',
  1332. 'titles' => '',
  1333. 'work' => '',
  1334. 'house_register' => '',
  1335. 'join_time' => '',
  1336. 'edu_type' => '',
  1337. 'education' => '',
  1338. 'school' => '',
  1339. 'degree' => '',
  1340. 'pro' => '',
  1341. 'address' => '',
  1342. 'card' => '',
  1343. 'mobile' => '',
  1344. 'email' => '',
  1345. 'concat_name' => '',
  1346. 'concat_mobile' => '',
  1347. 'resume' => '',
  1348. 'family' => [
  1349. [
  1350. 'relation' => '',
  1351. 'realname' => '',
  1352. 'birthday' => '',
  1353. 'political_affiliation' => '',
  1354. 'work' => ''
  1355. ]
  1356. ],
  1357. 'is_push' => '1'
  1358. ];
  1359. }else{
  1360. $info->sex = (string)$info->sex;
  1361. $info->edu_type = (string)$info->edu_type;
  1362. $info->is_push = (string)$info->is_push;
  1363. $info->family = empty($info->family) ? [[
  1364. 'relation' => '',
  1365. 'realname' => '',
  1366. 'birthday' => '',
  1367. 'political_affiliation' => '',
  1368. 'work' => ''
  1369. ]] : json_decode($info->family);
  1370. }
  1371. $recruit_id = $request->input('recruit_id',0);
  1372. return view('app.person.recruit_info',[
  1373. 'info' => json_encode($info),
  1374. 'recruit_id'=> $recruit_id
  1375. ]);
  1376. }
  1377. /**
  1378. * 保存招考信息
  1379. * @param RecruitValidatorRequest $request
  1380. * @return \Illuminate\Http\JsonResponse
  1381. */
  1382. public function saveRecruitInfo(RecruitValidatorRequest $request)
  1383. {
  1384. $user = auth('web-member')->user();
  1385. $basic = RecruitAppointBasic::where('uid',$user->id)->first();
  1386. $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');
  1387. if(count($data['family']) > 0){
  1388. $data['family'] = json_encode($data['family']);
  1389. }
  1390. if($basic){
  1391. //更新基础信息
  1392. $res = RecruitAppointBasic::where('uid',$user->id)->update($data);
  1393. if (!$res) {
  1394. return response()->json(['status'=>0,'msg'=>'保存失败,请联系客服']);
  1395. }else{
  1396. return response()->json(['status'=>1,'msg'=>'个人基础信息保存成功,快去报名吧!']);
  1397. }
  1398. }else{
  1399. //新增基础信息
  1400. $data['uid'] = $user->id;
  1401. $res = RecruitAppointBasic::create($data);
  1402. if (!$res) {
  1403. return response()->json(['status'=>0,'msg'=>'保存失败,请联系客服']);
  1404. }else{
  1405. return response()->json(['status'=>1,'msg'=>'个人基础信息保存成功,快去报名吧!']);
  1406. }
  1407. }
  1408. }
  1409. /**
  1410. * 笔试准考证
  1411. * @param Request $request
  1412. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1413. */
  1414. public function pen_ticket(Request $request)
  1415. {
  1416. $user = $this->getUser();
  1417. if (!empty($user)) {
  1418. $uid = $user->id;
  1419. } else {
  1420. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1421. }
  1422. $recruit_id = $request->input('recruit_id');
  1423. $recruit = Recruit::where('id',$recruit_id)->first();
  1424. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  1425. if($appoint_info){
  1426. $pen_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',1)->first();
  1427. if($pen_ticket){
  1428. $health = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
  1429. if((!$health || $health->h_status == 0) && $recruit->pen_epidemic){
  1430. return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
  1431. }
  1432. $time = time();
  1433. if(strtotime($pen_ticket->ex_start) < $time && strtotime($pen_ticket->ex_end) > $time){
  1434. RecruitTicket::where('appoint_id',$appoint_info->id)->update(['ex_status' => 1]);
  1435. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1436. $name = $recruit->name_en;
  1437. $date = date("Y-m-d",strtotime($recruit->created_at));
  1438. //$filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
  1439. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1440. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/pen/" . $filename . '.pdf';
  1441. if(file_exists($file)){
  1442. header('Content-Description: File Transfer');
  1443. header('Content-Type: application/octet-stream');
  1444. header('Content-Disposition: attachment; filename='.basename($file));
  1445. header('Content-Transfer-Encoding: binary');
  1446. header('Expires: 0');
  1447. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1448. header('Pragma: public');
  1449. header('Content-Length: ' . filesize($file));
  1450. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1451. flush();
  1452. readfile($file);
  1453. }else{
  1454. return $this->showMessage('准考证不存在,请联系管理员!', route('home'), true, '上一页', '3');
  1455. }
  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. }
  1466. /**
  1467. * 审核准考证
  1468. * @param Request $request
  1469. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1470. */
  1471. public function check_ticket(Request $request)
  1472. {
  1473. $user = $this->getUser();
  1474. if (!empty($user)) {
  1475. $uid = $user->id;
  1476. } else {
  1477. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1478. }
  1479. $recruit_id = $request->input('recruit_id');
  1480. $recruit = Recruit::where('id',$recruit_id)->first();
  1481. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  1482. if($appoint_info){
  1483. $check_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',2)->first();
  1484. if($check_ticket){
  1485. $health = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
  1486. if((!$health || $health->h_status == 0) && $recruit->pen_epidemic){
  1487. return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
  1488. }$time = time();
  1489. if(strtotime($check_ticket->ex_start) < $time && strtotime($check_ticket->ex_end) > $time){
  1490. RecruitTicket::where('id',$check_ticket->id)->update(['ex_status' => 1]);
  1491. $recruit = Recruit::where('id',$recruit_id)->first();
  1492. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1493. $name = $recruit->name_en;
  1494. $date = date("Y-m-d",strtotime($recruit->created_at));
  1495. //$filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
  1496. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1497. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/computer/" . $filename . '.pdf';
  1498. if(file_exists($file)){
  1499. header('Content-Description: File Transfer');
  1500. header('Content-Type: application/octet-stream');
  1501. header('Content-Disposition: attachment; filename='.basename($file));
  1502. header('Content-Transfer-Encoding: binary');
  1503. header('Expires: 0');
  1504. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1505. header('Pragma: public');
  1506. header('Content-Length: ' . filesize($file));
  1507. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1508. flush();
  1509. readfile($file);
  1510. }
  1511. }else{
  1512. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1513. }
  1514. }else{
  1515. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1516. }
  1517. }else{
  1518. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1519. }
  1520. }
  1521. /**
  1522. * 面试准考证
  1523. * @param Request $request
  1524. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1525. */
  1526. public function face_ticket(Request $request)
  1527. {
  1528. $user = $this->getUser();
  1529. if (!empty($user)) {
  1530. $uid = $user->id;
  1531. } else {
  1532. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1533. }
  1534. $recruit_id = $request->input('recruit_id');
  1535. $recruit = Recruit::where('id',$recruit_id)->first();
  1536. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  1537. if($appoint_info){
  1538. $face_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',3)->first();
  1539. if($face_ticket){
  1540. $health = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
  1541. if((!$health || $health->h_status == 0) && $recruit->pen_epidemic){
  1542. return $this->showMessage('健康审核信息未通过!', route('home'), true, '上一页', '3');
  1543. }$time = time();
  1544. if(strtotime($face_ticket->ex_start) < $time && strtotime($face_ticket->ex_end) > $time){
  1545. RecruitTicket::where('id',$face_ticket->id)->update(['ex_status' => 1]);
  1546. $recruit = Recruit::where('id',$recruit_id)->first();
  1547. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1548. $name = $recruit->name_en;
  1549. $date = date("Y-m-d",strtotime($recruit->created_at));
  1550. //$filename = $date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id];
  1551. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1552. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/face/" . $filename . '.pdf';
  1553. if(file_exists($file)){
  1554. header('Content-Description: File Transfer');
  1555. header('Content-Type: application/octet-stream');
  1556. header('Content-Disposition: attachment; filename='.basename($file));
  1557. header('Content-Transfer-Encoding: binary');
  1558. header('Expires: 0');
  1559. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1560. header('Pragma: public');
  1561. header('Content-Length: ' . filesize($file));
  1562. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1563. flush();
  1564. readfile($file);
  1565. }
  1566. }else{
  1567. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1568. }
  1569. }else{
  1570. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1571. }
  1572. }else{
  1573. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1574. }
  1575. }
  1576. /**
  1577. * 复试准考证
  1578. * @param Request $request
  1579. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  1580. */
  1581. public function reexamine_ticket(Request $request)
  1582. {
  1583. $user = $this->getUser();
  1584. if (!empty($user)) {
  1585. $uid = $user->id;
  1586. } else {
  1587. return $this->showMessage('请登录!', route('home'), true, '上一页', '3');
  1588. }
  1589. $recruit_id = $request->input('recruit_id');
  1590. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  1591. if($appoint_info){
  1592. $reexamine_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',4)->first();
  1593. if($reexamine_ticket){
  1594. $time = time();
  1595. if(strtotime($reexamine_ticket->ex_start) < $time && strtotime($reexamine_ticket->ex_end) > $time){
  1596. RecruitTicket::where('id',$reexamine_ticket->id)->update(['ex_status' => 1]);
  1597. $recruit = Recruit::where('id',$recruit_id)->first();
  1598. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  1599. $name = $recruit->name_en;
  1600. $date = date("Y-m-d",strtotime($recruit->created_at));
  1601. $filename = sha1($date . '_' . $appoint_info->realname . '_' . $appoint_info->card . '_' . $post_data[$appoint_info->post_id]);
  1602. $file = base_path() . "/storage/app/public/recruit/ticket/pdf/{$date}/{$name}/reexamine/" . $filename . '.pdf';
  1603. if(file_exists($file)){
  1604. header('Content-Description: File Transfer');
  1605. header('Content-Type: application/octet-stream');
  1606. header('Content-Disposition: attachment; filename='.basename($file));
  1607. header('Content-Transfer-Encoding: binary');
  1608. header('Expires: 0');
  1609. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1610. header('Pragma: public');
  1611. header('Content-Length: ' . filesize($file));
  1612. ob_clean(); //重要的就是这个函数的调用, 清空但不关闭输出缓存, 否则下载的文件头两个字符会是0a
  1613. flush();
  1614. readfile($file);
  1615. }
  1616. }else{
  1617. return $this->showMessage('非打印时间!', route('home'), true, '上一页', '3');
  1618. }
  1619. }else{
  1620. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1621. }
  1622. }else{
  1623. return $this->showMessage('暂无准考证可以打印!', route('home'), true, '上一页', '3');
  1624. }
  1625. }
  1626. /**
  1627. * 材料补登
  1628. * @param Request $request
  1629. */
  1630. public function material_supplement(Request $request)
  1631. {
  1632. $user = $this->getUser();
  1633. if (!empty($user)) {
  1634. $uid = $user->id;
  1635. } else {
  1636. return redirect(route('login'));
  1637. }
  1638. //招考id
  1639. $id = $request->input('id', 0);
  1640. if (!$id) {
  1641. return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
  1642. }
  1643. $recruit = Recruit::find($id);
  1644. if(!$recruit['status'] && !$user->recruit_test){
  1645. return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1646. }
  1647. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  1648. if(!$appoint_info){
  1649. return $this->showMessage('抱歉,您没有报名,无需考察审核!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1650. }
  1651. if($appoint_info->pen_audit != 1){
  1652. return $this->showMessage('抱歉,您未入闱,无需考察审核!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1653. }
  1654. $limit_time = 1694683800;
  1655. $time = time();
  1656. if( $time > $limit_time){
  1657. return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1658. }
  1659. $info = RecruitSupplement::where('appoint_id',$appoint_info->id)->where('type','supplement')->first();
  1660. if(!$info){
  1661. $info = [
  1662. 'appoint_id' => $appoint_info->id,
  1663. 'identification' => '',
  1664. //'household_register' => '',
  1665. //'education_certification' => '',
  1666. //'family_planning' => '',
  1667. 'chengxin' => '',
  1668. 'manage' => '',
  1669. 'status' => 3
  1670. ];
  1671. }else{
  1672. $info = $info->toArray();
  1673. if(json_decode($info['identification'])){
  1674. $identification = json_decode($info['identification'],true);
  1675. foreach ($identification as $k => $v){
  1676. if(array_key_exists('response',$v)){
  1677. $identification[$k]['url'] = $v['response']['path'];
  1678. }
  1679. }
  1680. }else{
  1681. $identification = [];
  1682. }
  1683. $info['identification'] = $identification;
  1684. if(json_decode($info['household_register'])){
  1685. $household_register = json_decode($info['household_register'],true);
  1686. foreach ($household_register as $k => $v){
  1687. if(array_key_exists('response',$v)){
  1688. $household_register[$k]['url'] = $v['response']['path'];
  1689. }
  1690. }
  1691. }else{
  1692. $household_register = [];
  1693. }
  1694. $info['household_register'] = $household_register;
  1695. if(json_decode($info['education_certification'])){
  1696. $education_certification = json_decode($info['education_certification'],true);
  1697. foreach ($education_certification as $k => $v){
  1698. if(array_key_exists('response',$v)){
  1699. $education_certification[$k]['url'] = $v['response']['path'];
  1700. }
  1701. }
  1702. }else{
  1703. $education_certification = [];
  1704. }
  1705. $info['education_certification'] = $education_certification;
  1706. if(json_decode($info['family_planning'])){
  1707. $family_planning = json_decode($info['family_planning'],true);
  1708. foreach ($family_planning as $k => $v){
  1709. if(array_key_exists('response',$v)){
  1710. $family_planning[$k]['url'] = $v['response']['path'];
  1711. }
  1712. }
  1713. }else{
  1714. $family_planning = [];
  1715. }
  1716. $info['family_planning'] = $family_planning;
  1717. if(json_decode($info['chengxin'])){
  1718. $chengxin = json_decode($info['chengxin'],true);
  1719. foreach ($chengxin as $k => $v){
  1720. if(array_key_exists('response',$v)){
  1721. $chengxin[$k]['url'] = $v['response']['path'];
  1722. }
  1723. }
  1724. }else{
  1725. $chengxin = [];
  1726. }
  1727. $info['chengxin'] = $chengxin;
  1728. if(json_decode($info['manage'])){
  1729. $manage = json_decode($info['manage'],true);
  1730. foreach ($manage as $k => $v){
  1731. if(array_key_exists('response',$v)){
  1732. $manage[$k]['url'] = $v['response']['path'];
  1733. }
  1734. }
  1735. }else{
  1736. $manage = [];
  1737. }
  1738. $info['manage'] = $manage;
  1739. }
  1740. $view_data['info'] = json_encode($info);
  1741. $view_data['title'] = $recruit->company;
  1742. return view('app.recruit.supplement',$view_data);
  1743. }
  1744. /**
  1745. * 健康信息登记
  1746. * @param Request $request
  1747. */
  1748. public function health_info(Request $request)
  1749. {
  1750. $user = $this->getUser();
  1751. if (!empty($user)) {
  1752. $uid = $user->id;
  1753. } else {
  1754. return redirect(route('login'));
  1755. }
  1756. //招考id
  1757. $id = $request->input('id', 0);
  1758. if (!$id) {
  1759. return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
  1760. }
  1761. $recruit = Recruit::find($id);
  1762. if(!$recruit['status'] && !$user->recruit_test){
  1763. return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1764. }
  1765. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  1766. if(!$appoint_info){
  1767. return $this->showMessage('抱歉,您没有报名,无需登记!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1768. }
  1769. if($appoint_info->audit != 3){
  1770. return $this->showMessage('抱歉,您无需登记!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1771. }
  1772. $time = time();
  1773. $type = $request->input('type',null);
  1774. $where = [];
  1775. if($type){
  1776. switch ($type){
  1777. case 'pen':
  1778. $start = strtotime($recruit->pen_health_start);
  1779. $end = strtotime($recruit->pen_health_end);
  1780. break;
  1781. case 'computer':
  1782. $start = strtotime($recruit->computer_health_start);
  1783. $end = strtotime($recruit->computer_health_end);
  1784. break;
  1785. case 'face':
  1786. $start = strtotime($recruit->face_health_start);
  1787. $end = strtotime($recruit->face_health_end);
  1788. break;
  1789. case 'reexamine':
  1790. $start = strtotime($recruit->reexamine_health_start);
  1791. $end = strtotime($recruit->reexamine_health_end);
  1792. break;
  1793. default:
  1794. $start = strtotime($recruit->supplement_start);
  1795. $end = strtotime($recruit->supplement_end);
  1796. break;
  1797. }
  1798. $where[] = ['type', '=', $type];
  1799. }else{
  1800. $start = strtotime($recruit->supplement_start);
  1801. $end = strtotime($recruit->supplement_end);
  1802. }
  1803. if($time > $end || $time < $start){
  1804. return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  1805. }
  1806. $where[] = ['appoint_id', '=', $appoint_info->id];
  1807. $info = RecruitSupplement::where($where)->first();
  1808. if(!$info){
  1809. $info = [
  1810. 'appoint_id' => $appoint_info->id,
  1811. 'health_code' => '',
  1812. 'trip_code' => '',
  1813. 'type' => $type
  1814. ];
  1815. }else{
  1816. $info = $info->toArray();
  1817. if(json_decode($info['health_code'])){
  1818. $health_code = json_decode($info['health_code'],true);
  1819. foreach ($health_code as $k => $v){
  1820. if(array_key_exists('response',$v)){
  1821. $health_code[$k]['url'] = $v['response']['path'];
  1822. }
  1823. }
  1824. }else{
  1825. $health_code = [];
  1826. }
  1827. $info['health_code'] = $health_code;
  1828. if(json_decode($info['trip_code'])){
  1829. $trip_code = json_decode($info['trip_code'],true);
  1830. foreach ($trip_code as $k => $v){
  1831. if(array_key_exists('response',$v)){
  1832. $trip_code[$k]['url'] = $v['response']['path'];
  1833. }
  1834. }
  1835. }else{
  1836. $trip_code = [];
  1837. }
  1838. $info['trip_code'] = $trip_code;
  1839. }
  1840. $view_data['info'] = json_encode($info);
  1841. $view_data['title'] = $recruit->company;
  1842. return view('app.recruit.health',$view_data);
  1843. }
  1844. public function save_supplement(Request $request)
  1845. {
  1846. $user = $this->getUser();
  1847. if (!empty($user)) {
  1848. $uid = $user->id;
  1849. } else {
  1850. return redirect(route('login'));
  1851. }
  1852. $limit_time = 1694683800;
  1853. $time = time();
  1854. if( $time > $limit_time){
  1855. return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',38)), true, '上一页', '3');
  1856. }
  1857. $appoint_id = $request->input('appoint_id');
  1858. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',38)->where('id',$appoint_id)->first();
  1859. if(!$appoint_info){
  1860. return ['status' => 0, 'msg' => '抱歉,找不到您要补登的报名记录!'];
  1861. }
  1862. $info = RecruitSupplement::where('appoint_id',$appoint_id)->where('type','supplement')->first();
  1863. if($info){
  1864. if($info->status == 1){
  1865. return ['status' => 0, 'msg' => '材料已审核通过,不允许修改'];
  1866. }
  1867. if($info->status == 0){
  1868. return ['status' => 0, 'msg' => '材料审核中,不允许修改'];
  1869. }
  1870. //身份证明
  1871. $identification = $request->input('identification');
  1872. if(is_array($identification)){
  1873. //删除掉没有成功返回路径的图片
  1874. foreach ($identification as $k => $v){
  1875. if(!array_key_exists('response',$v)){
  1876. unset($identification[$k]);
  1877. }
  1878. }
  1879. }
  1880. $info->identification = json_encode($identification);
  1881. //户口簿
  1882. $household_register = $request->input('household_register');
  1883. if(is_array($household_register)){
  1884. //删除掉没有成功返回路径的图片
  1885. foreach ($household_register as $k => $v){
  1886. if(!array_key_exists('response',$v)){
  1887. unset($household_register[$k]);
  1888. }
  1889. }
  1890. }
  1891. $info->household_register = json_encode($household_register);
  1892. //学信网
  1893. $education_certification = $request->input('education_certification');
  1894. if(is_array($education_certification)){
  1895. //删除掉没有成功返回路径的图片
  1896. foreach ($education_certification as $k => $v){
  1897. if(!array_key_exists('response',$v)){
  1898. unset($education_certification[$k]);
  1899. }
  1900. }
  1901. }
  1902. $info->education_certification = json_encode($education_certification);
  1903. //计生
  1904. // $family_planning = $request->input('family_planning');
  1905. // if(is_array($family_planning)){
  1906. // //删除掉没有成功返回路径的图片
  1907. // foreach ($family_planning as $k => $v){
  1908. // if(!array_key_exists('response',$v)){
  1909. // unset($family_planning[$k]);
  1910. // }
  1911. // }
  1912. // }
  1913. // $info->family_planning = json_encode($family_planning);
  1914. //失信查询 情况
  1915. $chengxin = $request->input('chengxin');
  1916. if(is_array($chengxin)){
  1917. //删除掉没有成功返回路径的图片
  1918. foreach ($chengxin as $k => $v){
  1919. if(!array_key_exists('response',$v)){
  1920. unset($chengxin[$k]);
  1921. }
  1922. }
  1923. }
  1924. $info->chengxin = json_encode($chengxin);
  1925. //综治
  1926. $manage = $request->input('manage');
  1927. if(is_array($manage)){
  1928. //删除掉没有成功返回路径的图片
  1929. foreach ($manage as $k => $v){
  1930. if(!array_key_exists('response',$v)){
  1931. unset($manage[$k]);
  1932. }
  1933. }
  1934. }
  1935. $info->manage = json_encode($manage);
  1936. $info->status = 0;
  1937. $info->save();
  1938. $appoint_info->political_audit = 4;
  1939. $appoint_info->save();
  1940. return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
  1941. }else{
  1942. $data['appoint_id'] = $appoint_id;
  1943. //身份证明
  1944. $identification = $request->input('identification');
  1945. if(is_array($identification)){
  1946. //删除掉没有成功返回路径的图片
  1947. foreach ($identification as $k => $v){
  1948. if(!array_key_exists('response',$v)){
  1949. unset($identification[$k]);
  1950. }
  1951. }
  1952. }
  1953. $data['identification'] = json_encode($identification);
  1954. //户口簿
  1955. $household_register = $request->input('household_register');
  1956. if(is_array($household_register)){
  1957. //删除掉没有成功返回路径的图片
  1958. foreach ($household_register as $k => $v){
  1959. if(!array_key_exists('response',$v)){
  1960. unset($household_register[$k]);
  1961. }
  1962. }
  1963. }
  1964. $data['household_register'] = json_encode($household_register);
  1965. //学信网
  1966. $education_certification = $request->input('education_certification');
  1967. if(is_array($education_certification)){
  1968. //删除掉没有成功返回路径的图片
  1969. foreach ($education_certification as $k => $v){
  1970. if(!array_key_exists('response',$v)){
  1971. unset($education_certification[$k]);
  1972. }
  1973. }
  1974. }
  1975. $data['education_certification'] = json_encode($education_certification);
  1976. //计生
  1977. // $family_planning = $request->input('family_planning');
  1978. // if(is_array($family_planning)){sp
  1979. // //删除掉没有成功返回路径的图片
  1980. // foreach ($family_planning as $k => $v){
  1981. // if(!array_key_exists('response',$v)){
  1982. // unset($family_planning[$k]);
  1983. // }
  1984. // }
  1985. // }
  1986. // $data['family_planning'] = json_encode($family_planning);
  1987. //失信查询 情况
  1988. $chengxin = $request->input('chengxin');
  1989. if(is_array($chengxin)){
  1990. //删除掉没有成功返回路径的图片
  1991. foreach ($chengxin as $k => $v){
  1992. if(!array_key_exists('response',$v)){
  1993. unset($chengxin[$k]);
  1994. }
  1995. }
  1996. }
  1997. $data['chengxin'] = json_encode($chengxin);
  1998. //综治
  1999. $manage = $request->input('manage');
  2000. if(is_array($manage)){
  2001. //删除掉没有成功返回路径的图片
  2002. foreach ($manage as $k => $v){
  2003. if(!array_key_exists('response',$v)){
  2004. unset($manage[$k]);
  2005. }
  2006. }
  2007. }
  2008. $data['manage'] = json_encode($manage);
  2009. $data['status'] = 0;
  2010. $data['type'] = 'supplement';
  2011. $result = RecruitSupplement::create($data);
  2012. $appoint_info->political_audit = 4;
  2013. $appoint_info->save();
  2014. return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
  2015. }
  2016. return ['status' => 0, 'msg' => 'test', 'data' => ''];
  2017. }
  2018. public function save_healthinfo(Request $request)
  2019. {
  2020. $user = $this->getUser();
  2021. if (!empty($user)) {
  2022. $uid = $user->id;
  2023. } else {
  2024. return redirect(route('login'));
  2025. }
  2026. $appoint_id = $request->input('appoint_id');
  2027. $type = $request->input('type');
  2028. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('id',$appoint_id)->first();
  2029. if(!$appoint_info){
  2030. return ['status' => 0, 'msg' => '抱歉,找不到您要登记的报名记录!'];
  2031. }
  2032. $recruit = Recruit::where('id',$appoint_info->recruit_id)->first();
  2033. $info = RecruitSupplement::where('appoint_id',$appoint_id)->where('type',$type)->first();
  2034. if($info){
  2035. if($info->h_status == 1){
  2036. return ['status' => 0, 'msg' => '材料已审核通过,不允许修改'];
  2037. }
  2038. if($info->h_status == 0){
  2039. return ['status' => 0, 'msg' => '材料审核中,不允许修改'];
  2040. }
  2041. $health_code = $request->input('health_code');
  2042. if(is_array($health_code)){
  2043. //删除掉没有成功返回路径的图片
  2044. foreach ($health_code as $k => $v){
  2045. if(!array_key_exists('response',$v)){
  2046. unset($health_code[$k]);
  2047. }
  2048. }
  2049. }
  2050. $info->health_code = json_encode($health_code);
  2051. $trip_code = $request->input('trip_code');
  2052. if(is_array($trip_code)){
  2053. //删除掉没有成功返回路径的图片
  2054. foreach ($trip_code as $k => $v){
  2055. if(!array_key_exists('response',$v)){
  2056. unset($trip_code[$k]);
  2057. }
  2058. }
  2059. }
  2060. $info->trip_code = json_encode($trip_code);
  2061. $info->h_status = 0;
  2062. $appoint_info->health_audit = 4;
  2063. $appoint_info->save();
  2064. $info->save();
  2065. return ['status' => 1, 'msg' => '提交成功', 'data' => ''];
  2066. }else{
  2067. $data['appoint_id'] = $appoint_id;
  2068. $data['type'] = $type;
  2069. $data['h_status'] = 0;
  2070. $appoint_info->health_audit = 4;
  2071. $health_code = $request->input('health_code');
  2072. if(is_array($health_code)){
  2073. //删除掉没有成功返回路径的图片
  2074. foreach ($health_code as $k => $v){
  2075. if(!array_key_exists('response',$v)){
  2076. unset($health_code[$k]);
  2077. }
  2078. }
  2079. }
  2080. $health_result = $this->baiduService->health_code(file_get_contents(base_path() . "/public" . $health_code[0]['response']['path']));
  2081. $health_msg = ['健康码自动审核通过'];
  2082. //$h_status = 1;
  2083. //$appoint_info->health_audit = 1;
  2084. if(!array_key_exists('error_msg',$health_result) && !array_key_exists('error_code',$health_result)){
  2085. if(array_key_exists('姓名',$health_result)){
  2086. if(stripos($health_result['姓名'][0]['word'],'*')>0){
  2087. return ['status' => 0, 'msg' => '请打开健康码的“眼睛开关”,显示完整个人信息'];
  2088. }
  2089. if($health_result['姓名'][0]['word'] != $appoint_info->realname){
  2090. array_push($health_msg,'抱歉,请上传您本人的健康码!');
  2091. }
  2092. }else{
  2093. array_push($health_msg,'健康码错误,识别不到姓名!');
  2094. }
  2095. if(array_key_exists('状态',$health_result)){
  2096. if($health_result['状态'][0]['word'] != '绿码'){
  2097. array_push($health_msg,'抱歉,您的健康码非绿码!');
  2098. }
  2099. }else{
  2100. array_push($health_msg,'健康码错误,识别不到状态!');
  2101. }
  2102. if(array_key_exists('更新时间',$health_result)){
  2103. $time = strtotime($health_result['更新时间'][0]['word']);
  2104. if($time < strtotime($recruit->pen_health_start) || $time > strtotime($recruit->pen_health_end)){
  2105. array_push($health_msg,'抱歉,请上传{$recruit->pen_health_start}至{$recruit->pen_health_end}之间的健康码!');
  2106. }
  2107. }else{
  2108. array_push($health_msg,'健康码错误,识别不到时间!');
  2109. }
  2110. //$data['h_status'] = $h_status;
  2111. $data['h_msg'] = implode(';',$health_msg);
  2112. //$appoint_info->health_audit = $h_status == 1 ? 1 : 4;
  2113. $data['health_code'] = json_encode($health_code);
  2114. }
  2115. $data['health_result'] = json_encode($health_result);
  2116. $trip_code = $request->input('trip_code');
  2117. if(is_array($trip_code)){
  2118. //删除掉没有成功返回路径的图片
  2119. foreach ($trip_code as $k => $v){
  2120. if(!array_key_exists('response',$v)){
  2121. unset($trip_code[$k]);
  2122. }
  2123. }
  2124. }
  2125. $trip_result = $this->baiduService->trip_code(file_get_contents(base_path() . "/public" . $trip_code[0]['response']['path']));
  2126. $trip_msg = [];
  2127. $trip_status = 0;
  2128. if(!array_key_exists('error_msg',$trip_result) && !array_key_exists('error_code',$trip_result)){
  2129. if(array_key_exists('途经地',$trip_result['result'])){
  2130. $fangyi_area = explode("\r\n",config('aix.fangyi.fangyi_zhaokao.fangyi_zhaokao.risk_area'));
  2131. $result = array_intersect($fangyi_area,$trip_result['result']['途经地'][0]['word']);
  2132. if(count($result) > 0){
  2133. array_push($trip_msg,'抱歉,您的行程中包含系统设置中高风险地区!');
  2134. $trip_status = 0;
  2135. }
  2136. }
  2137. if(array_key_exists('风险性',$trip_result['result']) && $trip_result['result']['风险性']){
  2138. array_push($trip_msg,'抱歉,您的行程可能含有风险!');
  2139. $trip_status = 0;
  2140. }
  2141. if(array_key_exists('更新时间',$trip_result['result'])){
  2142. $time = strtotime($trip_result['result']['更新时间'][0]['word'][0]);
  2143. if($time > strtotime($recruit->pen_health_start) || $recruit < ($recruit->pen_health_end)){
  2144. array_push($trip_msg,'抱歉,请上传{$recruit->pen_health_start}至{$recruit->pen_health_end}之间的行程码!');
  2145. $trip_status = 0;
  2146. }
  2147. }
  2148. $data['h_msg'] .= implode(';',$trip_msg);
  2149. }
  2150. $data['trip_result'] = json_encode($trip_result);
  2151. $data['trip_code'] = json_encode($trip_code);
  2152. $data['h_status'] = 0;
  2153. $appoint_info->health_audit = 4;
  2154. RecruitSupplement::create($data);
  2155. $appoint_info->save();
  2156. return ['status' => 1, 'msg' => '提交成功,请刷新查看审核结果', 'data' => ''];
  2157. }
  2158. return ['status' => 0, 'msg' => 'test', 'data' => ''];
  2159. }
  2160. public function post_select(Request $request)
  2161. {
  2162. $user = $this->getUser();
  2163. if (!empty($user)) {
  2164. $uid = $user->id;
  2165. } else {
  2166. return redirect(route('login'));
  2167. }
  2168. $recruit_id = $request->input('recruit_id');
  2169. //$appoint_id = $request->input('appoint_id');
  2170. $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->first();
  2171. if(!$info){
  2172. return $this->showMessage('抱歉,您无需择岗!', route('recruit.show',array('id',$recruit_id)), true, '上一页', '2');
  2173. }
  2174. //手动设置择岗时间段
  2175. $time = time();
  2176. if($time > 1695096000 || $time < 1694998800){
  2177. //if($time > 1694491200){
  2178. return $this->showMessage('抱歉,未到择岗时间!', route('recruit.show',array('id',$recruit_id)), true, '上一页', '2');
  2179. }
  2180. if($info->type == 1){
  2181. $option_list = [
  2182. [
  2183. 'id' => 1,
  2184. 'name' => '陈埭镇'
  2185. ],
  2186. [
  2187. 'id' => 2,
  2188. 'name' => '池店镇'
  2189. ],
  2190. [
  2191. 'id' => 3,
  2192. 'name' => '金井镇'
  2193. ],
  2194. [
  2195. 'id' => 4,
  2196. 'name' => '龙湖镇'
  2197. ]
  2198. ];
  2199. }else{
  2200. $option_list = [
  2201. [
  2202. 'id' => 5,
  2203. 'name' => '陈埭镇'
  2204. ],
  2205. [
  2206. 'id' => 6,
  2207. 'name' => '金井镇'
  2208. ],
  2209. [
  2210. 'id' => 7,
  2211. 'name' => '龙湖镇'
  2212. ]
  2213. ];
  2214. }
  2215. $select_list = [];
  2216. if($info->result){
  2217. $result = json_decode($info->result,true);
  2218. foreach ($result as $v){
  2219. $item['name'] = $v;
  2220. array_push($select_list,$item);
  2221. }
  2222. }
  2223. // $recruit_id = $request->input('recruit_id');
  2224. // $appoint_id = $request->input('appoint_id');
  2225. // $uid = $request->input('uid');
  2226. // $info = RecruitAppointSelect::where('uid',$uid)->first();
  2227. // if(!$info){
  2228. // $info = new \stdClass();
  2229. // $info->status = 0;
  2230. // $info->recruit_id = 8;
  2231. // $info->appoint_id = rand(0,999999);
  2232. // $info->uid = rand(0,999999);
  2233. // }else{
  2234. // $result = json_decode($info->result,true);
  2235. // foreach ($option_list as $k => $v){
  2236. // if(in_array($v['name'],$result)){
  2237. // $select_list[$k] = $v;
  2238. // unset($option_list[$k]);
  2239. // }
  2240. // }
  2241. // }
  2242. $view_data = ['info' => $info,'options_list' => json_encode($option_list),'select_list' => json_encode($select_list)];
  2243. return view('app.recruit.post_select',$view_data);
  2244. }
  2245. /**
  2246. * 放弃择岗
  2247. */
  2248. public function give_up_post(Request $request)
  2249. {
  2250. //以下为测试环境
  2251. // $recruit_id = $request->input('recruit_id');
  2252. // $appoint_id = $request->input('appoint_id');
  2253. // $uid = $request->input('uid');
  2254. // $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->where('appoint_id',$appoint_id)->first();
  2255. // if($info){
  2256. // return ['status' => 0, 'msg' => "测试数据重复,请重新点击生成测试数据!"];
  2257. // }
  2258. // RecruitAppointSelect::create(['recruit_id'=>$recruit_id,'appoint_id'=>$appoint_id,'uid'=>$uid,'status'=>-1]);
  2259. // return ['status' => 1, 'msg' => "放弃择岗成功!"];
  2260. //以下为正式环境再放开
  2261. $user = $this->getUser();
  2262. if (!empty($user)) {
  2263. $uid = $user->id;
  2264. } else {
  2265. return redirect(route('login'));
  2266. }
  2267. $recruit_id = $request->input('recruit_id');
  2268. $appoint_id = $request->input('appoint_id');
  2269. $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->where('appoint_id',$appoint_id)->first();
  2270. if($info == null){
  2271. return ['status' => 0, 'msg' => "抱歉,您无需择岗!"];
  2272. }
  2273. if($info->status != 0){
  2274. return ['status' => 0, 'msg' => "抱歉,您不是待择岗状态!"];
  2275. }
  2276. $info->status = -1;
  2277. $info->save();
  2278. return ['status' => 1, 'msg' => "放弃择岗成功!"];
  2279. }
  2280. public function comfirm_post(Request $request)
  2281. {
  2282. $user = $this->getUser();
  2283. if (!empty($user)) {
  2284. $uid = $user->id;
  2285. } else {
  2286. return redirect(route('login'));
  2287. }
  2288. $recruit_id = $request->input('recruit_id');
  2289. $appoint_id = $request->input('appoint_id');
  2290. $time = time();
  2291. if($time > 1695096000 || $time < 1694998800){
  2292. return ['status' => 0, 'msg' => "抱歉,未到择岗时间!"];
  2293. }
  2294. $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->where('appoint_id',$appoint_id)->first();
  2295. if($info->result){
  2296. return ['status' => 0, 'msg' => "择岗数据已提交!"];
  2297. }
  2298. // $data = [
  2299. // 'recruit_id' => $recruit_id,
  2300. // 'appoint_id' => $recruit_id,
  2301. // 'uid' => $uid,
  2302. // 'status' => 1
  2303. // ];
  2304. $result = [];
  2305. $select = $request->input('select');
  2306. if(is_array($select) && count($select) > 0){
  2307. foreach ($select as $v) {
  2308. array_push($result,$v['name']);
  2309. }
  2310. }
  2311. $info->result = json_encode($result);
  2312. $info->status = 1;
  2313. $info->save();
  2314. return ['status' => 1, 'msg' => "提交择岗意愿成功,请耐心等待结果!"];
  2315. }
  2316. public function select_result(Request $request)
  2317. {
  2318. return view('app.recruit.select_result');
  2319. }
  2320. public function get_select_result(Request $request)
  2321. {
  2322. $redis = Cache::getRedis();
  2323. $quota = $redis->get('recruit_quotaA');
  2324. if(!$quota){
  2325. $quota = [
  2326. [
  2327. 'name' => '陈埭镇',
  2328. 'value' => 2
  2329. ],
  2330. [
  2331. 'name' => '池店镇',
  2332. 'value' => 1
  2333. ],
  2334. [
  2335. 'name' => '金井镇',
  2336. 'value' => 2
  2337. ],
  2338. [
  2339. 'name' => '龙湖镇',
  2340. 'value' => 2
  2341. ]
  2342. ];
  2343. $redis->set('recruit_quotaA',json_encode($quota));
  2344. }else{
  2345. $quota = json_decode($quota,true);
  2346. }
  2347. $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();
  2348. $return_data = [
  2349. 'list' => []
  2350. ];
  2351. $array_column = array_column($quota,'name');
  2352. if(count($list) > 1){
  2353. $current = $list[0];
  2354. $next = $list[1];
  2355. }else{
  2356. $current = $list[0];
  2357. $next = false;
  2358. }
  2359. $person_select_result = json_decode($current->result,true);
  2360. $flag = 0;//是否择岗成功
  2361. foreach ($person_select_result as $val){
  2362. //寻找下标
  2363. $index = array_search($val,$array_column);
  2364. if($quota[$index]['value']){
  2365. if($next && $current->record == $next->record && $current->record2 == $next->record2 && $current->record3 == $next->record3 && $quota[$index]['value'] == 1){
  2366. //如果当前处理人员不是最后一个,且分数与下一名人员三个维度完全一样的话并且该人员欲择的岗位仅剩一位,则特殊处理
  2367. //查找同样分数人同样志愿
  2368. $next_select_result = json_decode($next->result,true);
  2369. //寻找下标
  2370. $current_index = array_search($val,$person_select_result);
  2371. $next_index = array_search($val,$next_select_result);
  2372. if($current_index > $next_index){
  2373. //如果当前人员对当前镇街的意向排序大于下一人,调换两个指针,先排序下一个人
  2374. $current = $next;
  2375. }
  2376. }
  2377. $quota_data = [
  2378. 'index' => $index,
  2379. 'old_value' => $quota[$index]['value']
  2380. ];
  2381. //有名额允许择岗
  2382. DB::table('recruit_appoint_select')->where('id',$current->id)->update(['select_result'=>$val,'status' => 1]);
  2383. $current->select_result = $val;
  2384. $quota[$index]['value']--;
  2385. $quota_data['new_value'] = $quota[$index]['value'];
  2386. $redis->set('recruit_quotaA',json_encode($quota));
  2387. $flag = 1;
  2388. break;
  2389. }
  2390. }
  2391. if(!$flag){
  2392. $current->select_result = '未匹配到志愿,本轮择岗不成功!';
  2393. DB::table('recruit_appoint_select')->where('id',$current->id)->update(['select_result'=>'未匹配到志愿,本轮择岗不成功!','status' => -2]);
  2394. }
  2395. $return_data['quota'] = $quota_data;
  2396. return ['status' => 1, 'msg' => '择岗排序成功', 'data' => $return_data];
  2397. }
  2398. public function select_init(Request $request)
  2399. {
  2400. $count = DB::table('recruit_appoint_select')->whereRaw('select_result is null and batch = 3 and type = 2')->count();
  2401. $redis = Cache::getRedis();
  2402. $quotaA = $redis->get('recruit_quotaA');
  2403. $quotaB = $redis->get('recruit_quotaB');
  2404. if(!$quotaA){
  2405. $quotaA = [
  2406. [
  2407. 'name' => '梅岭街道',
  2408. 'value' => 3
  2409. ],
  2410. [
  2411. 'name' => '西园街道',
  2412. 'value' => 3
  2413. ],
  2414. [
  2415. 'name' => '罗山街道',
  2416. 'value' => 3
  2417. ],
  2418. [
  2419. 'name' => '新塘街道',
  2420. 'value' => 3
  2421. ],
  2422. [
  2423. 'name' => '陈埭镇',
  2424. 'value' => 10
  2425. ],
  2426. [
  2427. 'name' => '池店镇',
  2428. 'value' => 7
  2429. ],
  2430. [
  2431. 'name' => '安海镇',
  2432. 'value' => 5
  2433. ],
  2434. [
  2435. 'name' => '内坑镇',
  2436. 'value' => 3
  2437. ],
  2438. [
  2439. 'name' => '金井镇',
  2440. 'value' => 3
  2441. ],
  2442. [
  2443. 'name' => '龙湖镇',
  2444. 'value' => 5
  2445. ],
  2446. [
  2447. 'name' => '经济开发区',
  2448. 'value' => 5
  2449. ]
  2450. ];
  2451. $redis->set('recruit_quota',json_encode($quotaA));
  2452. }
  2453. if(!$quotaB){
  2454. $quotaB = [
  2455. [
  2456. 'name' => '青阳街道',
  2457. 'value' => 7
  2458. ],
  2459. [
  2460. 'name' => '梅岭街道',
  2461. 'value' => 14
  2462. ],
  2463. [
  2464. 'name' => '西园街道',
  2465. 'value' => 11
  2466. ],
  2467. [
  2468. 'name' => '罗山街道',
  2469. 'value' => 7
  2470. ],
  2471. [
  2472. 'name' => '灵源街道',
  2473. 'value' => 3
  2474. ],
  2475. [
  2476. 'name' => '新塘街道',
  2477. 'value' => 13
  2478. ],
  2479. [
  2480. 'name' => '陈埭镇',
  2481. 'value' => 49
  2482. ],
  2483. [
  2484. 'name' => '池店镇',
  2485. 'value' => 23
  2486. ],
  2487. [
  2488. 'name' => '安海镇',
  2489. 'value' => 16
  2490. ],
  2491. [
  2492. 'name' => '磁灶镇',
  2493. 'value' => 2
  2494. ],
  2495. [
  2496. 'name' => '内坑镇',
  2497. 'value' => 4
  2498. ],
  2499. [
  2500. 'name' => '紫帽镇',
  2501. 'value' => 8
  2502. ],
  2503. [
  2504. 'name' => '永和镇',
  2505. 'value' => 5
  2506. ],
  2507. [
  2508. 'name' => '金井镇',
  2509. 'value' => 11
  2510. ],
  2511. [
  2512. 'name' => '龙湖镇',
  2513. 'value' => 41
  2514. ],
  2515. [
  2516. 'name' => '经济开发区',
  2517. 'value' => 18
  2518. ]
  2519. ];
  2520. $redis->set('recruit_quota',json_encode($quotaB));
  2521. }
  2522. $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();
  2523. return ['status' => 1, 'msg' => '获取初始化信息成功', 'data' => ['count' => $count, 'quota' => $quotaB, 'list' => $list]];
  2524. }
  2525. public function interviewer_random(Request $request)
  2526. {
  2527. $model = $request->input('model',1);
  2528. $number1 = $request->input('number1',5);//考官人数
  2529. $number2 = $request->input('number2',1);//替补人数
  2530. $where[] = ['id','>',0];
  2531. switch ($model){
  2532. case '0':
  2533. $list = DB::table('recruit_interviewer')->get()->toArray();
  2534. shuffle($list);
  2535. $result = array_slice($list, 0, $number1+$number2);
  2536. break;
  2537. case '1':
  2538. $list = DB::table('recruit_interviewer')->get()->toArray();
  2539. shuffle($list);
  2540. $count = $number1;
  2541. for ($i = 0; $i < $count; $i++){
  2542. if(!$list[$i]->status){
  2543. $list[] = $list[$i];
  2544. unset($list[$i]);
  2545. $count++;
  2546. }
  2547. }
  2548. $result = array_slice($list, 0, $number1+$number2);
  2549. break;
  2550. case '2':
  2551. $list = DB::table('recruit_interviewer')->where('status',1)->get()->toArray();
  2552. shuffle($list);
  2553. $result = array_slice($list, 0, $number1+$number2);
  2554. break;
  2555. default:
  2556. $list = DB::table('recruit_interviewer')->get()->toArray();
  2557. shuffle($list);
  2558. for ($i = 0; $i < $number1; $i++){
  2559. dd($list[$i]);
  2560. if(!$list[$i]->status){
  2561. $list[] = $list[$i];
  2562. unset($list[$i]);
  2563. }
  2564. }
  2565. $result = array_slice($list, 0, $number1+$number2);
  2566. break;
  2567. }
  2568. $return_data = [
  2569. 'list' => $result,
  2570. 'number1' => $number1,
  2571. 'number2' => $number2
  2572. ];
  2573. return view('app.recruit.interviewer', $return_data);
  2574. }
  2575. public function supplement_info(Request $request)
  2576. {
  2577. $user = $this->getUser();
  2578. if (!empty($user)) {
  2579. $uid = $user->id;
  2580. } else {
  2581. return redirect(route('login'));
  2582. }
  2583. //招考id
  2584. $id = $request->input('id', 0);
  2585. if (!$id) {
  2586. return $this->showMessage('请选择报名项目!', route('home'), true, '上一页', '3');
  2587. }
  2588. $recruit = Recruit::find($id);
  2589. if(!$recruit['status']){
  2590. return $this->showMessage('抱歉,该项目状态不正确,请联系客服!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2591. }
  2592. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  2593. if(!$appoint_info){
  2594. return $this->showMessage('抱歉,您没有报名,无需补充信息!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2595. }
  2596. $supplement_info = DB::table("recruit_supplement_cunwu")->where('uid',$uid)->where('appoint_id',$appoint_info->id)->first();
  2597. if($supplement_info){
  2598. return $this->showMessage('您已登记信息,无需再次登记!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2599. }
  2600. $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];//写死用户
  2601. if(!in_array($uid,$uids)){
  2602. return $this->showMessage('您无需登记信息!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2603. }
  2604. // $limit_time = 1661961599;
  2605. // $time = time();
  2606. // if( $time > $limit_time){
  2607. // return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
  2608. // }
  2609. $view_data = [];
  2610. //$view_data['info'] = json_encode($info);
  2611. $view_data['title'] = $recruit->company;
  2612. $view_data['id'] = $id;
  2613. return view('app.recruit.supplement_info',$view_data);
  2614. }
  2615. public function save_supplement_info(Request $request){
  2616. $user = $this->getUser();
  2617. if (!empty($user)) {
  2618. $uid = $user->id;
  2619. } else {
  2620. return redirect(route('login'));
  2621. }
  2622. //招考id
  2623. $id = $request->input('recruit_id', 0);
  2624. if (!$id) {
  2625. return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
  2626. }
  2627. $recruit = Recruit::find($id);
  2628. if(!$recruit['status']){
  2629. return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
  2630. }
  2631. $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('recruit_id',$id)->first();
  2632. if(!$appoint_info){
  2633. return ['status' => 0, 'msg' => '抱歉,您没有报名,无需补充信息!', 'data' => ''];
  2634. }
  2635. if($request->input('marriage') == '已婚'){
  2636. if($request->input('spouse_card_type') == '' || $request->input('spouse_card') == '' || $request->input('spouse_realname') == '' || $request->input('spouse_mobile') == ''){
  2637. return ['status' => 0, 'msg' => '请完善配偶信息!', 'data' => ''];
  2638. }
  2639. }
  2640. $data = [
  2641. 'uid' => $uid,
  2642. 'appoint_id' => $appoint_info->id,
  2643. 'street' => $request->input('street'),
  2644. 'realname' => $request->input('realname'),
  2645. 'sex' => $request->input('sex'),
  2646. 'house' => $request->input('house'),
  2647. 'nation' => $request->input('nation'),
  2648. 'native' => $request->input('native'),
  2649. 'marriage' => $request->input('marriage'),
  2650. 'spouse_card_type' => $request->input('spouse_card_type'),
  2651. 'spouse_card' => $request->input('spouse_card'),
  2652. 'spouse_realname' => $request->input('spouse_realname'),
  2653. 'spouse_mobile' => $request->input('spouse_mobile'),
  2654. 'political' => $request->input('political'),
  2655. 'bank_card' => $request->input('bank_card'),
  2656. 'bank_open' => $request->input('bank_open'),
  2657. 'card' => $request->input('card'),
  2658. 'card_endtime' => $request->input('card_endtime'),
  2659. 'mobile' => $request->input('mobile'),
  2660. 'edu' => $request->input('education'),
  2661. 'pro' => $request->input('pro'),
  2662. 'address' => $request->input('address'),
  2663. 'funds' => $request->input('funds')
  2664. ];
  2665. DB::table('recruit_supplement_cunwu')->insert($data);
  2666. return ['status' => 1, 'msg' => '提交成功!', 'data' => ''];
  2667. }
  2668. public function comfirm_pen(Request $request){
  2669. $user = $this->getUser();
  2670. if (!empty($user)) {
  2671. $uid = $user->id;
  2672. } else {
  2673. return redirect(route('login'));
  2674. }
  2675. //招考id
  2676. $id = $request->input('recruit_id', 0);
  2677. if (!$id) {
  2678. return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
  2679. }
  2680. $recruit = Recruit::find($id);
  2681. if(!$recruit['status']){
  2682. return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
  2683. }
  2684. if(!$recruit->pen_comfirm){
  2685. return ['status' => 0, 'msg' => '该项目无须确认笔试考试!', 'data' => ''];
  2686. }
  2687. $appoint_info = RecruitAppointInfo::where('recruit_id',$id)->where('uid',$uid)->first();
  2688. if(!$appoint_info){
  2689. return ['status' => 0, 'msg' => '找不到您的报名记录,请检查!', 'data' => ''];
  2690. }
  2691. if($appoint_info->audit != 3){
  2692. return ['status' => 0, 'msg' => '您的报名未审核通过,无需确认!', 'data' => ''];
  2693. }
  2694. $time = time();
  2695. if(strtotime($recruit->pen_comfirm_start) > $time || strtotime($recruit->pen_comfirm_end) < $time){
  2696. return ['status' => 0, 'msg' => '未在笔试确认时间段!', 'data' => ''];
  2697. }
  2698. if($appoint_info->pen_audit != -2){
  2699. return ['status' => 0, 'msg' => '您已确认参加笔试,无需再次确认!', 'data' => ''];
  2700. }
  2701. $appoint_info->update(['pen_audit' => -1]);
  2702. $log = [
  2703. 'type' => 3,
  2704. 'appoint_id'=> $appoint_info->id,
  2705. 'uid' => $uid,
  2706. 'log' => '用户确认参加笔试'
  2707. ];
  2708. RecruitAppointLog::create($log);
  2709. return ['status' => 1, 'msg' => '确认成功', 'data' => $appoint_info->id];
  2710. }
  2711. public function supplementary_entry(Request $request){
  2712. $user = $this->getUser();
  2713. if (!empty($user)) {
  2714. $uid = $user->id;
  2715. } else {
  2716. return redirect(route('login'));
  2717. }
  2718. //招考id
  2719. $id = $request->input('recruit_id', 0);
  2720. if (!$id) {
  2721. return ['status' => 0, 'msg' => '请选择报名项目!', 'data' => ''];
  2722. }
  2723. $recruit = Recruit::find($id);
  2724. if(!$recruit['status']){
  2725. return ['status' => 0, 'msg' => '抱歉,该项目状态不正确,请联系客服!', 'data' => ''];
  2726. }
  2727. $appoint_info = RecruitAppointInfo::where('recruit_id',$id)->where('uid',$uid)->first();
  2728. if(!$appoint_info){
  2729. return ['status' => 0, 'msg' => '找不到您的报名记录,请检查!', 'data' => ''];
  2730. }
  2731. $time = time();
  2732. if($time > 1680969600){
  2733. return ['status' => 0, 'msg' => '已停止补充报名!', 'data' => ''];
  2734. }
  2735. if($appoint_info->adjust_limit){
  2736. $appoint_info->update(['adjust' => 1]);
  2737. return ['status' => 1, 'msg' => '补充报名成功!', 'data' => ''];
  2738. }else{
  2739. return ['status' => 0, 'msg' => '您无需补充报名!', 'data' => ''];
  2740. }
  2741. }
  2742. }