作者 开飞机的舒克

接口优化

<?php
namespace app\api\controller;
use app\common\controller\Api;
class Crontab extends Api
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = ['*'];
public function index(){
$res = db('study')->field('team_id,earn_score,team_rank')->select();
if ($res['team_id']){
}
}
}
\ No newline at end of file
... ...
... ... @@ -48,7 +48,10 @@ class Index extends Api
'campus_id' => $campus,
]
)->sum('score');
$data = \db('study_score_log')->field('study_id, SUM(score) as sum_score')->group('study_id')->order('sum_score', 'desc')->select();
$data = \db('study_score_log')
->field('study_id, SUM(score) as sum_score')
->group('study_id')->order('sum_score', 'desc')
->select();
$list = [];
foreach ($data as $k => $v) {
if ($v['study_id'] == $sid['id']) {
... ...