IndexController.php 125 KB

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