jobsService = $jobsService; $this->categoryService = $categoryService; $this->companyService = $companyService; $this->memberSetmealRepository = $memberSetmealRepository; $this->setmealIncrementsService = $setmealIncrementsService; $this->refreshLogRepository = $refreshLogRepository; $this->memberPointRepository = $memberPointRepository; $this->setmealRepository = $setmealRepository; $this->queueAutoRefreshRepository = $queueAutoRefreshRepository; $this->serviceService = $serviceService; $this->subsiteService = $subsiteService; $this->jobsRepository = $jobsRepository; } /**管理职位 * @param Request $request * @param null $type * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View * @throws \Throwable */ public function jobsList(Request $request, $type = null) { $user = auth('web-company')->user(); $hasget = false; if ($type) { $hasget = true; } $jobs_list = $this->jobsService->list($type, $user); $jobs_total = $this->jobsService->jobsTotal($user->id); $company_setmeal = $this->memberSetmealRepository->getSetmealByUid($user->id, $user->utype);//会员套餐 $stick = $this->setmealIncrementsService->getCat('stick'); $emergency = $this->setmealIncrementsService->getCat('emergency'); if ($request->ajax()) { if ($jobs_list->currentPage() > $jobs_list->lastPage()) { return response()->json(['status' => 0]); } return response()->json(['status' => 1, 'data' => view('mobile.app.company.jobs.ajax.ajax_jobs_list', ['jobsList' => $jobs_list])->render()]); } return view('mobile.app.company.jobs.jobs_list', ['jobsList' => $jobs_list, 'type' => $type, 'hasget' => $hasget, 'jobsCount' => $jobs_total, 'companySetmeal' => $company_setmeal, 'stick' => $stick, 'emergency' => $emergency, 'wap_title' => "管理职位"]); } public function checkJobsNum() { $user = auth('web-company')->user(); //套餐可发布最大职位数 $mySetmeal = $this->memberSetmealRepository->getSetmealByUid($user->id, 1); //已发布职位数 $jobsCount = $this->jobsRepository->getJobCount(['company_id' => $user->id]); if ($mySetmeal->jobs_meanwhile <= 0) { return response()->json(['status' => 1]); } return response()->json(['status' => 0]); } /** * 职位添加 * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View * @throws \App\Exceptions\ResponseException */ public function jobsAdd($id = null) { $user = auth('web-company')->user(); $jobsExist = $this->jobsRepository->jobsTotal(['company_id' => $user->id, 'id' => $id]); if (empty($jobsExist) && !empty($id)) { return $this->showMessage('没有这个职位!', route('jobs.list'), true); } //查询该套餐可发布多少职位数及已发布多少职位 $jobs_total = $this->jobsService->jobsTotal($user->id); $company_setmeal = $this->memberSetmealRepository->getSetmealByUid($user->id, $user->utype);//会员套餐 $condition['company_id'] = $user->id; $condition['display'] = 1; $condition['valid'] = 1; $jobsCount = $this->jobsRepository->jobAuditTotal($condition, getJobsStatus());//开启的职位数量 $surplus_jobs = $company_setmeal->jobs_meanwhile - $jobsCount; $company_setmeal->jobs_meanwhile = $surplus_jobs > 0 ? $surplus_jobs : 0; //查询企业信息 $companyInfo = $this->companyService->getInfoById($user); //分站信息 $subsite = $this->subsiteService->getSubsite($user); $suArr = []; foreach ($subsite as $key => $val) { $suArr[] = $val['id'] . ',' . $val['sitename']; } $result = [ 'info' => $companyInfo, 'jobsCount' => $jobs_total, 'company_setmeal' => $company_setmeal, 'subsite' => $subsite, 'suArr' => $suArr, ]; if (isset($id) && $id) { if (!$result['jobsInfo'] = $this->jobsService->jobsInfo($id)) { return $this->showMessage('请确认职位是否存在!', route('mobile.firm.jobs.list'), true); } if ($result['jobsInfo']->subsites->isNotEmpty()) { $subsiteArr = $result['jobsInfo']->subsites->toArray(); if ($subsiteArr) { foreach ($subsiteArr as $key => $val) { $result['subarr'][] = $val['subsite_id']; } } else { $result['subarr'][] = []; } if ($result['subarr']) { foreach ($result['subarr'] as $key => $val) { if ($result['jobsInfo']->subsite_id == $val) { unset($result['subarr'][$key]); } } } } } $result['category'] = $this->categoryService->getCategory(); return view('mobile.app.company.jobs.jobs_add', $result); } /** * 职位保存 * @param JobsValidatorRequest $request * @return \Illuminate\Http\JsonResponse * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function jobsSave(JobsValidatorRequest $request) { $data = $request->except('_token', '_method'); $user = auth('web-company')->user(); $data['is_deformity'] = empty($data['is_deformity']) ? 2 : $data['is_deformity']; return $this->jobsService->jobsSaveMobile($data, $user); } /** * @param Request $request * @return \Illuminate\Http\JsonResponse * @throws \Throwable */ public function jobsAddToJobfair(Request $request) { if ($request->method() == 'POST') { $user = $this->getLoginUser(); return $this->jobsService->jobsAddToJobfair($request, $user); } $tip = '您确定要将该职位加入招聘会职位库吗?'; return response()->json(['status' => 1, 'msg' => '', 'data' => ['html' => view('app.company.ajax.ajax_warning', ['tip' => $tip])->render()]]); } /**职位刷新 * @param Request $request * @return \Illuminate\Http\JsonResponse * @throws \App\Exceptions\ResponseException * @throws \Throwable */ public function jobsRefresh(Request $request) { $user = auth('web-company')->user(); $id = $request->id; if (!$id) { return response()->json(['status' => 0, 'msg' => "请选择刷新职位!"]); } $jobsInfo = $this->jobsRepository->find($id); if ($jobsInfo->audit == 3) { return response()->json(['status' => 0, 'msg' => "审核未通过职位不可刷新!"]); } elseif ($jobsInfo->audit == 2 && config('aix.companyset.comset.show_set.jobs_display') == 1) { return response()->json(['status' => 0, 'msg' => "审核中职位不可刷新!"]); } elseif ($jobsInfo->display == 2 || $jobsInfo->valid == 0) { return response()->json(['status' => 0, 'msg' => "已关闭职位不可刷新!"]); } $where = [ 'uid' => $user->id, 'utype' => 1, 'type' => 1006, 'mode' => 2, ]; // //刷新间隔时间 // $refrestime = $this->refreshLogRepository->getLastRefreshDate($where); // $duringtime = time() - strtotime($refrestime?$refrestime->created_at:0); $space = config('aix.companyset.comset.other_set.refresh_jobs_space') * 60; // if ($space > 0 && $duringtime <= $space) { // return response()->json(['status' => 0, 'msg' => $space . "秒内不能重复刷新职位",]); // } //有无开通刷新服务 $mySetmeal = $this->memberSetmealRepository->getSetmealByUid($user->id, $user->utype); $myPoints = $this->memberPointRepository->getPointsOne(auth('web-company')->user()->id, 1); if (!$mySetmeal) { return response()->json(['status' => 0, 'msg' => '您还没有开通服务,请>',]); } //服务是否到期 if ($mySetmeal->expire == 1 && $mySetmeal->setmeal_id > 1) { return response()->json(['status' => 0, 'msg' => '您的服务已经到期,请',]); } $discount = $this->setmealRepository->getMaxDiscount('auto_refresh_jobs'); //计算免费刷新次数 $todayCount = $this->refreshLogRepository->getTodayRefreshTimes($where); if ($todayCount >= ($mySetmeal->refresh_jobs_free + config('aix.companyset.comsume.comsume_set.refresh_jobs_more'))) {//免费刷新次数已到 if ($myPoints->points >= (config('aix.companyset.comsume.comsume_set.refresh_jobs_price') * config('aix.companyset.points.points_set.payment_rate'))) { $tip = '