12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace App\Http\Controllers\Mobile\Ic;
- use App\Http\Controllers\Mobile\MobileBaseController;
- use App\Models\Company;
- use App\Models\Jobs;
- use App\Repositories\CategoryRepository;
- use App\Services\Company\CompanyService;
- use App\Services\Company\JobsService;
- use Illuminate\Http\Request;
- class HospitalController extends MobileBaseController
- {
- protected $companyService;
- protected $jobsService;
- protected $categoryRepository;
- public function __construct(CompanyService $companyService, JobsService $jobsService, CategoryRepository $categoryRepository)
- {
- $this->companyService = $companyService;
- $this->jobsService = $jobsService;
- $this->categoryRepository = $categoryRepository;
- }
- public function index(Request $request)
- {
- $where = [
- ['is_ic', '=', 1],
- ];
- $list = Company::where($where)->get();
- $other_categories = $this->categoryRepository->getCategories();
- $tag_category = array_get($other_categories, 'AIX_jobtag');
- foreach ($list as $v) {
- $tag_arr = [];
- if (!empty($v->tag)) {
- foreach ($v->tag as $t) {
- $tag_arr[] = array_get($tag_category, $t);
- }
- }
- $v->tag_arr = $tag_arr;
- $v->job_count = Jobs::where([
- ['company_id', '=', $v->id],
- ['valid', '=', 1],
- ['display', '=', 1],
- ['audit', '=', '1'],
- ])->count();
- }
- return view('mobile.app.ic.hospital.index', ['list' => $list]);
- }
- public function show(Request $request)
- {
- //获取企业信息
- $company_id = $request->input('id');
- $company_info = $this->companyService->getCompanyInfo([['id', '=', $company_id]]);
- $this->putSeoData('company', $company_info);
- //在招职位
- $jobs_where = [
- ['company_id', '=', $company_info->id],
- ['valid', '=', 1],
- ['display', '=', 1],
- ];
- $jobs_display = config('aix.companyset.comset.show_set.jobs_display');
- if ($jobs_display == 1) {
- $jobs_where[] = ['audit', '=', '1'];
- } else {
- $jobs_where[] = ['audit', '<>', '3'];
- }
- $jobs = $this->jobsService->getOtherJobs($jobs_where);
- $return_data = [
- 'info' => $company_info,
- 'jobs' => $jobs,
- ];
- return view('mobile.app.ic.hospital.show', $return_data);
- }
- }
|