| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 | <?phpnamespace App\Http\Controllers\Mobile\Health;use App\Http\Controllers\Mobile\MobileBaseController;use App\Models\Jobs;use App\Models\JyyxAppoint;use App\Models\PostAppoint;use App\Models\QjwjAppoint;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.health.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;                }            }        }        $params['health_type'] = $request->input('health_type', 1);        //查询条件        $size  = 10;        $where = [            ['valid', '=', 1], //是否有效            ['audit', '=', 1], //审核通过            ['display', '=', 1], //是否显示            ['is_health', '=', 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']];        }        if (!empty($params['health_type'])) {            $where[] = ['health_type', '=', $params['health_type']];        }        $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.health.recruit.list', $return_data);    }    public function will()    {        return view('mobile.app.health.recruit.will');    }    public function willSave(Request $request)    {        $field = ['realname' => '姓名', 'sex' => '性别', 'mobile' => '联系方式', 'attachment' => '简历', 'remark' => '求职意向'];        $data  = $request->only(array_keys($field));        foreach ($field as $k => $v) {            if (empty($data[$k])) {                return response()->json(['status' => 0, 'msg' => $v . '不能为空']);            }        }        $check = JyyxAppoint::where('mobile', $data['mobile'])->first();        if (!empty($check)) {            return response()->json(['status' => 0, 'msg' => '您已提交过,请勿重复提交']);        }        JyyxAppoint::create($data);        return response()->json(['status' => 1]);    }    public function quanji()    {        $district = $this->categoryService->getDefaultDistrict();        return view('mobile.app.health.recruit.quanji', [            'defaultCity' => $district->defaultCity,        ]);    }    public function quanjiSave(Request $request)    {        $empty_check = [            'realname'     => '姓名',            'sex'          => '性别',            'mobile'       => '联系方式',            'birthday'     => '出生年份',            'native_place' => '籍贯',            'education'    => '学历',            'school'       => '毕业学校',            'pro_type'     => '专业',            'remark'       => '求职意向',        ];        $field       = array_merge($empty_check, [            'pro_text'   => '具体专业',            'title'      => '在校任职',            'attachment' => '简历',        ]);        $data        = $request->only(array_keys($field));        foreach ($empty_check as $k => $v) {            if (empty($data[$k])) {                return response()->json(['status' => 0, 'msg' => $v . '不能为空']);            }        }        $check = QjwjAppoint::where('mobile', $data['mobile'])->first();        if (!empty($check)) {            return response()->json(['status' => 0, 'msg' => '您已提交过,请勿重复提交']);        }        QjwjAppoint::create($data);        return response()->json(['status' => 1]);    }    public function show(Request $request)    {        $job_id  = $request->input('id');        $job_rst = $this->jobsService->getJobInfo(['id' => $job_id]);    //获取job信息//        dd($job_rst);        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.health.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.health.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 = PostAppoint::where('job_id', $data['job_id'])->where('mobile', $data['mobile'])->first();        if (!empty($check)) {            return response()->json(['status' => 0, 'msg' => '您已提交过,请勿重复提交']);        }        PostAppoint::create($data);        return response()->json(['status' => 1]);    }}
 |