改名
This commit is contained in:
@@ -172,20 +172,18 @@ class ActiveQuery extends Component
|
||||
|
||||
/**
|
||||
* @param int $size
|
||||
* @param callable $callback
|
||||
* @param mixed $param
|
||||
* @param int $offset
|
||||
* @param int $total
|
||||
* @param callable $callback
|
||||
* @return Pagination
|
||||
* @throws Exception
|
||||
*/
|
||||
public function plunk(int $size, callable $callback, $param = null, $offset = 0, $total = -1)
|
||||
public function plunk(int $size, int $offset, callable $callback)
|
||||
{
|
||||
$pagination = new Pagination($this);
|
||||
$pagination->setOffset($offset);
|
||||
$pagination->setLimit($size);
|
||||
$pagination->setMax($total);
|
||||
$pagination->setCallback($callback);
|
||||
$pagination->search($param);
|
||||
return $pagination;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -99,12 +99,12 @@ class Pagination extends Component
|
||||
/**
|
||||
* @param array $param
|
||||
*/
|
||||
public function search($param = [])
|
||||
public function plunk($param = [])
|
||||
{
|
||||
if ($this->_length >= $this->_max) {
|
||||
return;
|
||||
}
|
||||
[$length, $data] = $this->load();
|
||||
[$length, $data] = $this->get();
|
||||
if ($param !== null) {
|
||||
call_user_func($this->_callback, $data, $param);
|
||||
} else {
|
||||
@@ -114,14 +114,14 @@ class Pagination extends Component
|
||||
if ($length < $this->_limit) {
|
||||
return;
|
||||
}
|
||||
$this->search($param);
|
||||
$this->plunk($param);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array|Collection
|
||||
*/
|
||||
private function load()
|
||||
private function get()
|
||||
{
|
||||
if ($this->_length + $this->_limit > $this->_max) {
|
||||
$this->_limit = $this->_length + $this->_limit - $this->_max;
|
||||
|
||||
Reference in New Issue
Block a user