作者 开飞机的舒克

首页项目校区展示问题

... ... @@ -164,20 +164,20 @@ class Index extends Api
*/
public function getSchoolItem()
{
// $user = $this->auth->getUserinfo();
// $find = \db('study')->where('user_id',$user['id'])->find();
// $res = \db('study_score_log')->where('study_id',$find['id'])->column('campus_id');
// foreach ($res as $k){
// $data = \db('campus')->where('id',$k)->find();
// }
$data = db('campus c')
->join('activity a','a.id = c.activity_id')
->join('school s','s.id = c.school_id')
->field('c.*,a.title as activity_name,s.title as school_name')
->select();
if (empty($data)) {
$this->error('当前还没有校区', ['status' => 2]);
$user = $this->auth->getUserinfo();
$find = \db('study')->where('user_id',$user['id'])->find();
$res = \db('study_score_log')->where('study_id',$find['id'])->column('campus_id');
foreach ($res as $k){
$data = \db('campus')->where('id',$k)->select();
}
// $data = db('campus c')
// ->join('activity a','a.id = c.activity_id')
// ->join('school s','s.id = c.school_id')
// ->field('c.*,a.title as activity_name,s.title as school_name')
// ->select();
// if (empty($data)) {
// $this->error('当前还没有校区', ['status' => 2]);
// }
$this->success('项目校区', $data);
}
... ...