| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 | <?phpnamespace App\Repositories;use App\Models\CompanyInterView;use Prettus\Repository\Eloquent\BaseRepository;use Prettus\Repository\Criteria\RequestCriteria;/** * Class MemberRepositoryEloquent. * * @package namespace App\Repositories; */class CompanyInterviewRepository extends BaseRepository{    /**     * Specify Model class name     *     * @return string     */    public function model()    {        return CompanyInterView::class;    }    /**     * Boot up the repository, pushing criteria     */    public function boot()    {        $this->pushCriteria(app(RequestCriteria::class));    }    /**     * 面试邀请数。     * @param $resume_id     * @param $resume_uid     * @return mixed     */    public function getInterview($resume_uid, $where)    {        return $this->model->with(['resumes','jobs'=>function ($query) use ($where) {            $query->whereIn('audit', $where)->where('display', 1)->where('valid', 1);        }])->whereHas('resumes')->whereHas('jobs')->where(['resume_uid'=>$resume_uid,'personal_look'=>1])->count();    }    public function getInterviewDef($resume_id, $where)    {        return $this->model->with(['resumes','jobs'=>function ($query) use ($where) {            $query->whereIn('audit', $where)->where('display', 1)->where('valid', 1);        }])->whereHas('resumes')->whereHas('jobs')->where(['resume_id'=>$resume_id,'personal_look'=>1])->count();    }    public function getInterviewByUid($data, $where)    {        return $this->model->with(['resumes','jobs'=>function ($query) use ($where) {            $query->whereIn('audit', $where)->where('display', 1)->where('valid', 1);        }])->where($data)->whereHas('resumes')->whereHas('jobs')->orderByRaw('personal_look asc,interview_time desc')->paginate(10);    }    /**     * 3天内的面试邀请数。     */    public function getInterviewCount($uid, $where)    {        return $this->model->with(['resumes','jobs'=>function ($query) use ($where) {            $query->whereIn('audit', $where)->where('display', 1)->where('valid', 1);        }])->whereHas('resumes')->whereHas('jobs')->where(['resume_uid'=>$uid])->where('created_at', '>=', date('Y-m-d H:i:s', strtotime("-3 day")))->count();    }    public function setInterview($id, $data)    {        return $this->model->whereIn('id', $id)->update($data);    }    public function delInterview($id,$company_id)    {        return $this->model->whereIn('id', $id)->where("company_id",$company_id)->delete();    }    public function getInterviewById($id)    {        return $this->model->find($id);    }    /**     * 核查简历是否被邀请面试     * @param $resumeId     * @param $uid     * @param $jobsId     * @return bool     */    public function checkInterview($resumeId, $uid,$jobsId,$personal_jobs_id=0)    {        $where['resume_id'] = $resumeId;        $where['company_id'] = $uid;        $where['jobs_id'] = $jobsId;        if (!empty($personal_jobs_id)){            $where['personal_jobs_id']=$personal_jobs_id;        }        if (!$this->model->where($where)->first()) {            return false;        }        return true;    }    /**     * 企业中心======面试邀请记录     * @param $page     * @param $where     * @param $valid 停招职位     * @return mixed     */    public function interviewJobs($page, $where, $valid)    {        return $this->model->whereHas('jobs', function ($query) use ($valid) {            if (!empty($valid)) {                $query->whereIn('valid', $valid);            }        })->with('resumes')->where($where)->orderBy('interview_time', 'desc')->paginate($page, ['*']);    }    /**面试邀请详情     * @param $where     * @return mixed     */    public function interviewDetail($where)    {        return $this->model->where($where)->first();    }    public function InterviewUpdate(array $attributes, $id,$company_id)    {        return $this->model->where(['id'=>$id,'company_id'=>$company_id])->update($attributes);    }    /**邀请面试数     * @param $where     * @return mixed     */    public function interviewCount($where)    {        $valid = ['1'];        return $this->model->whereHas('jobs', function ($query) use ($valid) {                $query->whereIn('valid', $valid);        })->with('jobs')->with('resumes')->where($where)->count();    }}
 |