作者 开飞机的舒克

大屏数据

... ... @@ -37,13 +37,13 @@ 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,campus_id')
->where('campus_id',$data['campus_id'])
->field('SUM(score) as sum_score,team,campus_ids')
->whereIn('campus_ids',$data['campus_id'])
->group('team')
->order('sum_score DESC')
->paginate(4)
->each(function ($item,$key){
$res = db('study_score_log')->where('campus_id',$item['campus_id'])->sum('score');
$res = db('study_score_log')->whereIn('campus_ids',$item['campus_ids'])->sum('score');
$item['team_name'] = db('team')->where('title',$item['team'])->value('title');
$item['team_score'] = db('team')->where('title',$item['team'])->value('score');
$item['score'] = floor($item['sum_score']);
... ... @@ -51,10 +51,8 @@ class Screen extends Api
$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'=>$item['team']
])
->whereIn('l.campus_ids',$item['campus_ids'])
->where('s.team',$item['team'])
->field('s.name,sum(score) as sum_score')
->order('sum_score','desc')
->group('study_id')
... ...