1
This commit is contained in:
+3
-2
@@ -87,7 +87,7 @@ class ActiveQuery extends Component implements ISqlBuilder
|
|||||||
* @return array
|
* @return array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
#[ArrayShape(['code' => "int", 'size' => "mixed", 'page' => "mixed", 'count' => "int", 'next' => "mixed", 'prev' => "mixed", 'params' => "array"])]
|
#[ArrayShape(['code' => "int", 'message' => "string", 'size' => "mixed", 'page' => "mixed", 'count' => "int", 'next' => "mixed", 'prev' => "mixed", 'param' => "array"])]
|
||||||
public function pagination(int $size = 20, int $page = 1): array
|
public function pagination(int $size = 20, int $page = 1): array
|
||||||
{
|
{
|
||||||
$page = max(1, $page);
|
$page = max(1, $page);
|
||||||
@@ -99,12 +99,13 @@ class ActiveQuery extends Component implements ISqlBuilder
|
|||||||
$lists = $this->limit($offset, $size)->get()->toArray();
|
$lists = $this->limit($offset, $size)->get()->toArray();
|
||||||
return [
|
return [
|
||||||
'code' => 0,
|
'code' => 0,
|
||||||
|
'message' => 'ok',
|
||||||
'size' => $size,
|
'size' => $size,
|
||||||
'page' => $page,
|
'page' => $page,
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
'next' => max($page + 1, 1),
|
'next' => max($page + 1, 1),
|
||||||
'prev' => max($page - 1, 1),
|
'prev' => max($page - 1, 1),
|
||||||
'params' => $lists,
|
'param' => $lists,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user