123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325 |
- <?php
- /**
- * Created by PhpStorm.
- * User: wuzhenke
- * Date: 2019/1/17
- * Time: 16:19
- */
- namespace App\Http\Controllers\Mobile\Active;
- use App\Exceptions\ResponseException;
- use App\Http\Controllers\Mobile\MobileBaseController;
- use App\Services\Common\CategoryService;
- use App\Services\Common\SearchService;
- use App\Services\Company\JobsService;
- use Illuminate\Http\Request;
- use App\Services\Company\CompanyService;
- use Illuminate\Support\Facades\Cache;
- use Illuminate\Support\Facades\DB;
- class JobfairController extends MobileBaseController
- {
- protected $companyService;
- protected $jobsService;
- protected $categoryService;
- protected $searchService;
- /*
- * 企业中心
- * */
- /**
- * 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
- )
- {
- $this->companyService = $companyService;
- $this->jobsService = $jobsService;
- $this->categoryService = $categoryService;
- $this->searchService = $searchService;
- }
- /**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 = array('citycategory','trade','nature');
- $params= array();
- 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);
- $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 = array();
- $where[] = array('reg_time', '>', 1577808000);
- $where[] = array('user_status', '=', 1);
- $where[] = array('subsite_id', '=', get_subsite_id());
- $where[] = array('audit','=',1);
- $where[] = array('deleted_at','=',null);
- if(!empty($trade)){
- $where[] = array('trade','=',$trade);
- }
- //$where[] = array('id','in',$companys);
- $order_by = array('id','desc');
- //$list = $this->searchService->search('Company', $where, $order_by, '');
- //$list = DB::table('companys')->where($where)->whereRaw("(district like ? or district like ?)",["%.{$citys['select']['id']}%","%{$citys['select']['id']}.%"])->whereIn('id',$companys)->orderBy('id','desc')->offset($limit*$offset)->limit($limit)->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 = [];
- foreach ($list as $val) {
- $item = array(
- 'id' => $val->id,
- 'companyname' => $val->companyname,
- 'jobs' => []
- );
- //在招职位
- $jobs_where = array(
- array('company_id','=',$val->id),
- array('valid','=',1),
- array('display','=',1),
- array('audit','=',1)
- );
- //$jobs = $this->jobsService->getOtherJobs($jobs_where);
- $jobs = DB::table('jobs')->where($jobs_where)->get();
- if($jobs){
- foreach ($jobs as $value) {
- $job = array(
- 'id' => $value->id,
- 'jobs_name' => $value->jobs_name,
- 'amount' => $value->amount
- );
- array_push($item['jobs'],$job);
- }
- }
- array_push($res,$item);
- }
- $filter_where = array(
- '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
- //'list_items' => $list_items,
- //'list' => $list,
- ]);
- }
- public function online2020m(Request $request){
- $offset = isset($request->page)?$request->page:0;
- $limit = 20;
- $citycategory = $request->input('citycategory');
- $trade = $request->input('trade');
- $param_array = array('citycategory','trade','nature');
- $params= array();
- if ($request->all()) {
- foreach ($request->all() as $k => $v) {
- if (in_array($k, $param_array) && $v) {
- $params[$k] = $v;
- }
- }
- }
- $filter_where = array(
- 'AIX_trade' => 100,
- 'AIX_company_type' => 100
- );
- $categories = $this->categoryService->getCategories($filter_where);
- $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)){
- $citys['select']['id'] = 623;
- }
- $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 = array();
- $where[] = array('reg_time', '>', 1577808000);
- $where[] = array('user_status', '=', 1);
- $where[] = array('subsite_id', '=', get_subsite_id());
- $where[] = array('audit','=',1);
- $where[] = array('deleted_at','=',null);
- if(!empty($trade)){
- $where[] = array('trade','=',$trade);
- }
- //$list = DB::table('companys')->where($where)->whereIn('id',$companys)->orderBy('id','desc')->offset($limit*$offset)->limit($limit)->get();
- $list = DB::table('companys')->where($where)->whereIn('id',$companys)->whereRaw("(district like ? or district like ? or district like ? or district like ?)",["%.{$citys['select']['id']}%","%{$citys['select']['id']}.%","%.245%","%245.%"])->orderBy('id','desc')->offset($limit*$offset)->limit($limit)->get();
- // echo '<pre>';
- // var_dump($citys);die;
- $more = count($list) >= $limit ? true : false;
- $res = [];
- foreach ($list as $val) {
- $item = array(
- 'id' => $val->id,
- 'companyname' => $val->companyname,
- 'trade' => $val->trade ? $categories['AIX_trade'][$val->trade]['demand'] : '未分类',
- 'jobs_num' => 0,
- 'amount_num' => 0,
- 'jobs' => []
- );
- //在招职位
- $jobs_where = array(
- array('company_id','=',$val->id),
- array('valid','=',1),
- array('display','=',1),
- array('audit','=',1)
- );
- //$jobs = $this->jobsService->getOtherJobs($jobs_where);
- $jobs = DB::table('jobs')->where($jobs_where)->get();
- if($jobs){
- $amount = 0;
- foreach ($jobs as $value) {
- $job = array(
- 'id' => $value->id,
- 'jobs_name' => $value->jobs_name,
- 'amount' => $value->amount,
- 'wage' => $value->wage_str
- );
- $amount += $value->amount;
- array_push($item['jobs'],$job);
- }
- $item['jobs_num'] = count($item['jobs']);
- $item['amount_num'] = $amount;
- }
- array_push($res,$item);
- }
- if ($request->ajax()) {
- if (count($res)) {
- return response()->json(['status'=>1,'data'=>view('mobile.app.active.ajax.ajax_jobfair_com', [
- 'res' => $res,
- 'city' => $citys,
- 'params' => $params,
- 'categories' => $categories,
- 'more' => $more
- ])->render()]);
- }
- return response()->json(['status'=>0]);
- }
- return view('mobile.app.active.online2020m',[
- 'res' => $res,
- 'city' => $citys,
- 'params' => $params,
- 'categories' => $categories,
- 'more' => $more
- ]);
- }
- }
|