Browse Source

修复autopage获取不到json参数问题

Panda 2 months ago
parent
commit
fc47c78bbc
1 changed files with 2 additions and 1 deletions
  1. 2 1
      thinkphp/library/think/db/Query.php

+ 2 - 1
thinkphp/library/think/db/Query.php

@@ -1438,6 +1438,7 @@ class Query
     //模仿上一个page,但是从paginate拿到page与list_rows
     public function autopage(){
         $config = Config::get('paginate');
+        $params = request()->param();
 
         /** @var Paginator $class */
         $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\paginator\\driver\\' . ucwords($config['type']);
@@ -1449,7 +1450,7 @@ class Query
         $page = $page < 1 ? 1 : $page;
 
         //list_rows
-        $listRows = isset($_REQUEST['list_rows']) ? (int)$_REQUEST['list_rows'] : $config['list_rows'];
+        $listRows = isset($params['list_rows']) ? (int)$params['list_rows'] : $config['list_rows'];
 
 
         $this->options['page'] = [intval($page), intval($listRows)];