From 709dbd844b7ccad5329739116abcb90e497110dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Wed, 29 Mar 2017 19:02:47 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E7=94=A8=E6=88=B7=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=90=9C=E7=B4=A2demo=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/User.php | 14 +++++++++++--- application/admin/view/user.index.html | 8 +++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/application/admin/controller/User.php b/application/admin/controller/User.php index 0f1f2e9e7..e6d4b4d22 100644 --- a/application/admin/controller/User.php +++ b/application/admin/controller/User.php @@ -37,12 +37,20 @@ class User extends BasicAdmin { * 用户列表 */ public function index() { + // 设置页面标题 $this->title = '系统用户管理'; + // 获取到所有GET参数 + $get = $this->request->get(); + // 实例Query对象 $db = Db::name($this->table)->where('is_deleted', '0'); - - if ($this->request->get('username')) { - $db->where('username', 'like', '%' . $this->request->get('username') . '%'); + // 应用搜索条件 + if (isset($get['username']) && $get['username'] !== '') { + $db->where('username', 'like', "%{$get['username']}%"); } + if (isset($get['phone'] && $get['phone'] !== '')) { + $db->where('phone', 'like', "%{$get['phone']}%"); + } + // 实例化并显示 parent::_list($db); } diff --git a/application/admin/view/user.index.html b/application/admin/view/user.index.html index 8fa243101..31d91e6c2 100644 --- a/application/admin/view/user.index.html +++ b/application/admin/view/user.index.html @@ -24,6 +24,13 @@ +
+
+ +
+
+
@@ -31,7 +38,6 @@
-