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 '
';
//
// 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 '';
//
// 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 '';
// 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
]);
}
}