正在显示
3 个修改的文件
包含
6 行增加
和
6 行删除
@@ -194,9 +194,9 @@ class Index extends Api | @@ -194,9 +194,9 @@ class Index extends Api | ||
194 | } | 194 | } |
195 | $data = \db('study_score_log l') | 195 | $data = \db('study_score_log l') |
196 | ->distinct('l.team_id') | 196 | ->distinct('l.team_id') |
197 | - ->join('team t', 't.id = l.team_id') | 197 | + ->join('team t', 't.title = l.team') |
198 | ->where('l.campus_id', $campus) | 198 | ->where('l.campus_id', $campus) |
199 | - ->field('t.title,t.score,l.team_id,l.campus_id') | 199 | + ->field('t.title,t.score,l.team,l.campus_id') |
200 | ->order('t.score DESC') | 200 | ->order('t.score DESC') |
201 | ->paginate($row, false, ['page' => $page]) | 201 | ->paginate($row, false, ['page' => $page]) |
202 | ->each(function ($item, $key) { | 202 | ->each(function ($item, $key) { |
@@ -37,14 +37,14 @@ class Screen extends Api | @@ -37,14 +37,14 @@ class Screen extends Api | ||
37 | ->value('title'); | 37 | ->value('title'); |
38 | $list['time'] = date('Y-m-d H:i:s',time()); | 38 | $list['time'] = date('Y-m-d H:i:s',time()); |
39 | $list['team_rank'] = \db('study_score_log') | 39 | $list['team_rank'] = \db('study_score_log') |
40 | - ->field('SUM(score) as sum_score,team_id,campus_id') | 40 | + ->field('SUM(score) as sum_score,team,campus_id') |
41 | ->where('campus_id',$data['campus_id']) | 41 | ->where('campus_id',$data['campus_id']) |
42 | - ->group('team_id') | 42 | + ->group('team') |
43 | ->order('sum_score DESC') | 43 | ->order('sum_score DESC') |
44 | ->paginate(4) | 44 | ->paginate(4) |
45 | ->each(function ($item,$key){ | 45 | ->each(function ($item,$key){ |
46 | $res = db('study_score_log')->where('campus_id',$item['campus_id'])->sum('score'); | 46 | $res = db('study_score_log')->where('campus_id',$item['campus_id'])->sum('score'); |
47 | - $item['team_name'] = db('team')->where('id',$item['team_id'])->value('title'); | 47 | + $item['team_name'] = db('team')->where('title',$item['team'])->value('title'); |
48 | $item['score'] = floor($item['sum_score']); | 48 | $item['score'] = floor($item['sum_score']); |
49 | $item['percent'] = round(($item['score']*0.6) / $res * 100,2); | 49 | $item['percent'] = round(($item['score']*0.6) / $res * 100,2); |
50 | $item['study'] = db('study_score_log l') | 50 | $item['study'] = db('study_score_log l') |
@@ -52,7 +52,7 @@ class Screen extends Api | @@ -52,7 +52,7 @@ class Screen extends Api | ||
52 | ->join('study s','l.study_id = s.id') | 52 | ->join('study s','l.study_id = s.id') |
53 | ->where([ | 53 | ->where([ |
54 | 'l.campus_id'=>$item['campus_id'], | 54 | 'l.campus_id'=>$item['campus_id'], |
55 | - 's.team_id'=>$item['team_id'] | 55 | + 's.team'=>$item['team'] |
56 | ]) | 56 | ]) |
57 | ->field('s.name,sum(score) as sum_score') | 57 | ->field('s.name,sum(score) as sum_score') |
58 | ->order('sum_score','desc') | 58 | ->order('sum_score','desc') |
此 diff 太大无法显示。
-
请 注册 或 登录 后发表评论