src/Service/DB/Select.php
public function getPageInfo($current, $size, $total = null)
    {
        if ($total === null) {
            $limit = $this->limit;
            $offset = $this->offset;
            $order_by = $this->order_by;

            $this->order_by = [];
            $this->limit = 0;
            $this->offset = 0;

            $total = $this->count();

            $this->order_by = $order_by;
            $this->limit = $limit;
            $this->offset = $offset;
        }

        return self::buildPageInfo($total, $size, $current);
    }
public function getPageInfo($current, $size, $total = null)
    {
        if ($total === null) {
            $limit = $this->limit;
            $offset = $this->offset;
            $order_by = $this->order_by;

            $this->order_by = [];
            $this->limit = 0;
            $this->offset = 0;

            $total = $this->count();

            $this->order_by = $order_by;
            $this->limit = $limit;
            $this->offset = $offset;
        }

        return self::buildPageInfo($total, $size, $current);
    }
查询数据库数量，计算分页信息.

@param int $current 当前页
@param int $size    每页多少条
@param int [$total]  一共有多少条，不指定就到数据库内查询

@return
array(
'total' => (integer),       // 一共有多少条数据
'size' => (integer),        // 每页多少条
'from' => (integer),        // 本页开始的序号
'to' => (integer),          // 本页结束的序号
'first' => 1,               // 第一页
'prev' => (integer|null),   // 上一页，null说明没有上一页
'current' => (integer),     // 本页页码
'next' => (integer|null),   // 下一页，null说明没有下一页
'last' => (integer),        // 最后一页
)