This commit is contained in:
2021-07-02 15:14:10 +08:00
parent f8a28967d5
commit 6f0e423773
+1 -3
View File
@@ -7,8 +7,6 @@ namespace Database;
use Closure; use Closure;
use Exception; use Exception;
use Snowflake\Abstracts\Component; use Snowflake\Abstracts\Component;
use Snowflake\Event;
use Swoole\Coroutine;
/** /**
* Class Pagination * Class Pagination
@@ -190,7 +188,7 @@ class Pagination extends Component
*/ */
private function get(): Collection|array private function get(): Collection|array
{ {
if ($this->_length + $this->_limit > $this->_max) { if ($this->_max > 0 && $this->_length + $this->_limit > $this->_max) {
$this->_limit = $this->_length + $this->_limit - $this->_max; $this->_limit = $this->_length + $this->_limit - $this->_max;
} }
$data = $this->activeQuery->limit($this->_offset, $this->_limit)->get(); $data = $this->activeQuery->limit($this->_offset, $this->_limit)->get();