diff --git a/composer.lock b/composer.lock index 0aa0fff53..daf37705b 100644 --- a/composer.lock +++ b/composer.lock @@ -909,12 +909,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "bc592ee0fba92938ec97f327cbbd119e0ff14288" + "reference": "60807fa6416e2b9d30ee785d37c0e90f4eab5ea2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/bc592ee0fba92938ec97f327cbbd119e0ff14288", - "reference": "bc592ee0fba92938ec97f327cbbd119e0ff14288", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/60807fa6416e2b9d30ee785d37c0e90f4eab5ea2", + "reference": "60807fa6416e2b9d30ee785d37c0e90f4eab5ea2", "shasum": "", "mirrors": [ { @@ -958,7 +958,7 @@ ], "description": "ThinkPHP v6.0 Development Library", "homepage": "http://framework.thinkadmin.top", - "time": "2019-12-23T06:45:36+00:00" + "time": "2019-12-23T09:51:18+00:00" }, { "name": "zoujingli/wechat-developer", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 11fb534d3..f678ddc1c 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -935,12 +935,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "bc592ee0fba92938ec97f327cbbd119e0ff14288" + "reference": "60807fa6416e2b9d30ee785d37c0e90f4eab5ea2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/bc592ee0fba92938ec97f327cbbd119e0ff14288", - "reference": "bc592ee0fba92938ec97f327cbbd119e0ff14288", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/60807fa6416e2b9d30ee785d37c0e90f4eab5ea2", + "reference": "60807fa6416e2b9d30ee785d37c0e90f4eab5ea2", "shasum": "", "mirrors": [ { @@ -956,7 +956,7 @@ "ext-json": "*", "topthink/framework": "^6.0" }, - "time": "2019-12-23T06:45:36+00:00", + "time": "2019-12-23T09:51:18+00:00", "type": "library", "extra": { "think": { diff --git a/vendor/services.php b/vendor/services.php index eb3628f3c..b4b60449b 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\app\\Service', diff --git a/vendor/zoujingli/think-library/src/helper/PageHelper.php b/vendor/zoujingli/think-library/src/helper/PageHelper.php index 4c8edc6e7..8bd6acf95 100644 --- a/vendor/zoujingli/think-library/src/helper/PageHelper.php +++ b/vendor/zoujingli/think-library/src/helper/PageHelper.php @@ -75,9 +75,10 @@ class PageHelper extends Helper $sort = intval(isset($post['sort']) ? $post['sort'] : 0); unset($post['action'], $post['sort']); if ($this->app->db->table($this->query->getTable())->where($post)->update(['sort' => $sort]) !== false) { - return $this->controller->success('排序参数修改成功!', ''); + return $this->controller->success('列表排序修改成功!', ''); + } else { + return $this->controller->error('列表排序修改失败,请稍候再试!'); } - return $this->controller->error('排序参数修改失败,请稍候再试!'); } // 未配置 order 规则时自动按 sort 字段排序 if (!$this->query->getOptions('order') && method_exists($this->query, 'getTableFields')) { @@ -86,26 +87,28 @@ class PageHelper extends Helper // 列表分页及结果集处理 if ($this->page) { // 分页每页显示记录数 - $limit = intval($this->app->request->get('limit', cookie('page-limit'))); - cookie('page-limit', $limit = $limit >= 10 ? $limit : 20); - if ($this->limit > 0) $limit = $this->limit; - list($options, $query) = [[], $this->app->request->get()]; + if ($this->limit > 0) { + $limit = intval($this->limit); + } else { + $limit = $this->app->request->get('limit', $this->app->cookie->get('limit')); + $this->app->cookie->set('limit', $limit = intval($limit >= 10 ? $limit : 20)); + } + list($select, $query) = ['', $this->app->request->get()]; $paginate = $this->query->paginate(['list_rows' => $limit, 'query' => $query], $this->total); foreach ([10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200] as $num) { - list($query['limit'], $query['page'], $selected) = [$num, '1', $limit === $num ? 'selected' : '']; + list($query['limit'], $query['page'], $selected) = [$num, 1, $limit === $num ? 'selected' : '']; if (stripos($this->app->request->get('spm', '-'), 'm-') === 0) { $url = url('@admin') . '#' . $this->app->request->baseUrl() . '?' . urldecode(http_build_query($query)); } else { $url = $this->app->request->baseUrl() . '?' . urldecode(http_build_query($query)); } - array_push($options, ""); + $select .= ""; } - $select = ""; - $html = "
共 {$paginate->total()} 条记录,每页显示 {$select} 条,共 {$paginate->lastPage()} 页当前显示第 {$paginate->currentPage()} 页。{$paginate->render()}
"; + $pagehtml = "
共 {$paginate->total()} 条记录,每页显示 条,共 {$paginate->lastPage()} 页当前显示第 {$paginate->currentPage()} 页。{$paginate->render()}
"; if (stripos($this->app->request->get('spm', '-'), 'm-') === 0) { - $this->controller->assign('pagehtml', preg_replace('|href="(.*?)"|', 'data-open="$1" onclick="return false" href="$1"', $html)); + $this->controller->assign('pagehtml', preg_replace('|href="(.*?)"|', 'data-open="$1" onclick="return false" href="$1"', $pagehtml)); } else { - $this->controller->assign('pagehtml', $html); + $this->controller->assign('pagehtml', $pagehtml); } $result = ['page' => ['limit' => intval($limit), 'total' => intval($paginate->total()), 'pages' => intval($paginate->lastPage()), 'current' => intval($paginate->currentPage())], 'list' => $paginate->items()]; } else { @@ -113,8 +116,9 @@ class PageHelper extends Helper } if (false !== $this->controller->callback('_page_filter', $result['list']) && $this->display) { return $this->controller->fetch('', $result); + } else { + return $result; } - return $result; } }