mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
Merge branch 'master' of https://github.com/top-think/framework
This commit is contained in:
@@ -34,6 +34,7 @@ use think\paginator\Collection as PaginatorCollection;
|
|||||||
* @method static integer avg($field = '*') AVG查询
|
* @method static integer avg($field = '*') AVG查询
|
||||||
* @method static setField($field, $value = '')
|
* @method static setField($field, $value = '')
|
||||||
* @method static Query where($field, $op = null, $condition = null) 指定AND查询条件
|
* @method static Query where($field, $op = null, $condition = null) 指定AND查询条件
|
||||||
|
* @method static static findOrFail($data = null) 查找单条记录 如果不存在则抛出异常
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
abstract class Model implements \JsonSerializable, \ArrayAccess
|
abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||||
|
|||||||
@@ -66,23 +66,23 @@ class Bootstrap extends Paginator
|
|||||||
'last' => null
|
'last' => null
|
||||||
];
|
];
|
||||||
|
|
||||||
$length = 3;
|
$side = 3;
|
||||||
|
$window = $side * 2;
|
||||||
|
|
||||||
if ($this->lastPage < $length * 4) {
|
if ($this->lastPage < $window + 6) {
|
||||||
$block['first'] = $this->getUrlRange(1, $this->lastPage);
|
$block['first'] = $this->getUrlRange(1, $this->lastPage);
|
||||||
} elseif ($this->currentPage <= $length * 2) {
|
} elseif ($this->currentPage <= $window) {
|
||||||
$block['first'] = $this->getUrlRange(1, $length * 2 + 2);
|
$block['first'] = $this->getUrlRange(1, $window + 2);
|
||||||
$block['last'] = $this->getUrlRange($this->lastPage - 1, $this->lastPage);
|
$block['last'] = $this->getUrlRange($this->lastPage - 1, $this->lastPage);
|
||||||
} elseif ($this->currentPage > ($this->lastPage - $length * 2)) {
|
} elseif ($this->currentPage > ($this->lastPage - $window)) {
|
||||||
$block['first'] = $this->getUrlRange(1, 2);
|
$block['first'] = $this->getUrlRange(1, 2);
|
||||||
$block['last'] = $this->getUrlRange($this->lastPage - $length * 2 + 2, $this->lastPage);
|
$block['last'] = $this->getUrlRange($this->lastPage - ($window + 2), $this->lastPage);
|
||||||
} else {
|
} else {
|
||||||
$block['first'] = $this->getUrlRange(1, 2);
|
$block['first'] = $this->getUrlRange(1, 2);
|
||||||
$block['slider'] = $this->getUrlRange($this->currentPage - $length, $this->currentPage + $length);
|
$block['slider'] = $this->getUrlRange($this->currentPage - $side, $this->currentPage + $side);
|
||||||
$block['last'] = $this->getUrlRange($this->lastPage - 1, $this->lastPage);
|
$block['last'] = $this->getUrlRange($this->lastPage - 1, $this->lastPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$html = '';
|
$html = '';
|
||||||
|
|
||||||
if (is_array($block['first'])) {
|
if (is_array($block['first'])) {
|
||||||
@@ -132,7 +132,7 @@ class Bootstrap extends Paginator
|
|||||||
* 生成一个可点击的按钮
|
* 生成一个可点击的按钮
|
||||||
*
|
*
|
||||||
* @param string $url
|
* @param string $url
|
||||||
* @param int $page
|
* @param int $page
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getAvailablePageWrapper($url, $page)
|
protected function getAvailablePageWrapper($url, $page)
|
||||||
@@ -193,7 +193,7 @@ class Bootstrap extends Paginator
|
|||||||
* 生成普通页码按钮
|
* 生成普通页码按钮
|
||||||
*
|
*
|
||||||
* @param string $url
|
* @param string $url
|
||||||
* @param int $page
|
* @param int $page
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getPageLinkWrapper($url, $page)
|
protected function getPageLinkWrapper($url, $page)
|
||||||
|
|||||||
Reference in New Issue
Block a user