| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 | <?phpnamespace App\Http\Controllers\Mobile\Ic;use App\Http\Controllers\Mobile\MobileBaseController;use App\Models\Jobs;use App\Services\Common\CategoryService;use App\Services\Company\JobsService;use Illuminate\Http\Request;class RecruitController extends MobileBaseController{    protected $categoryService;    protected $jobsService;    /**     * JobsController constructor.     * @param $categoryService     */    public function __construct(CategoryService $categoryService, JobsService $jobsService)    {        $this->categoryService = $categoryService;        $this->jobsService     = $jobsService;    }    public function index()    {        return view('mobile.app.ic.recruit.index');    }    public function list(Request $request)    {        //获取分类        $filter_where   = [            'AIX_education'  => 100,            'AIX_experience' => 100,            'AIX_wage'       => 100,        ];        $categories     = $this->categoryService->getCategories($filter_where);     //过滤条件信息        //默认参数        $param_array = ['keyword', 'wage', 'experience','education'];        $params      = [];        if ($request->all()) {            foreach ($request->all() as $k => $v) {                if (in_array($k, $param_array) && $v) {                    $params[$k] = $v;                }            }        }        //查询条件        $size    = 10;        $where   = [            ['is_ic', '=', 1],        ];        if (!empty($params['keyword'])) {            $where[] = ['jobs_name', 'like', '%' . $params['keyword'] . '%'];        }        if (!empty($params['wage'])) {            $where[] = ['wage', '=', $params['wage']];        }        if (!empty($params['experience'])) {            $where[] = ['experience', '=', $params['experience']];        }        if (!empty($params['education'])) {            $where[] = ['education', '=', $params['education']];        }        $list = Jobs::where($where)->orderBy('updated_at', 'desc')->paginate($size);        if ($list->total() > 0) {            $list_items = $this->jobsService->dealjobFilelds($list->items());        } else {            $list_items = [];        }        $mobile_dropload = false;        if ($list->total() > $size) {            $mobile_dropload = true;        }        if ($request->ajax()) {            if ($list->lastPage() < $list->currentPage()) {                return response()->json(['status' => 0]);            }            return response()->json(['status' => 1, 'data' => view('mobile.app.content.jobs.ajax_job_list', ['params' => $params, 'list_items' => $list_items])->render()]);        }        $return_data = [            'categories'      => $categories,            'list'            => $list,            'list_items'      => $list_items,            'params'          => $params,            'mobile_dropload' => $mobile_dropload,            'current_url'     => \Illuminate\Support\Facades\Request::getRequestUri(),        ];        return view('mobile.app.ic.recruit.list', $return_data);    }    public function will()    {        return view('mobile.app.ic.recruit.will');    }    public function quanji()    {        return view('mobile.app.ic.recruit.quanji');    }    public function show(Request $request)    {        $job_id = $request->input('id');        $job_rst = $this->jobsService->getJobInfo(array('id'=>$job_id));    //获取job信息        if ($job_rst['status'] == 0) {            $back_url = \Illuminate\Support\Facades\URL::previous();            return $this->showMessage($job_rst['error'], $back_url, true, '上一页', '3');        }        $job_info = $job_rst['job'];        $return_data = array(            'info'             => $job_info,        );        return view('mobile.app.ic.recruit.show',$return_data);    }    public function apply()    {        $district = $this->categoryService->getDefaultDistrict();        return view('mobile.app.ic.recruit.apply', [            'defaultCity' => $district->defaultCity,        ]);    }}
 |