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(), + ]); + } + /** * 错误的响应 *