JobfairController.php 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: wuzhenke
  5. * Date: 2019/1/17
  6. * Time: 16:19
  7. */
  8. namespace App\Http\Controllers\Mobile\Jobfair;
  9. use App\Http\Controllers\Mobile\MobileBaseController;
  10. use App\Models\Subsite;
  11. use App\Repositories\CompanyRepository;
  12. use App\Repositories\Jobfair\JobfairCompanyRepository;
  13. use App\Repositories\Jobfair\JobfairFloorPlanRepository;
  14. use App\Repositories\Jobfair\JobfairFloorplanStandRepository;
  15. use App\Repositories\Jobfair\JobfairPersonalJobsApplyRepository;
  16. use App\Repositories\Jobfair\JobfairPutJobRepository;
  17. use App\Repositories\Jobfair\JobfairRepository;
  18. use App\Repositories\ResumeRepository;
  19. use App\Repositories\Jobfair\JobfairJobRepository;
  20. use App\Services\Jobfair\JobfairCompanyService;
  21. use App\Services\Jobfair\JobfairJobsService;
  22. use App\Services\Jobfair\JobfairPersonalJopApplyService;
  23. use App\Services\Jobfair\JobfairService;
  24. use App\Services\Jobfair\JobfairPutJobService;
  25. use App\Services\Person\ResumeService;
  26. use Illuminate\Http\Request;
  27. use App\Services\Company\CompanyService;
  28. use App\Services\Jobfair\JobfairPersonSignedService;
  29. use App\Repositories\Jobfair\JobfairPersonSignedRepository;
  30. class JobfairController extends MobileBaseController
  31. {
  32. protected $jobfairJobsService;
  33. protected $jobfairCompanyRepository;
  34. protected $jobfairCompanyService;
  35. protected $jobfairService;
  36. protected $jobfairRepository;
  37. protected $jobfairPersonalJobsApplyRepository;
  38. protected $jobfairPersonalJopApplyService;
  39. protected $resumeService;
  40. protected $jobfairFloorplanStandRepository;
  41. protected $jobfairFloorPlanRepository;
  42. protected $jobfairPutJobRepository;
  43. protected $companyRepository;
  44. protected $resumeRepository;
  45. protected $jobfairJobRepository;
  46. protected $companyService;
  47. protected $jobfairPersonSignedService;
  48. protected $jobfairPersonSignedRepository;
  49. protected $jobfairPutJobService;
  50. /**
  51. * JobfairController constructor.
  52. * @param ResumeService $resumeService
  53. * @param JobfairJobRepository $jobfairJobRepository
  54. * @param ResumeRepository $resumeRepository
  55. * @param CompanyRepository $companyRepository
  56. * @param JobfairPutJobRepository $jobfairPutJobRepository
  57. * @param JobfairJobsService $jobfairJobsService
  58. * @param JobfairFloorPlanRepository $jobfairFloorPlanRepository
  59. * @param JobfairFloorplanStandRepository $jobfairFloorplanStandRepository
  60. * @param JobfairPersonalJopApplyService $jobfairPersonalJopApplyService
  61. * @param JobfairPersonalJobsApplyRepository $jobfairPersonalJobsApplyRepository
  62. * @param JobfairRepository $jobfairRepository
  63. * @param JobfairService $jobfairService
  64. * @param JobfairCompanyService $jobfairCompanyService
  65. * @param JobfairCompanyRepository $jobfairCompanyRepository
  66. * @param CompanyService $companyService
  67. * @param JobfairPersonSignedRepository $jobfairPersonSignedRepository
  68. * @param JobfairPersonSignedService $jobfairPersonSignedService
  69. * @param JobfairPutJobService $jobfairPutJobService
  70. */
  71. public function __construct(ResumeService $resumeService, JobfairJobRepository $jobfairJobRepository, ResumeRepository $resumeRepository, CompanyRepository $companyRepository, JobfairPutJobRepository $jobfairPutJobRepository, JobfairJobsService $jobfairJobsService, JobfairFloorPlanRepository $jobfairFloorPlanRepository, JobfairFloorplanStandRepository $jobfairFloorplanStandRepository, JobfairPersonalJopApplyService $jobfairPersonalJopApplyService, JobfairPersonalJobsApplyRepository $jobfairPersonalJobsApplyRepository, JobfairRepository $jobfairRepository, JobfairService $jobfairService, JobfairCompanyService $jobfairCompanyService, JobfairCompanyRepository $jobfairCompanyRepository, CompanyService $companyService, JobfairPersonSignedRepository $jobfairPersonSignedRepository, JobfairPersonSignedService $jobfairPersonSignedService, JobfairPutJobService $jobfairPutJobService)
  72. {
  73. $this->jobfairJobsService = $jobfairJobsService;
  74. $this->jobfairCompanyRepository = $jobfairCompanyRepository;
  75. $this->jobfairCompanyService = $jobfairCompanyService;
  76. $this->jobfairService = $jobfairService;
  77. $this->jobfairRepository = $jobfairRepository;
  78. $this->jobfairPersonalJobsApplyRepository = $jobfairPersonalJobsApplyRepository;
  79. $this->jobfairPersonalJopApplyService = $jobfairPersonalJopApplyService;
  80. $this->resumeService = $resumeService;
  81. $this->jobfairFloorplanStandRepository = $jobfairFloorplanStandRepository;
  82. $this->jobfairFloorPlanRepository = $jobfairFloorPlanRepository;
  83. $this->jobfairPutJobRepository = $jobfairPutJobRepository;
  84. $this->companyRepository = $companyRepository;
  85. $this->resumeRepository = $resumeRepository;
  86. $this->jobfairJobRepository = $jobfairJobRepository;
  87. $this->companyService = $companyService;
  88. $this->jobfairPersonSignedService = $jobfairPersonSignedService;
  89. $this->jobfairPersonSignedRepository = $jobfairPersonSignedRepository;
  90. $this->jobfairPutJobService = $jobfairPutJobService;
  91. }
  92. /**近期招聘会
  93. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  94. */
  95. public function jobfairIndex(Request $request)
  96. {
  97. $user = auth('web-company')->user();
  98. $res = $this->jobfairService->jobfairIndex($user);
  99. $res['wap_title'] ="招聘会管理";
  100. return view('mobile.app.jobfair.company.index', $res);
  101. }
  102. /**定展记录
  103. * @param Request $request
  104. * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View
  105. * @throws \Throwable
  106. */
  107. public function jobfairEnact(Request $request)
  108. {
  109. $user = auth('web-company')->user();
  110. $res = $this->jobfairCompanyService->jobfairEnact($user);
  111. if ($request->ajax()) {
  112. if ($res['enactList']->currentPage() > $res['enactList']->lastPage()) {
  113. return response()->json(['status'=>0]);
  114. }
  115. return response()->json(['status'=>1, 'data'=>view('mobile.app.jobfair.ajax.ajax_enact_list', ['enactList' => $res['enactList']])->render()]);
  116. }
  117. $res['wap_title'] ="定展记录";
  118. return view('mobile.app.jobfair.company.jobfair_enact', $res);
  119. }
  120. /**招聘会职位库管理
  121. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  122. */
  123. public function jobfairJobsList(Request $request)
  124. {
  125. $res = $this->jobfairJobsService->jobfairJobsList();
  126. if ($request->ajax()) {
  127. if ($res['list']->currentPage() >$res['list']->lastPage()) {
  128. return response()->json(['status'=>0]);
  129. }
  130. return response()->json(['status'=>1,'data'=>view('mobile.app.jobfair.ajax.ajax_jobfair_jobs_list', $res)->render()]);
  131. }
  132. $res['wap_title'] ="招聘会职位";
  133. return view('mobile.app.jobfair.company.jobfair_jobs_list', $res);
  134. }
  135. /**招聘会职位添加
  136. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  137. */
  138. public function jobfairJobsAdd()
  139. {
  140. $res = $this->jobfairJobsService->jobfairJobsAdd();
  141. $res['wap_title'] ="发布招聘会职位";
  142. return view('mobile.app.jobfair.company.jobfair_jobs_add', $res);
  143. }
  144. /**招聘会职位修改
  145. * @param int $id
  146. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  147. */
  148. public function jobfairJobsEdit($id)
  149. {
  150. $user = auth('web-company')->user();
  151. $res = $this->jobfairJobsService->jobfairJobsEdit($id, $user);
  152. if (!$res) {
  153. return $this->showMessage('参数错误', route('mobile.firm.jobfair_jobs.list'), true, '上一页');
  154. }
  155. $res['wap_title'] ="编辑招聘会职位";
  156. return view('mobile.app.jobfair.company.jobfair_jobs_add', $res);
  157. }
  158. /**招聘会职位删除
  159. * @param Request $request
  160. * @return \Illuminate\Http\JsonResponse
  161. * @throws \Throwable
  162. */
  163. public function jobfairJobsDel(Request $request)
  164. {
  165. return $this->jobfairJobsService->jobfairJobsDel($request);
  166. }
  167. /**招聘会职位修改和添加
  168. * @param Request $request
  169. * @return \Illuminate\Http\JsonResponse
  170. */
  171. public function jobfairJobsSave(Request $request)
  172. {
  173. $user = auth('web-company')->user();
  174. $data = $request->except(['_method', '_token']);
  175. return $this->jobfairJobsService->jobsSaveMobile($data, $user);
  176. }
  177. /**职位添加到招聘会中
  178. * @param Request $request
  179. * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View
  180. * @throws \Throwable
  181. */
  182. public function jobfairJobsPutJobs(Request $request)
  183. {
  184. $user = auth('web-company')->user();
  185. if ($request->method() == 'POST') {
  186. $jids = $request->jobs_id;
  187. $this->jobfairJobsService->isOwn($jids,$user);
  188. $exidArr = explode(',', $request->exid);
  189. $this->jobfairCompanyService->isOwnArr($exidArr,$user);
  190. return $this->jobfairJobsService->jobfairJobsToJobfairMobile($request);
  191. }
  192. $exid = $request->id;
  193. $enact = $this->jobfairCompanyService->jobfairEnactfind($exid);
  194. $where = [
  195. 'audit'=>1,
  196. 'company_id'=>$user->id,
  197. 'type'=>1,
  198. ];
  199. $fairJobs = $this->jobfairJobRepository->getAuditJobList($where);
  200. $map = [
  201. 'exid' => $exid,
  202. ];
  203. $fairJob_ids = $this->jobfairPutJobRepository->getFairJobIds($map);
  204. $res['wap_title'] ="发布参展职位";
  205. $res = [
  206. 'wap_title'=>'发布参展职位',
  207. 'enact'=>$enact,
  208. 'fairJobs'=>$fairJobs,
  209. 'fairJob_ids'=>$fairJob_ids,
  210. ];
  211. return view('mobile.app.jobfair.company.jobfair_jobs_put_jobs', $res);
  212. }
  213. /**收到的招聘会简历
  214. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  215. */
  216. public function downResume()
  217. {
  218. $user = auth('web-company')->user();
  219. $result = $this->jobfairPersonalJobsApplyRepository->getResume($user->id);
  220. return view('app.jobfair.company.down_resume', ['result'=>$result]);
  221. }
  222. public function downResumeDel(Request $request)
  223. {
  224. if ($request->method() == 'POST') {
  225. $user = $this->getLoginUser();
  226. return $this->jobfairPersonalJopApplyService->downResumeDel($request,$user);
  227. }
  228. $tip = "被删除后将无法恢复,您确定要删除选中的简历吗?";
  229. return response()->json(['status'=>1,'data'=>['html'=>view('app.company.ajax.ajax_warning', ['tip'=>$tip])->render()]]);
  230. }
  231. /*
  232. * 前台页面
  233. * */
  234. /**招聘会列表
  235. * @param Request $request
  236. * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View
  237. * @throws \Throwable
  238. */
  239. public function index(Request $request)
  240. {
  241. $jobfairList = $this->jobfairService->index($request);
  242. if ($request->ajax()) {
  243. if ($jobfairList['allJobfair']->isNotEmpty()) {
  244. return response()->json(['status'=>1,'data'=>view('mobile.app.jobfair.ajax.ajax_jobfair_list', ['jobfairList'=>$jobfairList])->render()]);
  245. }
  246. return response()->json(['status'=>0]);
  247. }
  248. $jobfairList['wap_title'] = "招聘会列表";
  249. return view('mobile.app.jobfair.index', $jobfairList);
  250. }
  251. /**招聘会详情
  252. * @param int $id
  253. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  254. */
  255. public function jobfairShow($id = 0)
  256. {
  257. $user = auth('web-company')->user()?auth('web-company')->user():auth('web-member')->user();
  258. if (!$id) {
  259. return $this->showMessage('参数错误!', route('jobfair'), true, '上一页');
  260. }
  261. $res = $this->jobfairService->jobfairShow($id);
  262. if ($user && $user->utype == 1) {
  263. $res['show_booth'] = 1;
  264. } else {
  265. $res['show_booth'] = 0;
  266. }
  267. if (!$res['status']) {
  268. return $this->showMessage($res['msg'], route('jobfair'), true, '上一页');
  269. } else {
  270. if (array_has($res, 'jobfair')) {
  271. $this->putSeoData('jobfair', $res['jobfair']);
  272. }
  273. $res['jobfair']->sitename = Subsite::where('id',$res['jobfair']->subsite_id)->value('sitename');
  274. $res['wap_title'] = "招聘会详情";
  275. return view('mobile.app.jobfair.jobfair_show', $res);
  276. }
  277. }
  278. /**招聘会企业
  279. * @param Request $request
  280. * @param int $id
  281. * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View
  282. * @throws \Throwable
  283. */
  284. public function jobfairShowCom(Request $request, $id = 0)
  285. {
  286. if (!$id) {
  287. return $this->showMessage('参数错误!', route('jobfair'), true, '上一页');
  288. }
  289. $res = $this->jobfairService->jobfairShowCom($request, $id);
  290. if ($request->ajax()) {
  291. if ($res['jobfairCompany']->isNotEmpty()) {
  292. return response()->json(['status'=>1,'data'=>view('mobile.app.jobfair.ajax.ajax_jobfair_com', $res)->render()]);
  293. }
  294. return response()->json(['status'=>0]);
  295. }
  296. if (!$res['status']) {
  297. return $this->showMessage($res['msg'], route('jobfair'), true, '上一页');
  298. } else {
  299. $this->putSeoData('jobfair', $res['jobfair']);
  300. $res['wap_title'] = "招聘会企业";
  301. return view('mobile.app.jobfair.jobfair_com', $res);
  302. }
  303. }
  304. public function jobfairShowComDetail($uid, $jobfair_id, $position_id)
  305. {
  306. $jobfairCompany = $this->jobfairCompanyRepository->findCompany(['jobfair_companys.company_id'=>$uid,'jobfair_companys.jobfair_id'=>$jobfair_id,'jobfair_companys.position_id'=>$position_id,'jobfair_companys.audit'=>1], 0, 10);
  307. $jobfairCompany[0]->jobfair->predetermined_ok = 0;
  308. if ($jobfairCompany[0]->jobfair->predetermined_status == 1 && $jobfairCompany[0]->jobfair->predetermined_start && $jobfairCompany[0]->jobfair->predetermined_start < time() && $jobfairCompany[0]->jobfair->predetermined_end && $jobfairCompany[0]->jobfair->predetermined_end > time()) {
  309. $jobfairCompany[0]->jobfair->predetermined_ok = 1;
  310. }
  311. $jobfairCompany[0]->jobfairPutJob = $this->jobfairPutJobRepository->getJobfairJob($jobfairCompany[0]->id, $jobfair_id);
  312. $res = [
  313. 'jobfairCompany'=>$jobfairCompany[0],
  314. 'wap_title'=>'招聘会企业职位',
  315. ];
  316. return view('mobile.app.jobfair.jobfair_com_detail', $res);
  317. }
  318. /**招聘会职位详情
  319. * @param $jobfair_id
  320. * @param $job_id
  321. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  322. */
  323. public function jobfairShowJob($id)
  324. {
  325. $job = $this->jobfairService->jobfairShowJob($id);
  326. if (!$job['status']) {
  327. return $this->showMessage($job['msg'], route('jobfair'), true, '上一页');
  328. } else {
  329. $this->putSeoData('jobfair_job', $job['jobInfo']);
  330. $job['wap_title'] = "招聘会职位详情";
  331. return view('mobile.app.jobfair.jobfair_job', $job);
  332. }
  333. }
  334. public function jobfairAppointmentJobs(Request $request)
  335. {
  336. $user = $this->getLoginUser();
  337. if (!$user) {
  338. return response()->json(['status'=>3, 'type'=>1, 'html'=>view('app.common.ajax.per_login')->render(),'msg'=>'您还没有登录,请先登录再预约职位']);
  339. }
  340. if ($user->utype == 1) {
  341. return response()->json(['status'=>2,'type'=>3,'msg'=>'企业会员不允许预约职位!']);
  342. }
  343. $jid = $request->jobsfair_job_id;
  344. $jobfair_id = $request->jobfairid;
  345. $position_id = $request->position_id;
  346. $company_id = $request->company_id;
  347. $resume_id = $request->resume_id?$request->resume_id:0;
  348. $jobfair = $this->jobfairRepository->find($jobfair_id);
  349. if ($jobfair->isEmpty || $jobfair->holddate_end < time()) {
  350. return response()->json(['status'=>0, 'html'=>"招聘会已停止"]);
  351. }
  352. if ($resume_id) {
  353. if (!$jid || !$company_id || !$jobfair_id || !$position_id) {
  354. return response()->json(['status'=>2,'type'=>3,'msg'=>'参数错误!']);
  355. }
  356. $this->resumeService->isOwn($resume_id,$user);
  357. $this->jobfairPutJobService->isOwn($jid,$company_id);
  358. //错综复杂的关系
  359. $this->jobfairCompanyService->isPositionOwn($position_id,$jobfair_id,$company_id,$jid);
  360. $data['resume_id'] = $resume_id;
  361. $data['personal_uid'] = $user->id;
  362. $data['jobs_id'] = $jid;
  363. $data['company_id'] = $company_id;
  364. $data['jobfair_id'] = $jobfair_id;
  365. $data['position_id'] = $position_id;
  366. //简历完整度
  367. $res_complete = $this->resumeRepository->find($resume_id, ['complete_percent']);
  368. if ($res_complete->complete_percent < config('aix.personal_set.per_set.per_set.apply_job_min_percent')) {
  369. return response()->json(['status'=>0,'html'=>'请完善简历后再预约职位','resume_id'=>$resume_id]);
  370. }
  371. if ($this->jobfairPersonalJobsApplyRepository->findWhere(['resume_id'=>$resume_id, 'jobs_id'=>$jid, 'company_id'=>$company_id, 'jobfair_id'=>$jobfair_id, 'position_id'=>$position_id])->isNotEmpty()) {
  372. return response()->json(['status'=>0, 'html'=>"您已预约该职位,请勿重复预约!"]);
  373. }
  374. if ($this->jobfairPersonalJopApplyService->applyJob($data)) {
  375. return response()->json(['status'=>1, 'html'=>"职位预约成功!"]);
  376. }
  377. return response()->json(['status'=>0,'type'=>0 , 'html'=>"职位预约失败!"]);
  378. } else {
  379. if (!$jid || !$company_id || !$jobfair_id || !$position_id) {
  380. return response()->json(['status'=>2,'type'=>3,'msg'=>'参数错误!']);
  381. }
  382. $result = $this->jobfairPersonalJopApplyService->ifJobApply($user);
  383. if ($result['status'] == 2) { //返回结果,让用户选择简历投递
  384. $page_data = array('status'=>array_get($result, 'status'),'resumes'=>array_get($result, 'resumes'),'def_resume'=>array_get($result, 'def_resume'),'jobs_id'=>$jid);
  385. $page_data['company_id'] = $company_id;
  386. $page_data['jobfair_id'] = $jobfair_id;
  387. $page_data['position_id'] = $position_id;
  388. $page_data['jobs_id'] = $jid;
  389. $html = view('mobile.app.common.ajax.apply_resume', $page_data)->render();
  390. return response()->json(['status'=>2,'html'=>$html]);
  391. } elseif ($result['status'] == 3) { //直接投递
  392. $this->jobfairPutJobService->isOwn($jid,$company_id);
  393. //错综复杂的关系
  394. $this->jobfairCompanyService->isPositionOwn($position_id,$jobfair_id,$company_id,$jid);
  395. $resume = $result['resumes'][0];
  396. $data['resume_id'] = $resume->id;
  397. $data['personal_uid'] = $user->id;
  398. $data['jobs_id'] = $jid;
  399. $data['company_id'] = $company_id;
  400. $data['jobfair_id'] = $jobfair_id;
  401. $data['position_id'] = $position_id;
  402. $res_complete = $this->resumeRepository->find($resume->id, ['complete_percent']);
  403. if ($res_complete->complete_percent < config('aix.personal_set.per_set.per_set.apply_job_min_percent')) {
  404. return response()->json(['status'=>0,'html'=>'请完善简历后再预约职位','resume_id'=>$resume->id]);
  405. }
  406. if ($this->jobfairPersonalJobsApplyRepository->findWhere(['resume_id'=>$resume->id, 'jobs_id'=>$jid, 'company_id'=>$company_id, 'jobfair_id'=>$jobfair_id, 'position_id'=>$position_id])->isNotEmpty()) {
  407. return response()->json(['status'=>0, 'html'=>"您已预约该职位,请勿重复预约!"]);
  408. }
  409. if ($this->jobfairPersonalJopApplyService->applyJob($data)) {
  410. return response()->json(['status'=>1, 'html'=>"职位预约成功!"]);
  411. }
  412. return response()->json(['status'=>0,'type'=>0 , 'html'=>"职位预约失败!"]);
  413. }
  414. }
  415. }
  416. /**在线预定
  417. * @param $id
  418. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  419. */
  420. public function jobfairAppointment($id)
  421. {
  422. if (!$id) {
  423. return $this->showMessage('参数错误!', route('jobfair'), true, '上一页');
  424. }
  425. $res = $this->jobfairService->jobfairAppointment($id);
  426. if (!$res['status']) {
  427. return $this->showMessage($res['msg'], route('jobfair'), true, '上一页');
  428. } else {
  429. $this->putSeoData('jobfair', $res['jobfair']);
  430. return view('mobile.app.jobfair.jobfair_appointment', $res);
  431. }
  432. }
  433. public function personJobfair()
  434. {
  435. $resume = $this->resumeService->myResumeAjax(auth('web-member')->user());
  436. $jobApply = $this->jobfairPersonalJopApplyService->personJobfair();
  437. return view('app.jobfair.person.job_apply', ['resume' => $resume, 'interview' => $jobApply['interview']]);
  438. }
  439. public function jobfairAppointmentSave(Request $request)
  440. {
  441. $user = auth('web-company')->user()?auth('web-company')->user():auth('web-member')->user();
  442. if (!$user) {
  443. return response()->json(['status'=>0, 'type'=>1, 'html'=>view('app.common.ajax.com_login')->render(),'msg'=>'您还没有登录,请先登录再预约招聘会']);
  444. }
  445. if ($user->utype == 2) {
  446. return response()->json(['status'=>0,'type'=>0,'msg'=>'个人会员不允许预定招聘会!']);
  447. }
  448. //企业是否通过认证
  449. if ($user->audit!=1) {
  450. return response()->json(['status'=>0,'type'=>0,'msg'=>'企业或营业执照未通过审核!']);
  451. }
  452. $jobfair_id = $request->jobfair_id?$request->jobfair_id:0;
  453. $position_id = $request->position_id?$request->position_id:0;
  454. $floorplan_id = $request->floorplan_id?$request->floorplan_id:0;
  455. if (!$jobfair_id || !$jobfairInfo = $this->jobfairRepository->findOne(['id'=>$jobfair_id])) {
  456. return response()->json(['status'=>0,'msg'=>'查无此招聘会!']);
  457. }
  458. if (!$floorplan_id || !$floorplanInfo = $this->jobfairFloorPlanRepository->getOne($floorplan_id)) {
  459. return response()->json(['status'=>0,'msg'=>'查无此招聘会展位图!']);
  460. }
  461. if (!$position_id || !$positionInfo =$this->jobfairFloorplanStandRepository->getOne(['id'=>$position_id])) {
  462. return response()->json(['status'=>0,'msg'=>'查无此招聘会展位号!']);
  463. }
  464. if ($positionInfo->type == 2) {
  465. return response()->json(['status'=>0,'msg'=>'预留展位不可预定!']);
  466. }
  467. if ($jobfairInfo->more_stand == 0 && $this->jobfairCompanyRepository->findCom(['jobfair_id'=>$jobfair_id, 'company_id'=>$user->id,['audit','<>', 3]])) {
  468. return response()->json(['status'=>0,'msg'=>'本场招聘会不允许预定多个展位!']);
  469. }
  470. if($this->jobfairCompanyRepository->findCom(['jobfair_id'=>$jobfair_id, 'position_id'=>$position_id,['audit','<>', 3]])){
  471. return response()->json(['status'=>0,'msg'=>'该展位已被抢占,请重新刷新页面再预定']);
  472. }
  473. if ($request->method()=='POST') {
  474. return $this->jobfairService->jobfairAppointmentSave($jobfairInfo, $positionInfo, $user);
  475. }
  476. if ($jobfairInfo->is_commonweal == 3) {
  477. $msg = "本次招聘会为公益招聘会.<br><span style='color: red;'>请勿迟到,早退,违约不到场.</span><br>招聘会开始30分钟之后到场签到视为迟到,1小时之后还未到场视为违约,招聘会结束之前30分钟退出系统视为早退.<br>迟到早退三次,违约不到场一次,之后一个月内不能再次预定招聘会.<br>";
  478. } else {
  479. $msg ="<br><span style='color: red;'>请勿迟到,早退,违约不到场.</span><br>招聘会开始30分钟之后到场签到视为迟到,1小时之后还未到场视为违约,招聘会结束之前30分钟退出系统视为早退.<br>迟到早退三次,违约不到场一次,之后一个月内不能再次预定招聘会.<br />预定本场招聘会将消耗企业套餐招聘会<span style='color:#FC4C4E;'>".$jobfairInfo->jobsfair_num."次</span>或者企业<span style='color:#FC4C4E;'>积分".$jobfairInfo->predetermined_point."</span><br />";
  480. }
  481. return response()->json(['status'=>1,'msg'=>$msg]);
  482. }
  483. /**页面加载展位信息
  484. * @param Request $request
  485. * @return \Illuminate\Http\JsonResponse
  486. */
  487. public function ajaxGetData(Request $request)
  488. {
  489. $data = $request->all();
  490. return $this->jobfairService->ajaxGetData($data);
  491. }
  492. public function jobsCompanyShow(Request $request)
  493. {
  494. //获取企业信息
  495. $jobfair_id = $request->input('jobfair_id');
  496. $company_id = $request->input('company_id');
  497. $company_info = $this->companyService->getCompanyInfo(['id'=>$company_id]);
  498. $this->putSeoData('company', $company_info);
  499. //在招职位
  500. $put_jobs_where = array(
  501. array('company_id','=',$company_id),
  502. array('jobfair_id','=',$jobfair_id),
  503. );
  504. $jobs_where = array(
  505. array('audit','=',1),
  506. array('display','=',1)
  507. );
  508. $jobs = $this->jobfairPutJobRepository->getWhere($jobs_where,$put_jobs_where);
  509. $jobfair = $this->jobfairRepository->findOne(['id'=>$jobfair_id]);
  510. //看过该公司的人还看过(获取相同行业的企业)
  511. $company_where = array(
  512. 'trade' => $company_info->trade,
  513. 'except_id' =>$company_info->id
  514. );
  515. $other_companys = $this->companyService->getOtherCompanies($company_where, 5);
  516. $user = getUser();
  517. if ($user && $user->utype==2) {
  518. //获取当前时间段内申请过的职位
  519. $space_time = (integer)config('aix.personal_set.per_set.per_set.apply_job_space');
  520. if ($space_time>0) {
  521. $stime = date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-".$space_time." day"))));
  522. $apply_where = array(array('personal_uid','=',auth('web-member')->user()->id),array('created_at','>=',$stime));
  523. } else {
  524. $apply_where = array(array('personal_uid','=',auth('web-member')->user()->id));
  525. }
  526. $applys = $this->jobfairPersonalJopApplyService->getApplyJobs($apply_where);
  527. } else {
  528. $applys = array();
  529. }
  530. $return_data = array(
  531. 'info'=>$company_info,
  532. 'jobs'=>$jobs,
  533. 'jobfair' => $jobfair,
  534. 'applys' => $applys,
  535. 'other_companys'=>$other_companys,
  536. 'company_img' => $company_info->img,
  537. 'user'=>$user
  538. );
  539. return view('mobile.app.jobfair.company.comshow', $return_data);
  540. }
  541. //以下为微信H5招聘
  542. public function wechatCom(Request $request)
  543. {
  544. $jobfair_id = $request->input('jobfair_id');
  545. $company_id = $request->input('company_id');
  546. $loginUser = $this->getLoginUser();
  547. $company = $this->companyRepository->find($company_id);
  548. $put_jobs_where = array(
  549. array('company_id','=',$company_id),
  550. array('jobfair_id','=',$jobfair_id),
  551. );
  552. $jobs_where = array(
  553. array('audit','=',1),
  554. array('display','=',1)
  555. );
  556. $res['jobs'] = $this->jobfairPutJobRepository->getWhere($jobs_where,$put_jobs_where);
  557. $show_menu = 0;
  558. if ($loginUser) {
  559. if ($company->id == $loginUser->id && $company->utype == $loginUser->utype) {
  560. $show_menu = 1;
  561. }
  562. }
  563. $phone_error = '';
  564. $phone_error_tit = '';
  565. $phone_url = '';
  566. $phone_code = 0;
  567. $resume_error = '对不起,请登录后再投递简历';
  568. $resume_error_tit = '登录';
  569. $resume_url = route('mobile.login');
  570. $resume_code = 0;
  571. if ($loginUser && $loginUser->utype == 2) {
  572. $resume_error = '对不起,请登录后再投递简历';
  573. $resume_error_tit = '登录';
  574. $resume_url = route('mobile.jobs.apply');
  575. $resume_code = 1;
  576. }
  577. $resume = [];
  578. $res['show_menu'] = $show_menu;
  579. $res['praise'] = 0;
  580. if ($company->telephone_show ==1) {
  581. if (config('aix.companyset.comset.contact_set.showjobcontact') == 0) {
  582. $phone_error='企业未填写联系方式';
  583. $phone_error_tit='确定';
  584. $phone_url= '';
  585. $phone_code = 1;
  586. } else {
  587. if (!$loginUser) {
  588. $phone_error='对不起,请登录后继续查看企业联系方式';
  589. $phone_error_tit='登录';
  590. $phone_url= route('mobile.login');
  591. $phone_code = 0;
  592. } else {
  593. $phone_code = 1;
  594. }
  595. }
  596. } else {
  597. $phone_error='该企业不接受电话咨询,请直接投递简历';
  598. $phone_error_tit='投递';
  599. $phone_url = route('mobile.firm.com.wzp.send.resume', ['id'=>$company->id]);
  600. $phone_code = 0;
  601. }
  602. if ($loginUser && $loginUser->utype == 2) {
  603. $resume = $this->resumeRepository->findWhere(['uid'=>$loginUser->id]);
  604. }
  605. $res['phone_error'] = $phone_error;
  606. $res['phone_error_tit'] = $phone_error_tit;
  607. $res['phone_url'] = $phone_url;
  608. $res['phone_code'] = $phone_code;
  609. $res['resume_error'] = $resume_error;
  610. $res['resume_error_tit'] = $resume_error_tit;
  611. $res['resume_url'] = $resume_url;
  612. $res['resume_code'] = $resume_code;
  613. $res['resume'] = $resume;
  614. $res['user'] = $company;
  615. $res['loginUser'] = $loginUser;
  616. return view("mobile.app.jobfair.wzp.com", $res);
  617. }
  618. //是否有在开启的招聘会
  619. public function jobfairSceneOpen()
  620. {
  621. $user = getUser();
  622. $where = [
  623. ['holddate_start', '<', strtotime("+60 minute")],
  624. ['holddate_end', '>', time()],
  625. ['display', '=', 1],
  626. ['subsite_id', '=', get_subsite_id()],
  627. ];
  628. $compant_where = [
  629. 'company_id' => $user->id
  630. ];
  631. $allJobfair= $this->jobfairRepository->getCompanyOpenJobfair($where,$compant_where);
  632. $oneJobfair = $this->jobfairRepository->getOneCompanyOpenJobfair($where,$compant_where);
  633. if(count($allJobfair)>1){
  634. $html = view('mobile.app.person.jobfair.ajax_open_jabfair', ['allJobfair'=>$allJobfair,'oneJobfair'=>$oneJobfair])->render();
  635. $return_data = array('status'=>2, 'html' => $html);
  636. return response()->json($return_data);
  637. }elseif(count($allJobfair) == 1){
  638. $return_data = array('status'=>1,'jobfair_id'=>$allJobfair[0]->id);
  639. return response()->json($return_data);
  640. }else{
  641. $return_data = array('status'=>0,'error'=>'暂无举办中的招聘会');
  642. return response()->json($return_data);
  643. }
  644. }
  645. //现场招聘会
  646. public function jobfairScene(Request $request)
  647. {
  648. $jobfair_id = $request->jobfair_id ;
  649. $user = getUser();
  650. $jobfairScene = $this->jobfairCompanyService->oneJobfairCompany($user,$jobfair_id);
  651. $where = [
  652. 'jobfair_id'=>$jobfair_id,
  653. 'company_id'=>$user->id,
  654. ];
  655. $jobs_where = [
  656. 'display'=>1,
  657. 'audit'=>1
  658. ];
  659. $jobfairJob = $this->jobfairPutJobRepository->getJobfairCompanyJob($where,$jobs_where);
  660. $jobfairJobCount = $jobfairJob->count();
  661. //猜你喜欢 根据职位类别的中类和期望职位的中类匹配
  662. $fitResumeCount = 0;
  663. $category = array_pluck($jobfairJob->toArray(),'category');
  664. if($category){
  665. $fitResumeCount = $this->jobfairPersonSignedService->likeResumes($category,$jobfair_id)->count();
  666. }
  667. $where = [
  668. 'company_id'=>$user->id,
  669. 'jobfair_id'=>$jobfair_id,
  670. ];
  671. $interviewCount = $this->jobfairPersonalJobsApplyRepository->padApplyJobs($where)->count();
  672. $where = [
  673. 'company_id'=>$user->id,
  674. 'jobfair_id'=>$jobfair_id,
  675. 'is_apply'=>1,
  676. ];
  677. $yuyueCount = $this->jobfairPersonalJobsApplyRepository->applyJobs($where)->count();
  678. return view('mobile.app.jobfair.scene.index',[
  679. 'jobfair_id'=>$jobfair_id,
  680. 'jobfairScene'=>$jobfairScene,
  681. 'jobfairJobCount'=>$jobfairJobCount,
  682. 'interviewCount'=>$interviewCount,
  683. 'yuyueCount'=>$yuyueCount,
  684. 'fitResumeCount'=>$fitResumeCount,
  685. ]);
  686. }
  687. //招聘会职位
  688. public function jobfairSceneJobs(Request $request)
  689. {
  690. $jobfair_id = $request->jobfair_id ;
  691. $user = getUser();
  692. $where = [
  693. 'jobfair_id'=>$jobfair_id,
  694. 'company_id'=>$user->id,
  695. ];
  696. $jobs_where = [
  697. 'display'=>1,
  698. 'audit'=>1
  699. ];
  700. $jobfairJob = $this->jobfairPutJobRepository->getJobfairCompanyJob($where,$jobs_where);
  701. $jobfair_id = $request->jobfair_id ;
  702. $user = getUser();
  703. $jobfairCompany = $this->jobfairCompanyService->oneJobfairCompany($user,$jobfair_id);
  704. return view('mobile.app.jobfair.scene.jobfair_jobs',['jobfairJob'=>$jobfairJob,'jobfairCompany'=>$jobfairCompany]);
  705. }
  706. //推荐职位(猜你喜欢)
  707. public function jobfairSceneResumes(Request $request)
  708. {
  709. $jobfair_id = $request->jobfair_id ;
  710. $user = getUser();
  711. $where = [
  712. 'jobfair_id'=>$jobfair_id,
  713. 'company_id'=>$user->id,
  714. ];
  715. $jobs_where = [
  716. 'display'=>1,
  717. 'audit'=>1
  718. ];
  719. $jobfairJob = $this->jobfairPutJobRepository->getJobfairCompanyJob($where,$jobs_where);
  720. if($jobfairJob->isNotEmpty()) {
  721. $category = array_pluck($jobfairJob->toArray(),'category');
  722. $fitResume = $this->jobfairPersonSignedService->likeResumes($category,$jobfair_id);
  723. foreach ($fitResume as &$value)
  724. {
  725. $where['personal_uid'] = $value->uid;
  726. $value->status = $this->jobfairPersonalJopApplyService->isApply($where);
  727. }
  728. } else{
  729. //如果发布职位为空,等于空对象
  730. $fitResume = $jobfairJob;
  731. }
  732. $html = '';
  733. foreach ($jobfairJob as $val){
  734. $html .= "<label><input class='job' type='radio' name='job' value='".$val->id."' />&nbsp;".$val->jobs->jobs_name."</label>";
  735. }
  736. return view('mobile.app.jobfair.scene.fit_resume',['fitResume'=>$fitResume,'jobfair_id'=>$jobfair_id,'html'=>$html]);
  737. }
  738. public function jobfairScenePutJobsDel(Request $request)
  739. {
  740. $id = $request->id;
  741. if($this->jobfairPutJobRepository->delete($id)) {
  742. return response()->json(['status'=>1, 'msg'=>'招聘会职位删除成功!']);
  743. }else {
  744. return response()->json(['status'=>0, 'msg'=>'招聘会职位删除失败!']);
  745. }
  746. }
  747. public function jobfairSceneInterview(Request $request)
  748. {
  749. $jobfair_id = $request->jobfair_id ;
  750. $user = getUser();
  751. $where = [
  752. 'jobfair_id'=>$jobfair_id,
  753. 'company_id'=>$user->id,
  754. ];
  755. $interview = $this->jobfairPersonalJobsApplyRepository->padApplyJobs($where);
  756. return view('mobile.app.jobfair.scene.interview',['interview'=>$interview]);
  757. }
  758. public function jobfairSceneYuyue(Request $request)
  759. {
  760. $jobfair_id = $request->jobfair_id ;
  761. $user = getUser();
  762. $where = [
  763. 'jobfair_id'=>$jobfair_id,
  764. 'company_id'=>$user->id,
  765. 'is_apply'=>1,
  766. ];
  767. $yuyue = $this->jobfairPersonalJobsApplyRepository->applyJobs($where);
  768. return view('mobile.app.jobfair.scene.yuyue',['yuyue'=>$yuyue]);
  769. }
  770. public function jobfairSceneInvitation(Request $request)
  771. {
  772. $user = getUser();
  773. $data['resume_id'] = $request->input('resume_id');
  774. $data['personal_uid'] = $request->input('personal_uid');
  775. $data['jobs_id'] = $request->input('job_id');
  776. $this->jobfairPutJobService->isOwn($data['jobs_id'],$user->id);
  777. $data['company_id'] = $user->id;
  778. $data['is_apply'] = 2;
  779. $data['jobfair_id'] = $request->input('jobfair_id');
  780. $data['position_id'] = $this->jobfairCompanyRepository->getValue(['jobfair_id'=> $data['jobfair_id'],'company_id'=>$user->id],'position_id');
  781. $ret = $this->jobfairPersonalJobsApplyRepository->interviewAdd($data);
  782. if($ret) {
  783. return response()->json(array('status'=>1,'msg'=>'邀请成功!'));
  784. }else {
  785. return response()->json(array('status'=>0,'msg'=>'邀请失败!'));
  786. }
  787. }
  788. }