From fd98e04accf4181a3b4815f1563486ba2856fc57 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 9 Sep 2022 16:44:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E8=AF=A6=E6=83=85=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Student.php | 74 +++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 17 deletions(-) diff --git a/app/controller/Student.php b/app/controller/Student.php index 48df7ea..ab550f6 100644 --- a/app/controller/Student.php +++ b/app/controller/Student.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); + } + + /** + * Notes : 获取学生的详情 + * + * @Date : 2022/9/9 16:41 + * @Author : + */ + public function info() + { + $studentId = $GLOBALS['data']['data']['student_id']; + + $vo = \app\model\Student::find($studentId); + + $result = [ + "id" => $vo['id'], + "hot" => $vo['hot'], + "avatar" => $vo['avatar'], + "nickname" => $vo['nickname'], + "is_disabled" => $vo['disabled'], + "type" => $vo["type"], + "identifier" => $vo['identifier'], + "article_count" => $vo['article_count'], + "city" => $vo['city'], + "school" => $vo['school'], + "age" => $vo['age'], + ]; + + return show(SUCCESS_MESSAGE, SUCCESS_CODE, $result); } }