|
@@ -5,36 +5,37 @@ class Admin extends Auth
|
|
|
{
|
|
|
public function info()
|
|
|
{
|
|
|
- $this->user['system']['show'] = true;
|
|
|
- $this->user['system']['id'] = $this->user['select']['system_id'];
|
|
|
- $this->user['system']['name'] = '当前系统';
|
|
|
- $this->user['system']['list'] = $this->system();
|
|
|
+ $this->user['module']['show'] = true;
|
|
|
+ $this->user['module']['id'] = $this->user['select']['module_id'];
|
|
|
+ $this->user['module']['name'] = '当前模块';
|
|
|
+ $this->user['module']['list'] = $this->module();
|
|
|
+ $this->user['module']['uri'] = array('system' => $this->system['key'], 'number' => $this->system_info['number']);
|
|
|
return $this->user;
|
|
|
}
|
|
|
|
|
|
- # 获取当前的系统列表
|
|
|
- public function system()
|
|
|
+ # 获取当前的模块列表
|
|
|
+ public function module()
|
|
|
{
|
|
|
$where = array();
|
|
|
- if ($this->user['auth']['system']) {
|
|
|
- $where['id'] = array('in', $this->user['auth']['system']);
|
|
|
+ if ($this->user['auth']['module']) {
|
|
|
+ $where['id'] = array('in', $this->user['auth']['module']);
|
|
|
}
|
|
|
$result = array();
|
|
|
- $system = Dever::db('system', 'manage')->select($where);
|
|
|
+ $module = Dever::db('system_module', 'manage')->select($where);
|
|
|
$i = 0;
|
|
|
- foreach ($system as $k => $v) {
|
|
|
- $child = Dever::db($v['relation_table'])->select([]);
|
|
|
+ foreach ($module as $k => $v) {
|
|
|
+ $child = Dever::db($v['data_table'])->select([]);
|
|
|
if ($child) {
|
|
|
$data = array();
|
|
|
foreach ($child as $k1 => $v1) {
|
|
|
$v1['select'] = false;
|
|
|
- if ($v['id'] == $this->user['select']['system_id'] && $v1['id'] == $this->user['select']['relation_id']) {
|
|
|
- $this->user['system']['name'] = $v1['name'];
|
|
|
+ if ($v['id'] == $this->user['select']['module_id'] && $v1['id'] == $this->user['select']['data_id']) {
|
|
|
+ $this->user['module']['name'] = $v1['name'];
|
|
|
$v1['select'] = true;
|
|
|
}
|
|
|
$key = $v['id'] . '-' . $v1['id'];
|
|
|
- if ($this->user['system_relation']) {
|
|
|
- if (strstr($this->user['system_relation'], $key)) {
|
|
|
+ if ($this->user['module_data']) {
|
|
|
+ if (strstr($this->user['module_data'], $key)) {
|
|
|
$data[] = $v1;
|
|
|
}
|
|
|
} else {
|
|
@@ -49,25 +50,25 @@ class Admin extends Auth
|
|
|
}
|
|
|
}
|
|
|
if ($i <= 1) {
|
|
|
- $this->user['system']['show'] = false;
|
|
|
+ $this->user['module']['show'] = false;
|
|
|
}
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
- # 根据角色获取子系统
|
|
|
- public function getSystem($value = false)
|
|
|
+ # 根据角色获取模块下的数据
|
|
|
+ public function getModuleData($value = false)
|
|
|
{
|
|
|
if (!$value) {
|
|
|
- $result['system_relation']['option'] = array();
|
|
|
+ $result['module_data']['option'] = array();
|
|
|
return $result;
|
|
|
}
|
|
|
$result = array();
|
|
|
- $role = Dever::db('role', 'manage')->select(array('id' => array('in', $value)));
|
|
|
+ $role = Dever::db($this->system['role_table'])->select(array('id' => array('in', $value)));
|
|
|
if ($role) {
|
|
|
- $info = $system = array();
|
|
|
+ $info = $module = array();
|
|
|
foreach ($role as $k => $v) {
|
|
|
- if ($v['system']) {
|
|
|
- $child = Dever::db('system', 'manage')->select(array('id' => array('in', $v['system'])));
|
|
|
+ if ($v['module']) {
|
|
|
+ $child = Dever::db('system_module', 'manage')->select(array('id' => array('in', $v['module'])));
|
|
|
if ($child) {
|
|
|
foreach ($child as $k1 => $v1) {
|
|
|
if (isset($info[$v1['id']])) {
|
|
@@ -77,31 +78,31 @@ class Admin extends Auth
|
|
|
$v1['value'] = 's-' . $v1['id'];
|
|
|
$v1['label'] = $v1['name'];
|
|
|
$v1['children'] = array();
|
|
|
- $data = Dever::db($v1['relation_table'])->select([], array('col' => 'concat('.$v1['id'].', "-", id) as value, name as label'));
|
|
|
+ $data = Dever::db($v1['data_table'])->select([], array('col' => 'concat('.$v1['id'].', "-", id) as value, name as label'));
|
|
|
if ($data) {
|
|
|
$v1['children'] = array_merge($v1['children'], $data);
|
|
|
}
|
|
|
- $system[] = $v1;
|
|
|
+ $module[] = $v1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- $result['system_relation']['option'] = $system;
|
|
|
+ $result['module_data']['option'] = $module;
|
|
|
}
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
- # 切换系统
|
|
|
- public function setSystem()
|
|
|
+ # 切换模块
|
|
|
+ public function setModule()
|
|
|
{
|
|
|
- $system_id = Dever::input('system_id');
|
|
|
- $this->checkSystem($this->user['select']['system_id']);
|
|
|
- $relation_id = Dever::input('relation_id');
|
|
|
- if ($this->user['system_relation'] && !strstr($this->user['system_relation'], $relation_id)) {
|
|
|
- Dever::error('无系统权限');
|
|
|
+ $module_id = Dever::input('module_id');
|
|
|
+ $this->checkModule($this->user['select']['module_id']);
|
|
|
+ $data_id = Dever::input('data_id');
|
|
|
+ if ($this->user['module_data'] && !strstr($this->user['module_data'], $module_id . '-' . $data_id)) {
|
|
|
+ Dever::error('无模块权限');
|
|
|
}
|
|
|
- $result = Dever::load('common')->token($this->user['id'], $this->user['mobile'], $system_id, $relation_id);
|
|
|
+ $result = Dever::load('common')->token($this->user['id'], $this->user['mobile'], $this->user['select']['partition'], $this->user['select']['system_id'], $this->user['select']['info_id'], $module_id, $data_id);
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
@@ -119,7 +120,7 @@ class Admin extends Auth
|
|
|
}
|
|
|
$state = false;
|
|
|
if ($data) {
|
|
|
- $state = Dever::db($this->system['relation_user_table'])->update($this->uid, $data);
|
|
|
+ $state = Dever::db($this->system['user_table'])->update($this->uid, $data);
|
|
|
}
|
|
|
if (!$state) {
|
|
|
Dever::error('修改失败');
|