From f70e1f3349b4c0b6afab65aa4073ba81aaa75768 Mon Sep 17 00:00:00 2001 From: Karson <karsonzhang@163.com> Date: Sat, 12 Sep 2020 16:41:04 +0800 Subject: [PATCH] 优化后台回收站列表逻辑 --- application/admin/library/traits/Backend.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/application/admin/library/traits/Backend.php b/application/admin/library/traits/Backend.php index 538a1d2..f81f62f 100755 --- a/application/admin/library/traits/Backend.php +++ b/application/admin/library/traits/Backend.php @@ -72,20 +72,14 @@ trait Backend $this->request->filter(['strip_tags', 'trim']); if ($this->request->isAjax()) { list($where, $sort, $order, $offset, $limit) = $this->buildparams(); - $total = $this->model - ->onlyTrashed() - ->where($where) - ->order($sort, $order) - ->count(); $list = $this->model ->onlyTrashed() ->where($where) ->order($sort, $order) - ->limit($offset, $limit) - ->select(); + ->paginate($limit); - $result = array("total" => $total, "rows" => $list); + $result = array("total" => $list->total(), "rows" => $list->items()); return json($result); } -- libgit2 0.24.0