public function rolelists() { $page = isset($_POST['page']) ? intval($_POST['page']) : 1; $rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10; $usermodel = new usermodel("admin_role"); $result["total"] = $usermodel->count(); $offset = $rows * ($page - 1); $data = $usermodel->excute("select roleid,rolename,description,disabled from admin_role\n order by roleid desc limit {$offset},{$rows} "); foreach ($data as $key => $row) { if ($data[$key]['disabled'] == '1') { $data[$key]['disabled'] = '正常'; } else { $data[$key]['disabled'] = '禁用'; } } $result['rows'] = $data; $this->ajaxReturn($result); }
public function userlists() { $page = isset($_POST['page']) ? intval($_POST['page']) : 1; $rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10; if (isset($_GET['roleid'])) { $roleid = intval($_GET['roleid']); $where = " where admin_role.roleid = {$roleid}"; } else { $where = ''; } $usermodel = new usermodel("admin_user"); $result["total"] = $usermodel->count(); $offset = $rows * ($page - 1); $data = $usermodel->excute("select userid,username,email,status,regip,rolename,admin_role.roleid from admin_user join admin_role on admin_user.roleid = admin_role.roleid {$where} order by userid desc limit {$offset},{$rows} "); foreach ($data as $key => $row) { if ($data[$key]['status'] == '1') { $data[$key]['status'] = '正常'; } else { $data[$key]['status'] = '禁用'; } } $result['rows'] = $data; $this->ajaxReturn($result); }