IndexController.php 127 KB

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