From 94e74c8eb3fb9a9091461d4372178f0b592c29fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 14 Sep 2020 11:05:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/Pagination.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Database/Pagination.php b/Database/Pagination.php index fc5e8705..6080d57e 100644 --- a/Database/Pagination.php +++ b/Database/Pagination.php @@ -35,6 +35,9 @@ class Pagination extends Component /** @var Closure */ private $_callback; + /** @var Coroutine\Channel */ + private $_channel; + /** * PaginationIteration constructor. * @param ActiveQuery $activeQuery @@ -44,6 +47,7 @@ class Pagination extends Component { parent::__construct($config); $this->activeQuery = $activeQuery; +// $this->_channel = new Coroutine\Channel(); } @@ -106,11 +110,12 @@ class Pagination extends Component /** * @param array $param + * @return array */ public function plunk($param = []) { if ($this->_max > 0 && $this->_length >= $this->_max) { - return; + return $this->output(); } [$length, $data] = $this->get(); @@ -118,9 +123,22 @@ class Pagination extends Component unset($data); if ($length < $this->_limit) { - return; + return $this->output(); } - $this->plunk($param); + return $this->plunk($param); + } + + + /** + * @return array + */ + public function output() + { + // while ($this->_channel->length() > 0) { +// $array[] = $this->_channel->pop(); +// } +// $this->_channel->close(); + return []; }