...
|
...
|
@@ -55,7 +55,17 @@ class Screen extends Api |
|
|
$res = db('study_score_log')->where('campus_id',$item['campus_id'])->sum('score');
|
|
|
$item['score'] = floor($item['sum_score']);
|
|
|
$item['percent'] = round(($item['score']*0.6) / $res * 100,2);
|
|
|
$item['study'] = db('study')->where('team_id',$item['team_id'])->field('name,earn_score')->order('earn_score','desc')->select();
|
|
|
$item['study'] = db('study_score_log l')
|
|
|
->distinct('l.study_id')
|
|
|
->join('study s','l.study_id = s.id')
|
|
|
->where([
|
|
|
'l.campus_id'=>$item['campus_id'],
|
|
|
's.team_id'=>$item['team_id']
|
|
|
])
|
|
|
->field('s.name,sum(score) as sum_score')
|
|
|
->order('sum_score','desc')
|
|
|
->group('study_id')
|
|
|
->select();
|
|
|
return $item;
|
|
|
});
|
|
|
$this->success('获取成功',$list);
|
...
|
...
|
|