| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909 | <?php/** * Created by PhpStorm. * User: wuzhenke * Date: 2019/1/17 * Time: 16:19 */namespace App\Http\Controllers\Web\Active;use App\Exceptions\ResponseException;use App\Http\Controllers\Web\WebBaseController;use App\Models\LotteryPrize;use App\Models\LotteryWin;use App\Services\Common\CategoryService;use App\Services\Common\SearchService;use App\Services\Company\JobsService;use App\Services\HomeService;use Illuminate\Http\Request;use App\Services\Company\CompanyService;use Illuminate\Support\Facades\Cache;use Illuminate\Support\Facades\DB;class JobfairController extends WebBaseController{    protected $companyService;    protected $jobsService;    protected $categoryService;    protected $searchService;    protected $homeService;    /*     * 企业中心     * */    /**     * JobfairController constructor.     * @param $jobfairJobsService     * @param $jobfairCompanyRepository     * @param $jobfairCompanyService     * @param $jobfairService     * @param $jobfairRepository     * @param $jobfairPersonalJobsApplyRepository     * @param $jobfairPersonalJopApplyService     * @param $resumeService     * @param $jobfairFloorplanStandRepository     * @param $jobfairFloorPlanRepository     * @param $jobfairPutJobRepository     * @param $resumeRepository     * @param $jobfairPutJobService     * @param $companyService     * @param $jobfairJobRepository     * @param $companyDownResumeService     * @param $articleService     * @param $articleRepository     */    public function __construct(        CompanyService $companyService,        JobsService $jobsService,        CategoryService $categoryService,        SearchService $searchService,        HomeService $homeService    )    {        $this->companyService  = $companyService;        $this->jobsService     = $jobsService;        $this->categoryService = $categoryService;        $this->searchService   = $searchService;        $this->homeService     = $homeService;    }    /**2020新春线上招聘会     * @param Request $request     * @param int $id     * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View     * @throws \Throwable     */    public function online2020(Request $request)    {        $offset = isset($request->page) ? $request->page : 0;        $limit  = 20;        $citycategory = $request->input('citycategory');        $trade        = $request->input('trade');        $param_array  = ['citycategory', 'trade', 'nature'];        $params = [];        if ($request->all()) {            foreach ($request->all() as $k => $v) {                if (in_array($k, $param_array) && $v) {                    $params[$k] = $v;                }            }        }        $subsites = Cache::get('subsites_list');        if ($subsites) {            if (!array_has($params, 'citycategory')) {                if (get_subsite_id() > 0) {                    $citycategory = $subsites[get_subsite_id()]['district'];                }            }            $is_subsite = 1;        }        $citys = $this->categoryService->getCitys($citycategory);        if (empty($citycategory)) {            $district_str = "(district like ? or district like ? or district like ? or district like ?)";            $district_arr = ["%.623%", "%623.%", "%.245%", "%245.%"];        } else {            $select_id    = $citys['select']['id'];            $district_str = "(district like ? or district like ?)";            $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];        }        $companys = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw("jobs.created_at > '2020-01-01 00:00:00'")->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();//        echo '<pre>';////        var_dump($companys);die;        $where = [];        //$where[] = array('reg_time', '>', 1577808000);        $where[] = ['user_status', '=', 1];        $where[] = ['subsite_id', '=', get_subsite_id()];        $where[] = ['audit', '=', 1];        $where[] = ['deleted_at', '=', null];        if (!empty($trade)) {            $where[] = ['trade', '=', $trade];        }        //$where[] = array('id','in',$companys);        $order_by = ['id', 'desc'];        //$list = $this->searchService->search('Company', $where, $order_by, '');        $list         = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->orderBy('id', 'desc')->offset($limit * $offset)->limit($limit)->get();        $total        = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->count();        $total_person = DB::table('resumes')->whereRaw('created_at > "2019-12-01 00:00:00"')->groupBy('uid')->get();        //$list = DB::table('companys')->where($where)->whereIn('id',$companys)->orderBy('id','desc')->offset($limit*$offset)->limit($limit)->get();//        echo '<pre>';////        var_dump($list);die;        $more = count($list) >= $limit ? true : false;//        if ($list->total() >0) {//            //处理企业信息//            $list_items = $this->companyService->dealCompanyFields($list->items());//        } else {//            $list_items = array();//        }        $res           = [];        $total_job     = 0;        $total_job_num = 0;        foreach ($list as $val) {            $item = [                'id'          => $val->id,                'companyname' => $val->companyname,                'jobs'        => [],            ];            //在招职位            $jobs_where = [                ['company_id', '=', $val->id],                ['valid', '=', 1],                ['display', '=', 1],                ['audit', '=', 1],            ];            //$jobs = $this->jobsService->getOtherJobs($jobs_where);            $jobs = DB::table('jobs')->where($jobs_where)->get();            if ($jobs) {                foreach ($jobs as $value) {                    $job = [                        'id'        => $value->id,                        'jobs_name' => $value->jobs_name,                        'amount'    => $value->amount,                    ];                    array_push($item['jobs'], $job);                    $total_job_num += $value->amount;                    $total_job     += 1;                }            }            array_push($res, $item);        }        $filter_where = [            'AIX_trade'        => 100,            'AIX_company_type' => 100,        ];        $categories   = $this->categoryService->getCategories($filter_where);        if ($request->ajax()) {            if (count($res)) {                return response()->json(['status' => 1, 'data' => view('app.active.ajax.ajax_jobfair_com', [                    'res'        => $res,                    'city'       => $citys,                    'params'     => $params,                    'categories' => $categories,                    'more'       => $more,                ])->render()]);            }            return response()->json(['status' => 0]);        }        return view('app.active.online2020', [            'res'          => $res,            'city'         => $citys,            'params'       => $params,            'categories'   => $categories,            'more'         => $more,            'total'        => $total,            'total_person' => count($total_person),            'total_job'    => $total_job            //'list_items'    => $list_items,            //'list'          => $list,        ]);    }    public function test(Request $request)    {        $companys     = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw("jobs.created_at > '2020-01-01 00:00:00'")->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();        $where        = [];        $where[]      = ['user_status', '=', 1];        $where[]      = ['subsite_id', '=', get_subsite_id()];        $where[]      = ['audit', '=', 1];        $where[]      = ['deleted_at', '=', null];        $order_by     = ['id', 'desc'];        $citycategory = $request->input('citycategory');        $citys        = $this->categoryService->getCitys($citycategory);        if (empty($citycategory)) {            $district_str = "(district like ? or district like ? or district like ? or district like ?)";            $district_arr = ["%.623%", "%623.%", "%.245%", "%245.%"];        } else {            $select_id    = $citys['select']['id'];            $district_str = "(district like ? or district like ?)";            $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];        }        //$list = DB::table('companys')->where($where)->whereRaw("(district like ? or district like ? or district like ? or district like ?)",["%.{$citys['select']['id']}%","%{$citys['select']['id']}.%","%.245%","%245.%"])->whereIn('id',$companys)->limit(1000)->orderBy('id','desc')->get();        $list         = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->orderBy('id', 'desc')->get();        $total        = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->count();        $total_person = DB::table('resumes')->whereRaw('created_at > "2019-12-01 00:00:00"')->groupBy('uid')->get();        $res           = [];        $total_job     = 0;        $total_job_num = 0;        foreach ($list as $val) {            $item = [                'id'          => $val->id,                'companyname' => $val->companyname,                'jobs'        => [],            ];            //在招职位            $jobs_where = [                ['company_id', '=', $val->id],                ['valid', '=', 1],                ['display', '=', 1],                ['audit', '=', 1],            ];            //$jobs = $this->jobsService->getOtherJobs($jobs_where);            $jobs = DB::table('jobs')->where($jobs_where)->get();            if ($jobs) {                foreach ($jobs as $value) {                    $job = [                        'id'        => $value->id,                        'jobs_name' => $value->jobs_name,                        'amount'    => $value->amount,                    ];                    array_push($item['jobs'], $job);                    $total_job_num += $value->amount;                    $total_job     += 1;                }            }            array_push($res, $item);        }        echo "<p>企业数量:" . count($list) . "</p>\r\n";        echo "<p>求职者数量:" . count($total_person) . "</p>\r\n";        echo "<p>总招聘职位数量:" . $total_job . "</p>\r\n";        echo "<p>总需要人员数量:" . $total_job_num . "</p>\r\n";    }    public function data(Request $request)    {        $companys     = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw("jobs.created_at > '2020-01-01 00:00:00'")->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();        $where        = [];        $where[]      = ['user_status', '=', 1];        $where[]      = ['subsite_id', '=', get_subsite_id()];        $where[]      = ['audit', '=', 1];        $where[]      = ['deleted_at', '=', null];        $order_by     = ['id', 'desc'];        $citycategory = $request->input('citycategory');        $citys        = $this->categoryService->getCitys($citycategory);        if (empty($citycategory)) {            $citys['select']['id'] = 623;        }        $list          = DB::table('companys')->where($where)->whereRaw("(district like ? or district like ? or district like ? or district like ?)", ["%.{$citys['select']['id']}%", "%{$citys['select']['id']}.%", "%.245%", "%245.%"])->whereIn('id', $companys)->limit(1000)->orderBy('id', 'desc')->get();        $total_person  = DB::table('resumes')->whereRaw('created_at > "2019-12-01 00:00:00"')->groupBy('uid')->get();        $total_job     = 0;        $total_job_num = 0;        foreach ($list as $val) {            $item = [                'id'          => $val->id,                'companyname' => $val->companyname,                'jobs'        => [],            ];            //在招职位            $jobs_where = [                ['company_id', '=', $val->id],                ['valid', '=', 1],                ['display', '=', 1],                ['audit', '=', 1],            ];            //$jobs = $this->jobsService->getOtherJobs($jobs_where);            $jobs = DB::table('jobs')->where($jobs_where)->get();            if ($jobs) {                foreach ($jobs as $value) {                    $total_job_num += $value->amount;                    $total_job     += 1;                }            }        }        $org          = DB::table('organization')->whereRaw('id>=10')->get();        $service      = DB::table('service')->whereRaw('service_type = 3')->get();        $total_number = 0;        foreach ($service as $k => $v) {            $detail       = unserialize($v->detail);            $total_number += intval($detail[0]['number']);        }        $res = [            'total_enterprise' => count($list),            'total_job'        => $total_job,            'total_person'     => count($total_person),            'total_number'     => $total_number,            'total_org'        => count($org),        ];        echo json_encode($res);    }    /**新春线上招聘会     * @param Request $request     * @param int $id     * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View     * @throws \Throwable     */    public function spring(Request $request)    {        $offset = isset($request->page) ? $request->page : 0;        $limit  = 18;        $citycategory = $request->input('citycategory');        $trade        = $request->input('trade');        $param_array  = ['citycategory', 'trade', 'nature'];        $params = [];        if ($request->all()) {            foreach ($request->all() as $k => $v) {                if (in_array($k, $param_array) && $v) {                    $params[$k] = $v;                }            }        }        $subsites = Cache::get('subsites_list');        if ($subsites) {            if (!array_has($params, 'citycategory')) {                if (get_subsite_id() > 0) {                    $citycategory = $subsites[get_subsite_id()]['district'];                }            }        }        $citys = $this->categoryService->getCitys($citycategory);        if (empty($citycategory)) {            $district_str = "(district like ? or district like ? or district like ? or district like ?)";            $district_arr = ["%.623%", "%623.%", "%.245%", "%245.%"];        } else {            $select_id    = $citys['select']['id'];            $district_str = "(district like ? or district like ?)";            $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];        }        $whereRaw = "jobs.updated_at > '2024-01-01 00:00:00' and jobs.deleted_at is null and jobs.valid = 1 and jobs.audit = 1 and jobs.display = 1";        $companys = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw($whereRaw)->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();        $where   = [];        $where[] = ['user_status', '=', 1];        $where[] = ['audit', '=', 1];        $where[] = ['deleted_at', '=', null];        if (!empty($trade)) {            $where[] = ['trade', '=', $trade];        }        $list         = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->orderBy('sort_index', 'desc')->orderBy('id', 'desc')->offset($limit * $offset)->limit($limit)->get();        $total        = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->count();        $total_person = DB::table('resumes')->whereRaw('created_at > "2019-12-01 00:00:00"')->groupBy('uid')->get();        $more = count($list) >= $limit ? true : false;        $res           = [];        $total_job     = 0;        $total_job_num = 0;        foreach ($list as $val) {            $item = [                'id'          => $val->id,                'companyname' => $val->companyname,                'jobs'        => [],                'tag_arr'     => [],            ];            //在招职位            $jobs_where = [                ['company_id', '=', $val->id],                ['valid', '=', 1],                ['display', '=', 1],                ['audit', '=', 1],                ['deleted_at', '=', null],            ];            $jobs = DB::table('jobs')->where($jobs_where)->get();            if ($jobs) {                foreach ($jobs as $value) {                    $job = [                        'id'        => $value->id,                        'jobs_name' => $value->jobs_name,                        'amount'    => $value->amount,                        'wage'      => $value->wage,                        'wage_min'  => $value->wage_min,                        'wage_max'  => $value->wage_max,                    ];                    array_push($item['jobs'], $job);                    $total_job_num += $value->amount;                    $total_job     += 1;                }            }            //企业福利            if (!empty($val->tag)) {                $tags            = explode(',', $val->tag);                $tag_arr         = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();                $item['tag_arr'] = $tag_arr;            }            array_push($res, $item);        }        $filter_where = [            'AIX_trade'        => 100,            'AIX_company_type' => 100,        ];        $categories   = $this->categoryService->getCategories($filter_where);        if ($request->ajax()) {            if (count($res)) {                return response()->json(['status' => 1, 'data' => view('app.active.ajax.ajax_spring_special_com', [                    'res'        => $res,                    'city'       => $citys,                    'params'     => $params,                    'categories' => $categories,                    'more'       => $more,                ])->render()]);            }            return response()->json(['status' => 0]);        }        return view('app.active.spring', [            'res'          => $res,            'city'         => $citys,            'params'       => $params,            'categories'   => $categories,            'more'         => $more,            'total'        => $total,            'total_person' => count($total_person),            'total_job'    => $total_job,        ]);    }    /**     * 智能招聘长廊     */    public function ai_recruit(Request $request)    {        $citycategory = 'jjkfq';        $whereRaw     = "jobs.updated_at > '2024-01-01 00:00:00' and jobs.deleted_at is null and jobs.valid = 1 and jobs.audit = 1 and jobs.display = 1";        $companys     = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw($whereRaw)->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();        $citys        = $this->categoryService->getCitys($citycategory);        $select_id    = $citys['select']['id'];        $district_str = "(district like ? or district like ?)";        $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];        $where   = [];        $where[] = ['user_status', '=', 1];        $where[] = ['audit', '=', 1];        $where[] = ['deleted_at', '=', null];        if (!empty($trade)) {            $where[] = ['trade', '=', $trade];        }        $list = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->orderBy('sort_index', 'desc')->orderBy('id', 'desc')->get();        $res = [];        foreach ($list as $val) {            $item = [                'id'           => $val->id,                'companyname'  => $val->companyname,                'landline_tel' => $val->landline_tel,                'mobile'       => $val->mobile,                'reg_address'  => $val->reg_address,                'jobs'         => [],                'tag_arr'      => [],            ];            //在招职位            $jobs_where = [                ['company_id', '=', $val->id],                ['valid', '=', 1],                ['display', '=', 1],                ['audit', '=', 1],                ['deleted_at', '=', null],            ];            $jobs = DB::table('jobs')->where($jobs_where)->get();            if (!$jobs->isEmpty()) {                foreach ($jobs as $value) {                    $job = [                        'id'        => $value->id,                        'jobs_name' => $value->jobs_name,                        'amount'    => $value->amount,                        'wage'      => $value->wage,                        'wage_min'  => $value->wage_min,                        'wage_max'  => $value->wage_max,                        'wage_str'  => $value->wage_str,                    ];                    array_push($item['jobs'], $job);                }            }            //企业福利            if (!empty($val->tag)) {                $tags            = explode(',', $val->tag);                $tag_arr         = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();                $item['tag_arr'] = $tag_arr;            }            array_push($res, $item);        }        $res = $this->_split_arr($res, 4);        return view('app.active.ai_recruit', ['res' => $res]);    }    private function _split_arr($arr, $num)    {        $res  = [];        $item = [];        foreach ($arr as $k => $v) {            if ($k % $num == 0 && $k != 0) {                $res[] = $item;                $item  = [];            }            $item[] = $v;        }        if (!empty($item)) {            $res[] = $item;        }        return $res;    }    /**新春线上招聘会经济开发区     */    public function spring_jkq(Request $request)    {        if (!$request->ajax()) {            //奖品列表            $prize = LotteryPrize::all();        }        $offset = isset($request->page) ? $request->page : 0;        $limit  = 18;        $citycategory = 'jjkfq';        $whereRaw     = "jobs.updated_at > '2024-01-01 00:00:00' and jobs.deleted_at is null and jobs.valid = 1 and jobs.audit = 1 and jobs.display = 1";        $companys     = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw($whereRaw)->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();        $citys        = $this->categoryService->getCitys($citycategory);        $select_id    = $citys['select']['id'];        $district_str = "(district like ? or district like ?)";        $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];        $where   = [];        $where[] = ['user_status', '=', 1];        $where[] = ['audit', '=', 1];        $where[] = ['deleted_at', '=', null];        $list = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->orderBy('sort_index', 'desc')->orderBy('id', 'desc')->offset($limit * $offset)->limit($limit)->get();        $more = count($list) >= $limit ? true : false;        $res = [];        foreach ($list as $val) {            $item = [                'id'          => $val->id,                'companyname' => $val->companyname,                'jobs'        => [],                'tag_arr'     => [],            ];            //在招职位            $jobs_where = [                ['company_id', '=', $val->id],                ['valid', '=', 1],                ['display', '=', 1],                ['audit', '=', 1],                ['deleted_at', '=', null],            ];            $jobs = DB::table('jobs')->where($jobs_where)->get();            if (!$jobs->isEmpty()) {                foreach ($jobs as $value) {                    $job = [                        'id'        => $value->id,                        'jobs_name' => $value->jobs_name,                        'amount'    => $value->amount,                        'wage'      => $value->wage,                        'wage_min'  => $value->wage_min,                        'wage_max'  => $value->wage_max,                        'wage_str'  => $value->wage_str,                    ];                    array_push($item['jobs'], $job);                }            }            //企业福利            if (!empty($val->tag)) {                $tags            = explode(',', $val->tag);                $tag_arr         = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();                $item['tag_arr'] = $tag_arr;            }            array_push($res, $item);        }        if ($request->ajax()) {            if (count($res)) {                return response()->json(['status' => 1, 'data' => view('app.active.ajax.ajax_spring_special_com', [                    'res'  => $res,                    'city' => $citys,                    'more' => $more,                ])->render()]);            }            return response()->json(['status' => 0]);        }        return view('app.active.spring_jkq', [            'params'    => ['citycategory' => 'jjkfq'],            'prize'     => $prize,            'res'       => $res,            'more'      => $more,            'live_list' => $this->homeService->getSpringLive(),        ]);    }    /**新春线上招聘会经济开发区     */    public function spring_main()    {        //奖品列表        $prize = LotteryPrize::all();        return view('app.active.spring_main', [            'prize'     => $prize,            'live_list' => $this->homeService->getSpringLive(),        ]);    }    /**     * 海灵线上招聘会     */    public function online_recruit(Request $request)    {        $offset = isset($request->page) ? $request->page : 0;        $limit  = 18;        $trade       = $request->input('trade');        $param_array = ['trade', 'nature'];        $params      = [];        if ($request->all()) {            foreach ($request->all() as $k => $v) {                if (in_array($k, $param_array) && $v) {                    $params[$k] = $v;                }            }        }        $params['citycategory'] = 'jjkfq';        $citycategory = 'jjkfq';        $whereRaw     = "jobs.updated_at > '2022-06-01 00:00:00' and jobs.deleted_at is null and jobs.valid = 1 and jobs.audit = 1 and jobs.display = 1 and education > 68";        $companys     = DB::table('jobs')->join('companys', 'jobs.company_id', '=', 'companys.id')->whereRaw($whereRaw)->groupBy('jobs.company_id')->select('jobs.company_id')->pluck('company_id')->toArray();        $citys        = $this->categoryService->getCitys($citycategory);        $select_id    = $citys['select']['id'];        $district_str = "(district like ? or district like ?)";        $district_arr = ["%.{$select_id}%", "%{$select_id}.%"];        $where   = [];        $where[] = ['user_status', '=', 1];        $where[] = ['audit', '=', 1];        $where[] = ['deleted_at', '=', null];        if (!empty($trade)) {            $where[] = ['trade', '=', $trade];        }        $list = DB::table('companys')->where($where)->whereRaw($district_str, $district_arr)->whereIn('id', $companys)->orderBy('sort_index', 'desc')->orderBy('id', 'desc')->offset($limit * $offset)->limit($limit)->get();        $more = count($list) >= $limit ? true : false;        $res = [];        foreach ($list as $val) {            $item = [                'id'          => $val->id,                'companyname' => $val->companyname,                'jobs'        => [],                'tag_arr'     => [],            ];            //在招职位            $jobs_where = [                ['company_id', '=', $val->id],                ['valid', '=', 1],                ['display', '=', 1],                ['audit', '=', 1],                ['deleted_at', '=', null],                ['education', '>', 68],            ];            $jobs = DB::table('jobs')->where($jobs_where)->get();            if (!$jobs->isEmpty()) {                foreach ($jobs as $value) {                    $job = [                        'id'        => $value->id,                        'jobs_name' => $value->jobs_name,                        'amount'    => $value->amount,                        'wage'      => $value->wage,                        'wage_min'  => $value->wage_min,                        'wage_max'  => $value->wage_max,                        'wage_str'  => $value->wage_str,                    ];                    array_push($item['jobs'], $job);                }            }            //企业福利            if (!empty($val->tag)) {                $tags            = explode(',', $val->tag);                $tag_arr         = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();                $item['tag_arr'] = $tag_arr;            }            array_push($res, $item);        }        $filter_where = [            'AIX_trade'        => 100,            'AIX_company_type' => 100,        ];        $categories   = $this->categoryService->getCategories($filter_where);        if ($request->ajax()) {            if (count($res)) {                return response()->json(['status' => 1, 'data' => view('app.active.ajax.ajax_spring_recruit', [                    'categories' => $categories,                    'res'        => $res,                    'city'       => $citys,                    'more'       => $more,                    'params'     => $params,                ])->render()]);            }            return response()->json(['status' => 0]);        }        return view('app.active.online_recruit', [            'categories' => $categories,            'res'        => $res,            'more'       => $more,            'params'     => $params,        ]);    }    /**薪动餐饮     * @param Request $request     * @param int $id     * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View     * @throws \Throwable     */    public function restaurant(Request $request)    {        $offset = isset($request->page) ? $request->page : 0;        $limit  = 18;        $where   = [];        $where[] = ['user_status', '=', 1];        $where[] = ['audit', '=', 1];        $where[] = ['is_restaurant', '=', 1];        $where[] = ['deleted_at', '=', null];        $list         = DB::table('companys')->where($where)->orderBy('sort_index', 'desc')->orderBy('id', 'desc')->offset($limit * $offset)->limit($limit)->get();        $total        = DB::table('companys')->where($where)->count();        $more = count($list) >= $limit ? true : false;        $res           = [];        $total_job     = 0;        $total_job_num = 0;        foreach ($list as $val) {            $item = [                'id'          => $val->id,                'companyname' => $val->companyname,                'jobs'        => [],                'tag_arr'     => [],            ];            //在招职位            $jobs_where = [                ['company_id', '=', $val->id],                ['valid', '=', 1],                ['display', '=', 1],                ['audit', '=', 1],                ['deleted_at', '=', null],            ];            $jobs = DB::table('jobs')->where($jobs_where)->get();            if ($jobs) {                foreach ($jobs as $value) {                    $job = [                        'id'        => $value->id,                        'jobs_name' => $value->jobs_name,                        'amount'    => $value->amount,                        'wage'      => $value->wage,                        'wage_min'  => $value->wage_min,                        'wage_max'  => $value->wage_max,                    ];                    array_push($item['jobs'], $job);                    $total_job_num += $value->amount;                    $total_job     += 1;                }            }            //企业福利            if (!empty($val->tag)) {                $tags            = explode(',', $val->tag);                $tag_arr         = DB::table('categorys')->whereIn('id', $tags)->limit(3)->get(['demand'])->toArray();                $item['tag_arr'] = $tag_arr;            }            array_push($res, $item);        }        if ($request->ajax()) {            if (count($res)) {                return response()->json(['status' => 1, 'data' => view('app.active.ajax.ajax_restaurant', [                    'res'        => $res,                    'more'       => $more,                ])->render()]);            }            return response()->json(['status' => 0]);        }        return view('app.active.restaurant', [            'res'          => $res,            'more'         => $more,            'total'        => $total,            'total_job'    => $total_job,        ]);    }}
 |