...
|
...
|
@@ -46,19 +46,18 @@ class Screen extends Api |
|
|
->value('title');
|
|
|
$list['time'] = date('Y-m-d H:i:s',time());
|
|
|
$list['team_rank'] = \db('study_score_log')
|
|
|
->field('SUM(score) as sum_score,team_id')
|
|
|
->field('SUM(score) as sum_score,team_id,campus_id')
|
|
|
->where('campus_id',$data['campus_id'])
|
|
|
->group('team_id')
|
|
|
->order('sum_score DESC')
|
|
|
->limit(4)
|
|
|
->select();
|
|
|
$list['study_rank'] = db('study_score_log')
|
|
|
->field('study_id,SUM(score) as sum_score,team_id')
|
|
|
->where('campus_id',$data['campus_id'])
|
|
|
->order('sum_score DESC')
|
|
|
->group('study_id')
|
|
|
->limit('0,10')
|
|
|
->select();
|
|
|
->paginate(4)
|
|
|
->each(function ($item,$key){
|
|
|
$res = db('study_score_log')->where('campus_id',$item['campus_id'])->sum('score');
|
|
|
$item['score'] = floor($item['sum_score']);
|
|
|
$item['percent'] = round($item['score'] / $res * 100,2);
|
|
|
$item['study'] = db('study')->where('team_id',$item['team_id'])->field('name,earn_score')->select();
|
|
|
return $item;
|
|
|
});
|
|
|
$this->success('获取成功',$list);
|
|
|
}
|
|
|
|
...
|
...
|
|