Browse Source

更新 'application/admin/controller/Index.php'

Me 5 years ago
parent
commit
49304c214c
1 changed files with 3 additions and 24 deletions
  1. 3 24
      application/admin/controller/Index.php

+ 3 - 24
application/admin/controller/Index.php

@@ -60,34 +60,12 @@ class Index extends Base
 
     	$user = new IndexModel();
         $uname = request()->param('uname');//接收请求数据id
+        $where='1=1';
         if(!empty($uname)){//不为空执行搜索条件,为空则跳过判断条件直接显示列表页,
             $where = ['uname'=>$uname];
-
-            //数据表获取总记录数           
-            $count = $user->where($where)->count();
-            //获取每页显示的条数
-            $limit= $request->param('limit');
-            //获取当前页码
-            $page= $request->param('page');
-            //limit的起始位置
-            $start=($page-1)*$limit;
-            // 查询出当前页数显示的数据
-            $list = $user
-                ->limit("$start,$limit")
-                ->where($where)
-                ->select(); 
-            // dump($list);die;
-            foreach($list as $k=>$v){   /*循环时间戳转时间格式*/
-                $list[$k]['last_login_time'] = date('Y-m-d H:i:s',$v['last_login_time']);
-            }    
-           
-            //返回数据
-            return ["code"=>0,"msg"=>"成功","count"=>$count,"data"=>$list];
-
         }
-
         //数据表获取总记录数
-        $count = $user->count();
+        $count = $user->where($where)->count();
         //获取每页显示的条数
         $limit= $request->param('limit');
         //获取当前页码
@@ -97,6 +75,7 @@ class Index extends Base
         // 查询出当前页数显示的数据
         $list = $user//关联查询
                 ->limit("$start,$limit")
+                ->where($where)
                 ->select();
         foreach($list as $k=>$v){   /*循环时间戳转时间格式*/
             $list[$k]['last_login_time'] = date('Y-m-d H:i:s',$v['last_login_time']);