adminModel = new \app\user\model\Admin(); } public function index(){ $p = $this->request->get('page', 0); $nick = $this->request->get('n'); $where = []; if($nick) $where['nickname'] = ['like', "%$nick%"]; $info = $this->adminModel->getInfo($p, $where); $page = $this->adminModel->getPage($where); $this->assign("info", $info); $this->assign("page", $page); return $this->fetch(); } public function edit(){ $id = $this->request->get('id'); $info = $this->adminModel->getAdminById($id); $this->assign("info", $info); return $this->fetch('edit'); } public function reset(){ $id = $this->request->get('id'); $this->assign("id", $id); return $this->fetch('reset'); } public function pass(){ $res = $this->adminModel->resetPwd(); if(is_int($res)){ $this->success('更改成功!', 'index'); }else{ $this->error('更改失败!'.$res); } } public function group(){ $id = $this->request->get('id'); $admin = $this->adminModel->getAdminById($id); $role = new Role(); $info = $role->getAllRole(); $rule = new RoleRule(); $array = $rule->getRidByAid($id); $this->assign('array', $array); $this->assign('admin', $admin); $this->assign('info', $info); return $this->fetch(); } public function rule(){ $info = new RoleRule(); $info->addAndSave(); $this->success('保存成功!', 'index'); } public function delete(){ $res = $this->adminModel->remove(); if($res){ $this->success('删除成功!', 'index'); }else{ $this->error('删除失败!'); } } public function save(){ $res = $this->adminModel->addAndSave(); if($res){ $this->success('保存成功!', 'index'); }else{ $this->error('保存失败!'); } } }