IndexController.php 127 KB

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