作者 开飞机的舒克

大屏管理

... ... @@ -85,10 +85,10 @@ class Screen extends Backend
}
$data = $row->toArray();
$res = db('study_score_log l')
->join('team t', 'l.team_id = t.id')
->join('team t', 'l.team = t.title')
->where('campus_id', $data['campus_id'])
->field('l.team_id,sum(l.score) as sum_score,t.title')
->group('l.team_id')
->field('l.team,sum(l.score) as sum_score,t.title')
->group('l.team')
->order('sum_score', 'desc')
->limit(4)
->select();
... ... @@ -119,8 +119,7 @@ class Screen extends Backend
$res = db('study_score_log l')
->distinct('l.study_id')
->join('study s','l.study_id = s.id')
->join('team t','t.id = l.team_id')
->field('s.name,sum(l.score) as sum_score,t.title,t.id')
->field('s.name,sum(l.score) as sum_score,l.team')
->order('sum_score','desc')
->group('l.study_id')
->where('campus_id', $data['campus_id'])
... ... @@ -131,7 +130,7 @@ class Screen extends Backend
$list[] = [
'name' => $v['name'],
'score' => $v['sum_score'],
'title'=>$v['title'],
'title'=>$v['team'],
'rank'=> $k+1
];
}
... ...