作者 王晓刚

获取学员详情

... ... @@ -71,14 +71,64 @@ class University extends Api
}
public function getCollegeDetail(){
$user_id = $this->auth->id;
$college_id = $this->request->param('college_id',0,'intval');
// 获取学院
$college = new College();
$data = $college->infoById($college_id);
$collegeModel = new College();
$data = $collegeModel->infoById($college_id);
foreach ($data as $k => $v) {
$data[$k]['des_image'] = $this->qiNiu.$v['des_image'];
}
$this->success('SUCCESS',$data);
$studentModel = new Student();
//获取当前用户信息
$user = $studentModel->infoByUserId($user_id);
//获取当前用户所属高中信息
$schoolModel = new School();
$school = $schoolModel->infoById($user['school_id']);
//获取当前用户同大学、院系、高中人数
$total1 = $studentModel->where([
'level'=>'2',
'show_switch'=>1,
'university_id'=>$user['university_id'],
'school_id'=>$user['school_id'],
'college_id'=>$college_id,
'deletetime'=>['exp',Db::raw('is null')]
])->count();
//获取当前用户同省、大学、学院人数
//获取当前用户同省的高中
$school_province = $schoolModel->where(['province_id'=>$school['province_id']])->select();
$school_ids = [];
foreach($school_province as $key => $s_p){
$school_ids[] = $s_p['province_id'];
}
$total2 = $studentModel->where([
'level'=>'2',
'show_switch'=>1,
'university_id'=>$user['university_id'],
'school_id'=>['in',$school_ids],
'college_id'=>$college_id,
'deletetime'=>['exp',Db::raw('is null')]
])->count();
//获取当前用户同城市、大学、学院人数
//获取当前用户同城市的高中
$school_city = $schoolModel->where(['city_id'=>$school['city_id']])->select();
$school_ids = [];
foreach($school_city as $key => $s_c){
$school_ids[] = $s_c['province_id'];
}
$total3 = $studentModel->where([
'level'=>'2',
'show_switch'=>1,
'university_id'=>$user['university_id'],
'school_id'=>['in',$school_ids],
'college_id'=>$college_id,
'deletetime'=>['exp',Db::raw('is null')]
])->count();
$result['data'] = $data;
$result['total1'] = $total1;
$result['total2'] = $total2;
$result['total3'] = $total3;
$this->success('SUCCESS',$result);
}
... ...