Browse Source

新的autopage

lizhen_gitee 3 months ago
parent
commit
0a20102608
1 changed files with 5 additions and 4 deletions
  1. 5 4
      thinkphp/library/think/db/Query.php

+ 5 - 4
thinkphp/library/think/db/Query.php

@@ -1440,17 +1440,18 @@ class Query
         $config = Config::get('paginate');
 
         /** @var Paginator $class */
-        $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\paginator\\driver\\' . ucwords($config['type']);
+        /*$class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\paginator\\driver\\' . ucwords($config['type']);
         $page  = isset($config['page']) ? (int) $config['page'] : call_user_func([
             $class,
             'getCurrentPage',
-        ], $config['var_page']);
+        ], $config['var_page']);*/
 
+        $page = input('page',1);
         $page = $page < 1 ? 1 : $page;
 
         //list_rows
-        $listRows = isset($_REQUEST['listrow']) ? (int)$_REQUEST['listrow'] : $config['list_rows'];
-
+//        $listRows = isset($_REQUEST['listrow']) ? (int)$_REQUEST['listrow'] : $config['list_rows'];
+        $listRows = input('listrow',$config['list_rows']);
 
         $this->options['page'] = [intval($page), intval($listRows)];
         return $this;