pushCriteria(app(RequestCriteria::class)); } public function getJobList($where) { return $this->model->where($where)->orderByRaw('field(audit,2,1,3)')->orderBy('updated_at', 'desc')->paginate(10); } public function editJob($id) { return $this->model->with('jobsContact')->where('id', $id)->first(); } public function store($jobData) { return $this->model->create($jobData); } public function deleteJobs($where, $ids) { return $this->model->where($where)->whereIn('id', $ids)->delete(); } public function getCount($where) { return $this->model ->when(get_subsite_id()>0, function ($query) { $query->whereHas('company', function ($query) { $query->where('companys.subsite_id', get_subsite_id()); }); })->where($where)->count(); } public function displayswitch($id, $display) { return $this->model->where('id', $id)->update(['display'=>$display]); } /** * 根据条件删除 * @param $where * @return mixed */ public function delJobs($column, $ids) { return $this->model->whereIn($column,$ids)->delete(); } public function getAuditJobList($where) { return $this->model->where($where)->orderBy('id', 'desc')->get(); } public function getJobs($where) { return $this->model->where($where)->get(); } public function getCrmJobs($where, $whereIn = [], $order_by = '', $offset = '', $limit = '') { $rst = $this->model->with(['company'])->whereHas('company')->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 getCrmInfo ($where) { return $this->model->with(['company','contact'])->where($where)->first(); } public function getCrmJobCount($where, $where_in = []) { $rst = $this->model->whereHas('company')->where($where); if ($where_in) { foreach ($where_in as $k => $v) { $rst->whereIn($k, $v); } } return $rst->count(); } public function getColumn($where,$column) { return $this->model->where($where)->value($column); } public function getPluck($where,$column) { return $this->model->where($where)->pluck($column); } }