...
|
...
|
@@ -213,12 +213,12 @@ class Index extends Api |
|
|
$data = \db('study_score_log l')
|
|
|
->distinct('l.team')
|
|
|
->join('team t', 't.title = l.team')
|
|
|
->whereIn('l.campus_ids', $campus)
|
|
|
->where('l.campus_id', $campus)
|
|
|
->field('t.title,t.score,l.team,l.campus_ids')
|
|
|
->order('t.score DESC')
|
|
|
->paginate($row, false, ['page' => $page])
|
|
|
->each(function ($item, $key) {
|
|
|
$res = db('study_score_log')->where('campus_ids', $item['campus_ids'])->sum('score');
|
|
|
$res = db('study_score_log')->where('campus_id', $item['campus_ids'])->sum('score');
|
|
|
$item['score'] = floor($item['score']);
|
|
|
$item['percent'] = round(($item['score'] * 0.6) / $res * 100, 2);
|
|
|
return $item;
|
...
|
...
|
@@ -264,7 +264,7 @@ class Index extends Api |
|
|
//个人排行榜
|
|
|
$data = \db('study_score_log')
|
|
|
->field('id,SUM(score) as sum_score,study_id')
|
|
|
->whereIn('campus_ids', $campus)
|
|
|
->where('campus_id', $campus)
|
|
|
->group('study_id')
|
|
|
->order('sum_score DESC')
|
|
|
->paginate($row, false, ['page' => $page])
|
...
|
...
|
|