From 597aaafccd8b0607d88dbff7441914beafcee136 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 30 Sep 2022 09:51:01 +0800 Subject: [PATCH] ranking-list --- app/controller/Ranking.php | 52 ++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/app/controller/Ranking.php b/app/controller/Ranking.php index ea8ab3c..e5917b2 100644 --- a/app/controller/Ranking.php +++ b/app/controller/Ranking.php @@ -1,4 +1,5 @@ where($where)->limit(env("page_count"))->order('hot desc')->paginate([ - "list_rows"=>env("PAGE_COUNT"), - "page"=>$lastIndex - ]); + $list = Db::name("student") + ->where($where) +// ->limit(env("page_count")) + ->order('hot desc') + ->paginate([ + "list_rows" => env("PAGE_COUNT"), + "page" => $lastIndex + ]); - if(empty($list)) return show("获取成功", SUCCESS_CODE,$result); - if($list->currentPage() < $list->lastPage()){ - $result['lastIndex'] = $lastIndex +1; - }else{ + if (empty($list)) { + return show("获取成功", SUCCESS_CODE, $result); + } + if ($list->currentPage() < $list->lastPage()) { + $result['lastIndex'] = $lastIndex + 1; + } else { $result['lastIndex'] = 0; } $result = StudentToArray($list); - return show(SUCCESS_MESSAGE,SUCCESS_CODE,$result); + return show(SUCCESS_MESSAGE, SUCCESS_CODE, $result); } }