ComposerUpdate

This commit is contained in:
Anyon 2019-12-23 18:35:19 +08:00
parent dcfc8a6bf0
commit 9890c4891f
4 changed files with 26 additions and 22 deletions

8
composer.lock generated
View File

@ -909,12 +909,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "bc592ee0fba92938ec97f327cbbd119e0ff14288" "reference": "60807fa6416e2b9d30ee785d37c0e90f4eab5ea2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/bc592ee0fba92938ec97f327cbbd119e0ff14288", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/60807fa6416e2b9d30ee785d37c0e90f4eab5ea2",
"reference": "bc592ee0fba92938ec97f327cbbd119e0ff14288", "reference": "60807fa6416e2b9d30ee785d37c0e90f4eab5ea2",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -958,7 +958,7 @@
], ],
"description": "ThinkPHP v6.0 Development Library", "description": "ThinkPHP v6.0 Development Library",
"homepage": "http://framework.thinkadmin.top", "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", "name": "zoujingli/wechat-developer",

View File

@ -935,12 +935,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "bc592ee0fba92938ec97f327cbbd119e0ff14288" "reference": "60807fa6416e2b9d30ee785d37c0e90f4eab5ea2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/bc592ee0fba92938ec97f327cbbd119e0ff14288", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/60807fa6416e2b9d30ee785d37c0e90f4eab5ea2",
"reference": "bc592ee0fba92938ec97f327cbbd119e0ff14288", "reference": "60807fa6416e2b9d30ee785d37c0e90f4eab5ea2",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -956,7 +956,7 @@
"ext-json": "*", "ext-json": "*",
"topthink/framework": "^6.0" "topthink/framework": "^6.0"
}, },
"time": "2019-12-23T06:45:36+00:00", "time": "2019-12-23T09:51:18+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"think": { "think": {

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2019-12-23 15:23:32 // This file is automatically generated at:2019-12-23 18:34:59
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\app\\Service', 0 => 'think\\app\\Service',

View File

@ -75,9 +75,10 @@ class PageHelper extends Helper
$sort = intval(isset($post['sort']) ? $post['sort'] : 0); $sort = intval(isset($post['sort']) ? $post['sort'] : 0);
unset($post['action'], $post['sort']); unset($post['action'], $post['sort']);
if ($this->app->db->table($this->query->getTable())->where($post)->update(['sort' => $sort]) !== false) { 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 字段排序 // 未配置 order 规则时自动按 sort 字段排序
if (!$this->query->getOptions('order') && method_exists($this->query, 'getTableFields')) { if (!$this->query->getOptions('order') && method_exists($this->query, 'getTableFields')) {
@ -86,26 +87,28 @@ class PageHelper extends Helper
// 列表分页及结果集处理 // 列表分页及结果集处理
if ($this->page) { if ($this->page) {
// 分页每页显示记录数 // 分页每页显示记录数
$limit = intval($this->app->request->get('limit', cookie('page-limit'))); if ($this->limit > 0) {
cookie('page-limit', $limit = $limit >= 10 ? $limit : 20); $limit = intval($this->limit);
if ($this->limit > 0) $limit = $this->limit; } else {
list($options, $query) = [[], $this->app->request->get()]; $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); $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) { 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) { if (stripos($this->app->request->get('spm', '-'), 'm-') === 0) {
$url = url('@admin') . '#' . $this->app->request->baseUrl() . '?' . urldecode(http_build_query($query)); $url = url('@admin') . '#' . $this->app->request->baseUrl() . '?' . urldecode(http_build_query($query));
} else { } else {
$url = $this->app->request->baseUrl() . '?' . urldecode(http_build_query($query)); $url = $this->app->request->baseUrl() . '?' . urldecode(http_build_query($query));
} }
array_push($options, "<option data-num='{$num}' value='{$url}' {$selected}>{$num}</option>"); $select .= "<option data-num='{$num}' value='{$url}' {$selected}>{$num}</option>";
} }
$select = "<select onchange='location.href=this.options[this.selectedIndex].value' data-auto-none>" . join('', $options) . "</select>"; $pagehtml = "<div class='pagination-container nowrap'><span>共 {$paginate->total()} 条记录,每页显示 <select onchange='location.href=this.options[this.selectedIndex].value' data-auto-none>{$select}</select> 条,共 {$paginate->lastPage()} 页当前显示第 {$paginate->currentPage()} 页。</span>{$paginate->render()}</div>";
$html = "<div class='pagination-container nowrap'><span>共 {$paginate->total()} 条记录,每页显示 {$select} 条,共 {$paginate->lastPage()} 页当前显示第 {$paginate->currentPage()} 页。</span>{$paginate->render()}</div>";
if (stripos($this->app->request->get('spm', '-'), 'm-') === 0) { 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 { } 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()]; $result = ['page' => ['limit' => intval($limit), 'total' => intval($paginate->total()), 'pages' => intval($paginate->lastPage()), 'current' => intval($paginate->currentPage())], 'list' => $paginate->items()];
} else { } else {
@ -113,8 +116,9 @@ class PageHelper extends Helper
} }
if (false !== $this->controller->callback('_page_filter', $result['list']) && $this->display) { if (false !== $this->controller->callback('_page_filter', $result['list']) && $this->display) {
return $this->controller->fetch('', $result); return $this->controller->fetch('', $result);
} else {
return $result;
} }
return $result;
} }
} }