| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 | <?phpnamespace App\Http\Controllers\Mobile\Ic;use App\Http\Controllers\Mobile\MobileBaseController;use App\Models\Jobs;use App\Models\PostAppointIc;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],            ['valid', '=', 1],            ['audit', '=', 1],            ['display', '=', 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(['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 = [            'info' => $job_info,        ];        return view('mobile.app.ic.recruit.show', $return_data);    }    public function apply(Request $request)    {        $job_id  = $request->input('id');        $job_rst = $this->jobsService->getJobInfo(['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'];        $district = $this->categoryService->getDefaultDistrict();        return view('mobile.app.ic.recruit.apply', [            'defaultCity' => $district->defaultCity,            'info'        => $job_info,        ]);    }    public function applySave(Request $request)    {        $field = [            'realname'     => '姓名',            'sex'          => '性别',            'mobile'       => '联系方式',            'birthday'     => '出生年份',            'native_place' => '籍贯',            'education'    => '学历',            'attachment'   => '简历',            'remark'       => '求职意向',            'job_id'       => '岗位',            'company_id'   => '公司',        ];        $data  = $request->only(array_keys($field));        foreach ($field as $k => $v) {            if (empty($data[$k])) {                return response()->json(['status' => 0, 'msg' => $v . '不能为空']);            }        }        $check = PostAppointIc::where('job_id', $data['job_id'])->where('mobile', $data['mobile'])->first();        if (!empty($check)) {            return response()->json(['status' => 0, 'msg' => '您已提交过,请勿重复提交']);        }        PostAppointIc::create($data);        return response()->json(['status' => 1]);    }}
 |