From fa4837487bfee1421c0a25d8000ae86dbcb132d0 Mon Sep 17 00:00:00 2001 From: wuyanwen Date: Fri, 6 Dec 2019 14:44:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=86=E9=A1=B5=E5=93=8D?= =?UTF-8?q?=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/CatchResponse.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/extend/catcher/CatchResponse.php b/extend/catcher/CatchResponse.php index 2323a15..a748d06 100644 --- a/extend/catcher/CatchResponse.php +++ b/extend/catcher/CatchResponse.php @@ -1,6 +1,8 @@ $code, @@ -21,6 +23,24 @@ class CatchResponse ]); } + /** + * 分页 + * + * @time 2019年12月06日 + * @param Paginator $list + * @return \think\response\Json + */ + public static function paginate(Paginator $list): \think\response\Json + { + return json([ + 'code' => 10000, + 'msg' => 'success', + 'count' => $list->total(), + 'current' => $list->currentPage(), + 'data' => $list->getCollection(), + ]); + } + /** * 错误的响应 *