Explorar o código

model paginate info

superbee315 %!s(int64=5) %!d(string=hai) anos
pai
achega
5bdbad4a9a

+ 6 - 3
application/user/model/Admin.php

@@ -58,10 +58,13 @@ class Admin extends Model{
 	 * @param array $where 查询条件
 	 */
 	public function getPage($where = array()){
-		$total = $this->db()->count();
-		$paginate = $this->db()->where($where)->paginate(config('paginate.list_rows'), $total);
+		$query = getPaginatiorQuery();
+		$total = $this->db()->where($where)->count();
+		// 查询条件
+		$config = ['query'=>$query];
+		$paginate = $this->db()->where($where)->paginate(config('paginate.list_rows'), $total, $config);
 		
-		return $paginate->render(); 
+		return $paginate->render();
 	}
 	
 	/**

+ 1 - 1
application/user/model/Notice.php

@@ -30,7 +30,7 @@ class Notice extends Model{
 	 * @param array $where 查询条件
 	 */
 	public function getPage($where = array()){
-		$total = $this->db()->count();
+		$total = $this->db()->where($where)->count();
 		$paginate = $this->db()->where($where)->paginate(config('paginate.list_rows'), $total);
 		
 		return $paginate->render();

+ 6 - 3
application/user/model/User.php

@@ -56,9 +56,12 @@ class User extends Model{
 	 * @param array $where 查询条件
 	 */
 	public function getPage($where = array()){
-		$total = $this->db()->count();
-		$paginate = $this->db()->where($where)->paginate(config('paginate.list_rows'), $total);
-	
+		$query = getPaginatiorQuery();
+		$total = $this->db()->where($where)->count();
+		// 查询条件
+		$config = ['query'=>$query];
+		$paginate = $this->db()->where($where)->paginate(config('paginate.list_rows'), $total, $config);
+		
 		return $paginate->render();
 	}