model->whereIn('position_id', $positionArr)->get(); } public function getJobfair($com_id) { return $this->model->with(['jobfair'=>function ($query) { $query->where([['holddate_end', '>', time()]]); }])->whereHas('jobfair',function ($query){ $query->where([['holddate_end', '>', time()]]); })->where(['company_id'=>$com_id])->where('audit','<>',3)->get(); } public function findList($com_id) { return $this->model->whereHas('jobfair')->where(['company_id'=>$com_id])->orderby('created_at', 'desc')->paginate(10); } public function findCompany($where, $offset = 0, $limit = 10) { return $this->model->webJoinFloorplanStand()->whereHas('companys')->with(['jobfair'=>function ($query) { $query->where('showendtime', '>=', time())->orWhere('showendtime', 0); },'companys','jobfairPutJob']) ->selectRaw('jobfair_companys.*') ->where($where) ->offset($limit*$offset) ->limit($limit) // ->groupBy('company_id') ->orderByRaw('jobfair_floorplan_stands.sortindex') ->get(); } public function findCompany2($where) { return $this->model->webJoinFloorplanStand()->with(['jobfair'=>function ($query) { $query->where('showendtime', '>=', time())->orWhere('showendtime', 0); },'companys']) ->selectRaw('jobfair_companys.*') ->where($where) // ->groupBy('company_id') ->orderByRaw('jobfair_floorplan_stands.sortindex') ->paginate(20); } public function aioFindCompany($where, $page) { return $this->model->with(['jobfair'=>function ($query) { $query->where('showendtime', '>=', time())->orWhere('showendtime', 0); }])->whereHas('companys')->selectRaw('*,group_concat(position) as position_arr,group_concat(id) as id_arr')->where($where)->groupBy('company_id')->paginate($page); } public function findCom($where) { return $this->model->with(['companys','jobfairPutJob'=>function($query){ $query->with('jobs'); }])->where($where)->first(); } public function findComApi($where) { return $this->model->with(['companys'=>function($query){ $query->select('id','companyname','short_name','address'); },'jobfairPutJob'=>function($query){ $query->with('jobs'); }])->where($where)->first(); } public function findOneCom($where) { return $this->model->with(['companys','jobfairPutJob'=>function($query){ $query->with('jobs'); }])->where($where)->selectRaw('*,group_concat(position) as position_arr,group_concat(id) as id_arr')->groupBy('company_id')->first(); } public function getComList($where) { return $this->model->where($where)->select(['company_id'])->groupBy('company_id')->get(); } /** * @param $where * @param $keyinput * @return mixed */ public function findJob($where) { return $this->model->with(['jobfair'=>function ($query) { $query->where('showendtime', '>=', time())->orWhere('showendtime', 0); }])->with('companys')->where($where)->get(); } public function getManyBlackCompany() { return $this->model->whereHas('jobfair', function ($query) { $query->where('holddate_end', '<', time()); })->where('audit', 1)->whereIn('type', [1,2,3])->where('black_status', 0) ->where('created_at', '>', date('Y-m-d H:i:s', strtotime('-30 days'))) ->selectRaw('count(*) as count,company_id')->groupBy('company_id')->get(); } public function getBlacklistCompany() { return $this->model->whereHas('jobfair', function ($query) { $query->where('holddate_end', '<', time()); })->where('type', 0)->where('black_status', 0)->where('audit', 1) ->where('created_at', '>', date('Y-m-d H:i:s', strtotime('-30 days')))->get(); } public function getComCount($jobfair_id) { return $this->model->with('jobfair')->where(['jobfair_id'=>$jobfair_id,'audit'=>1])->groupBy('company_id')->get(); } public function getCounts($jobfair_id) { return $this->model->where(['jobfair_id'=>$jobfair_id,'audit'=>1])->count(); } public function getOne($where) { return $this->model->with('jobfair')->where($where)->first(); } public function updateInfo($where,$data) { return $this->model->where($where)->update($data); } //手机端下滑分页 public function getComPage($where,$limit,$page){ return $this->model->with('companys')->where($where) ->selectRaw('*,group_concat(position) as position_arr') ->where($where) ->groupBy('company_id') ->paginate($limit,['*'],'page',$page); } public function getCount($where, $subsite_id) { return $this->model->when($subsite_id,function ($query) use($subsite_id) { $query->whereHas('jobfair', function ($query) use($subsite_id) { $query->where($subsite_id); }); })->where($where)->count(); } /** * 根据条件删除 * @param $where * @return mixed */ public function delJobs($column, $ids) { return $this->model->whereIn($column, $ids)->delete(); } public function getStatisticsCompanyCount($where, $whereIn = array()) { $res = $this->model->where($where); if ($whereIn) { foreach ($whereIn as $k => $v) { $res->whereIn($k, $v); } } return $res->count(); } public function findListOption($com_id) { return $this->model->whereHas('jobfair')->where(['company_id'=>$com_id])->groupBy('jobfair_id')->orderby('created_at', 'desc')->get(); } public function getCrmJobfairExhibitors($where, $whereIn = [], $order_by = '', $offset = '', $limit = '') { $rst = $this->model->with(['jobfair','jobfairPutJob','jobfairFloorPlanStands', 'companys'])->where($where); if ($whereIn) { foreach ($whereIn as $k => $v) { $rst->whereIn($k, $v); } } if ($order_by) { $rst->orderByRaw($order_by); } if ($offset !='' && $limit!='') { $rst->offset($offset)->limit($limit); }; return $rst->get(); } public function getCrmExhibitorNum($where, $whereIn) { $rst = $this->model->where($where); if ($whereIn) { foreach ($whereIn as $k => $v) { $rst->whereIn($k, $v); } } return $rst->count(); } public function getValue($where,$column) { return $this->model->where($where)->value($column); } public function getPluck($where,$column) { return $this->model->where($where)->pluck($column); } public function getJobfaitCompany($where) { return $this->model->where($where)->get(); } }