正在显示
1 个修改的文件
包含
18 行增加
和
12 行删除
@@ -26,33 +26,39 @@ class Screen extends Api | @@ -26,33 +26,39 @@ class Screen extends Api | ||
26 | "study_rank": 个人排行[每个战队中从高到低排] | 26 | "study_rank": 个人排行[每个战队中从高到低排] |
27 | } | 27 | } |
28 | */ | 28 | */ |
29 | - public function index(){ | 29 | + public function index() |
30 | + { | ||
30 | $list = []; | 31 | $list = []; |
31 | - $data = db('screen')->where('is_view',1)->find(); | ||
32 | - $list['images'] = cdnurl($data['images'],true); | 32 | + $data = db('screen')->where('is_view', 1)->find(); |
33 | + $list['images'] = cdnurl($data['images'], true); | ||
33 | $list['count_down'] = $data['endtime']; | 34 | $list['count_down'] = $data['endtime']; |
34 | $list['screen_name'] = $data['title']; | 35 | $list['screen_name'] = $data['title']; |
35 | $list['campus_name'] = $data['campus']; | 36 | $list['campus_name'] = $data['campus']; |
36 | - $list['time'] = date('Y-m-d H:i:s',time()); | 37 | + $list['time'] = date('Y-m-d H:i:s', time()); |
37 | $list['team_rank'] = \db('team_score') | 38 | $list['team_rank'] = \db('team_score') |
38 | - ->where('ronda_id',$data['ronda_id']) | 39 | + ->where('ronda_id', $data['ronda_id']) |
39 | // ->field('score as sum_score,team_id') | 40 | // ->field('score as sum_score,team_id') |
40 | ->order('score DESC') | 41 | ->order('score DESC') |
41 | ->paginate(4) | 42 | ->paginate(4) |
42 | - ->each(function ($item,$key){ | ||
43 | - $item['team_name'] = db('team')->where('id',$item['team_id'])->value('title'); | 43 | + ->each(function ($item, $key) { |
44 | + $item['team_name'] = db('team')->where('id', $item['team_id'])->value('title'); | ||
44 | $item['team_score'] = $item['score']; | 45 | $item['team_score'] = $item['score']; |
45 | $item['percent'] = $item['score']; | 46 | $item['percent'] = $item['score']; |
46 | $item['study'] = db('study_ronda_score l') | 47 | $item['study'] = db('study_ronda_score l') |
47 | - ->join('study s','l.sid = s.id') | ||
48 | - ->where('l.team_id',$item['team_id']) | ||
49 | - ->where('ronda_id',$item['ronda_id']) | 48 | + ->join('study s', 'l.sid = s.id') |
49 | + ->where('l.team_id', $item['team_id']) | ||
50 | + ->where('ronda_id', $item['ronda_id']) | ||
50 | ->field('s.name,score as sum_score,l.*') | 51 | ->field('s.name,score as sum_score,l.*') |
51 | - ->order('score','desc') | 52 | + ->order('score', 'desc') |
52 | ->select(); | 53 | ->select(); |
53 | return $item; | 54 | return $item; |
54 | }); | 55 | }); |
55 | - $this->success('获取成功',$list); | 56 | + if (time() >= $data['endtime']) { |
57 | + db('team_score') | ||
58 | + ->where('ronda_id', $data['ronda_id']) | ||
59 | + ->update(['score' => 0]); | ||
60 | + } | ||
61 | + $this->success('获取成功', $list); | ||
56 | } | 62 | } |
57 | 63 | ||
58 | } | 64 | } |
-
请 注册 或 登录 后发表评论