用户查询
This commit is contained in:
@@ -16,12 +16,13 @@ class User extends Controller
|
|||||||
if (isset($_GET['PageIndex'])) {
|
if (isset($_GET['PageIndex'])) {
|
||||||
$page = ($_GET['PageIndex'] - 1) * 50;
|
$page = ($_GET['PageIndex'] - 1) * 50;
|
||||||
}
|
}
|
||||||
$where = [];
|
$where = '';
|
||||||
if(!empty($_GET['keyWord'])){
|
if(!empty($_GET['keyWord'])){
|
||||||
$where['LoginCode'] = ['like','%'.$_GET['keyWord'].'%'];
|
|
||||||
|
$where = "LoginCode like '%".$_GET['keyWord']."%' or Phone like '%".$_GET['keyWord']."%'";
|
||||||
}
|
}
|
||||||
$user_model = new UserModel;
|
$user_model = new UserModel;
|
||||||
$user_list = $user_model->getListPage($where, '*', 'id desc', "$page,50");
|
$user_list = $user_model->getUserListPage($where, '*', 'id desc', "$page,50");
|
||||||
|
|
||||||
foreach ($user_list as &$info){
|
foreach ($user_list as &$info){
|
||||||
$info['Password'] = '';
|
$info['Password'] = '';
|
||||||
@@ -43,7 +44,7 @@ class User extends Controller
|
|||||||
'Code' => 10000,
|
'Code' => 10000,
|
||||||
'Data' => $user_list,
|
'Data' => $user_list,
|
||||||
'Message' => '',
|
'Message' => '',
|
||||||
'TotalCount' => (int)$user_model->getCount()['count'],
|
'TotalCount' => (int)$user_model->getCount($where)['count'],
|
||||||
];
|
];
|
||||||
echo json_encode($data);
|
echo json_encode($data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,4 +19,9 @@ class User extends Model
|
|||||||
{
|
{
|
||||||
return $this->field($fields)->where($where)->fetch();
|
return $this->field($fields)->where($where)->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getUserListPage($where = '', $fields = '*', $order = 'id desc', $limit = '50')
|
||||||
|
{
|
||||||
|
return $this->field($fields)->where($where)->order($order)->limit($limit)->fetchAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user