function actionModgroup() { $type = $this->_context->type; $name = $this->_context->get('name'); $page = (int) $this->_context->get('page', 1); if ($deleteid = $this->_context->deleteid) { if ($type == 'check') { Radgroupcheck::meta()->deleteWhere('id = ?', $deleteid); } else { Radgroupreply::meta()->deleteWhere('id = ?', $deleteid); } return $this->msg($tip = '删除成功', url('manage::radius/index')); } if ($this->_context->isPost()) { $post = $this->_context->post(); $orm = $type == 'check' ? Radgroupcheck::find() : Radgroupreply::find(); if (isset($post['id'])) { $orm->where('id = ?', (int) $post['id']); $orm = $orm->getOne(); unset($post['type'], $post['id']); $orm->changeProps($post); $orm->save(); return $this->msg($tip = '修改成功', url('manage::radius/modgroup', array('type' => $type, 'name' => $post['groupname']))); } else { $orm->where('id = ?', 0); $orm = $orm->getOne(); unset($post['type']); $orm->changeProps($post); $orm->save(); return $this->msg($tip = '添加成功', url('manage::radius/modgroup', array('type' => $type, 'name' => $post['groupname']))); } } $rs = $type == 'check' ? Radgroupcheck::find() : Radgroupreply::find(); $rs->where('groupname = ?', $name); $rs->limitPage($page, 20); $this->_view['rs'] = $rs->getAll(); $this->_view['pg'] = $rs->getPag(); $this->_view['tg'] = $type == 'check' ? 'Radgroup Check' : 'Radgroup Reply'; $this->_view['type'] = $type == 'check' ? 'check' : 'reply'; $this->_view['_UDI'] = 'manage::radius/index'; }