$v) { if (!strstr($v, '-')) { if (strstr($v, 'v')) { $menu[] = trim($v, 'v'); } else { $func[] = $v; } $data['auth'][] = $v; } } if ($func) { $funcData = Dever::db('menu_func', 'manage')->select(array('id' => array('in', $func)), array('group' => 'menu_id')); foreach ($funcData as $k => $v) { $menu[] = $v['menu_id']; } $menuData = Dever::db('menu', 'manage')->select(array('id' => array('in', $menu)), array('group' => 'module_id')); foreach ($menuData as $k => $v) { $module[] = $v['module_id']; } } $data['auth'] = implode(',', $data['auth']); $data['menu'] = implode(',', $menu); $data['module'] = implode(',', $module); } return $data; } public function getAuthData() { $result = array(); $extend = Dever::load('common', 'manage')->extend(); if ($extend && $extend['system_id']) { $system_id = $extend['system_id']; } else { $system_id = 1; } $info = Dever::db('system', 'manage')->find($system_id); $where = array(); $where['system'] = $info['key']; $module = Dever::db('system_module', 'manage')->select($where); foreach ($module as $k => $v) { $result[$k]['value'] = 's-' . $v['id']; $result[$k]['label'] = $v['name']; $result[$k]['children'] = Dever::db('menu', 'manage')->tree(array('module_id' => $v['id'], 'show' => array('<', '3')), array('parent_id', '0', 'id'), array($this, 'getAuthInfo'), array('col' => 'id,name as label,parent_id,`key`,func')); } return $result; } public function getAuthInfo($k, $info) { if ($info['func'] == 1) { $info['value'] = 'm-' . $info['id']; $info['children'] = Dever::db('menu_func', 'manage')->select(array('menu_id' => $info['id']), array('col' => 'id as value,name as label')); if (!$info['children']) { return array(); } } else { $info['value'] = 'v' . $info['id']; } return $info; } # 展示系统 public function showSystem($data) { return Dever::db('system', 'manage')->show(array('id' => array('in', $data))); } # 展示系统模块 public function showModule($data) { return Dever::db('system_module', 'manage')->show(array('id' => array('in', $data))); } # 展示菜单 public function showMenu($data) { return Dever::db('menu', 'manage')->show(array('id' => array('in', $data))); } # 展示权限 public function showFunc($data) { return Dever::db('menu_func', 'manage')->show(array('id' => array('in', $data))); } }