|
@@ -507,13 +507,21 @@ class Recruit extends Base
|
|
|
$recruits = \app\common\model\Recruit::where(['user_id'=>$this->user_id,'is_deleted'=>0])->column('id');
|
|
|
$recruit_ids = RecruitResume::where('recruit_id','in',$recruits)->where('is_deleted',0)->where('to_deleted',0)->group('recruit_id')->column('recruit_id');
|
|
|
$ids_str = implode(',',$recruit_ids);
|
|
|
- $list = \app\common\model\Recruit::where(['r.user_id'=>$this->user_id,'r.is_deleted'=>0,])
|
|
|
+ $list = \app\common\model\Recruit::where(['r.user_id'=>$this->user_id,'r.is_deleted'=>0,]) ->alias('r')
|
|
|
//->where('r.id','in',$ids_str)
|
|
|
- ->alias('r')
|
|
|
- ->field('r.id,IFNULL( (SELECT count( s.id) FROM dd_recruit_resume as s WHERE r.id=s.recruit_id ),0) as re_num,IFNULL( (SELECT max(y.id) FROM dd_recruit_resume as y WHERE r.id=y.recruit_id ),0) as max_id')
|
|
|
- ->order('max_id desc')
|
|
|
+ //->field('r.id,IFNULL( (SELECT count( s.id) FROM dd_recruit_resume as s WHERE r.id=s.recruit_id ),0) as re_num,IFNULL( (SELECT max(y.id) FROM dd_recruit_resume as y WHERE r.id=y.recruit_id ),0) as max_id')
|
|
|
+ ->field('r.id,r.title,r.salary,IFNULL( (SELECT count( s.id) FROM dd_recruit_resume as s WHERE r.id=s.recruit_id ),0) as re_num')
|
|
|
+ ->order('r.id desc')
|
|
|
+ ->limit($this->off_set,$this->page_num)
|
|
|
->select()->toArray();
|
|
|
- var_dump( $list);
|
|
|
+ array_walk($list,function (&$v){
|
|
|
+ $v['unread_num'] = RecruitResume::where(['recruit_id'=>$v['id'],'is_deleted'=>0,'is_read'=>0])->count();
|
|
|
+ $v['time_str'] = timeTransform($v['crate_at']);
|
|
|
+ });
|
|
|
+ $total_num = \app\common\model\Recruit::where(['r.user_id'=>$this->user_id,'r.is_deleted'=>0,]) ->alias('r')
|
|
|
+ ->field('r.id,IFNULL( (SELECT count( s.id) FROM dd_recruit_resume as s WHERE r.id=s.recruit_id ),0) as re_num')
|
|
|
+ ->order('r.id desc')->count();
|
|
|
+ $this->success('ok', ['list' => $list, 'total_count' => $total_num, 'page_num' => $this->page_num]);
|
|
|
|
|
|
}
|
|
|
|