正在显示
3 个修改的文件
包含
18 行增加
和
8 行删除
@@ -69,11 +69,16 @@ class Demo extends Api | @@ -69,11 +69,16 @@ class Demo extends Api | ||
69 | */ | 69 | */ |
70 | public function test3() | 70 | public function test3() |
71 | { | 71 | { |
72 | - $unique = "张三"; | ||
73 | - $generate = Generate::qr(); | ||
74 | - $file_path = $generate->create($unique,true,true); | ||
75 | - $file_path = substr($file_path,strripos($file_path,"public")+6); | ||
76 | - return $file_path; | 72 | + $id = '三年级三班'; |
73 | + $arr = substr($id,0,1); | ||
74 | + $map = array('一' => '1','二' => '2','三' => '3','四' => '4','五' => '5','六' => '6'); | ||
75 | + foreach ($map as $k => $v){ | ||
76 | + $k = $arr; | ||
77 | + return $k; | ||
78 | + } | ||
79 | + | ||
80 | +// $res = str_pad($id,8,"0",STR_PAD_LEFT); | ||
81 | +// dump($res); | ||
77 | } | 82 | } |
78 | 83 | ||
79 | } | 84 | } |
@@ -171,9 +171,14 @@ class Index extends Api | @@ -171,9 +171,14 @@ class Index extends Api | ||
171 | ->distinct('l.team_id') | 171 | ->distinct('l.team_id') |
172 | ->join('team t', 't.id = l.team_id') | 172 | ->join('team t', 't.id = l.team_id') |
173 | ->where('l.campus_id', $campus) | 173 | ->where('l.campus_id', $campus) |
174 | - ->field('t.title,t.score,l.team_id') | 174 | + ->field('t.title,t.score,l.team_id,l.campus_id') |
175 | ->order('t.score DESC') | 175 | ->order('t.score DESC') |
176 | - ->paginate($row, false, ['page' => $page]); | 176 | + ->paginate($row, false, ['page' => $page]) |
177 | + ->each(function ($item,$key){ | ||
178 | + $res = db('study_score_log')->where('campus_id',$item['campus_id'])->sum('score'); | ||
179 | + $item['score'] = floor($item['score']); | ||
180 | + $item['percent'] = round(($item['score']*0.6) / $res * 100,2); | ||
181 | + }); | ||
177 | //最终显示 | 182 | //最终显示 |
178 | $this->success('战队排行榜', $data); | 183 | $this->success('战队排行榜', $data); |
179 | } | 184 | } |
@@ -4970,7 +4970,7 @@ | @@ -4970,7 +4970,7 @@ | ||
4970 | 4970 | ||
4971 | </div> | 4971 | </div> |
4972 | <div class="col-md-6" align="right"> | 4972 | <div class="col-md-6" align="right"> |
4973 | - Generated on 2023-03-16 15:52:47 <a href="./" target="_blank">校园活动</a> | 4973 | + Generated on 2023-03-17 09:40:00 <a href="./" target="_blank">校园活动</a> |
4974 | </div> | 4974 | </div> |
4975 | </div> | 4975 | </div> |
4976 | 4976 |
-
请 注册 或 登录 后发表评论