作者 开飞机的舒克

接口优化

... ... @@ -69,11 +69,16 @@ class Demo extends Api
*/
public function test3()
{
$unique = "张三";
$generate = Generate::qr();
$file_path = $generate->create($unique,true,true);
$file_path = substr($file_path,strripos($file_path,"public")+6);
return $file_path;
$id = '三年级三班';
$arr = substr($id,0,1);
$map = array('一' => '1','二' => '2','三' => '3','四' => '4','五' => '5','六' => '6');
foreach ($map as $k => $v){
$k = $arr;
return $k;
}
// $res = str_pad($id,8,"0",STR_PAD_LEFT);
// dump($res);
}
}
... ...
... ... @@ -171,9 +171,14 @@ class Index extends Api
->distinct('l.team_id')
->join('team t', 't.id = l.team_id')
->where('l.campus_id', $campus)
->field('t.title,t.score,l.team_id')
->field('t.title,t.score,l.team_id,l.campus_id')
->order('t.score DESC')
->paginate($row, false, ['page' => $page]);
->paginate($row, false, ['page' => $page])
->each(function ($item,$key){
$res = db('study_score_log')->where('campus_id',$item['campus_id'])->sum('score');
$item['score'] = floor($item['score']);
$item['percent'] = round(($item['score']*0.6) / $res * 100,2);
});
//最终显示
$this->success('战队排行榜', $data);
}
... ...
... ... @@ -4970,7 +4970,7 @@
</div>
<div class="col-md-6" align="right">
Generated on 2023-03-16 15:52:47 <a href="./" target="_blank">校园活动</a>
Generated on 2023-03-17 09:40:00 <a href="./" target="_blank">校园活动</a>
</div>
</div>
... ...