...
|
...
|
@@ -12,9 +12,20 @@ class Crontab extends Api |
|
|
|
|
|
|
|
|
public function index(){
|
|
|
$res = db('study')->field('team_id,earn_score,team_rank')->select();
|
|
|
if ($res['team_id']){
|
|
|
|
|
|
$res = db('study')->field('earn_score')->select();
|
|
|
function sort($res){
|
|
|
$len = count($res);
|
|
|
for ($i = 0; $i < $len - 1; $i++) {//循环比对的轮数
|
|
|
for ($j = 0; $j < $len - $i - 1; $j++) {//当前轮相邻元素循环对比
|
|
|
if ($res[$j] < $res[$j + 1]) {//如果前边的大于后边的
|
|
|
$tmp = $res[$j];//交换数据
|
|
|
$res[$j] = $res[$j + 1];
|
|
|
$res[$j + 1] = $tmp;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return $res;
|
|
|
}
|
|
|
$this->success('',sort($res));
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|