diff --git a/Application/Admin/Controller/AuthManagerController.class.php b/Application/Admin/Controller/AuthManagerController.class.php index 878273c98..44c5293c7 100644 --- a/Application/Admin/Controller/AuthManagerController.class.php +++ b/Application/Admin/Controller/AuthManagerController.class.php @@ -455,6 +455,11 @@ class AuthManagerController extends AdminController{ $mid = I('id'); $gid = I('group_id'); $data_empower_type = I('data_empower_type'); + $promoteData = I('promote_data'); + +// dump(json_decode($promoteData,true)); +// var_dump($promoteData);die(); +// str_replace("'valuie'","'id'"); if( empty($gid)||empty($data_empower_type) ){ $this->error('参数有误'); @@ -468,7 +473,13 @@ class AuthManagerController extends AdminController{ $this->error($AuthGroup->error); } - if ($AuthGroup->where("id = {$gid}")->save(array('data_empower_type'=>$data_empower_type))) { + if ($data_empower_type == 2) { + $promoteData = implode(',',array_column(json_decode($promoteData,true),'value')); + } else { + $promoteData = ''; + } + + if ($AuthGroup->where("id = {$gid}")->save(array('data_empower_type'=>$data_empower_type,'data_president'=>$promoteData))) { $this->success('操作成功',U('AuthManager/index')); } else { $this->error('操作失败'); @@ -478,8 +489,11 @@ class AuthManagerController extends AdminController{ function getRootPromote() { $promoteData = M('promote','tab_')->field('id as value,account as title')->where(array('level'=>1,'chain'=>'/'))->select(); + $data_president = M('AuthGroup')->field('data_president')->where(array('id'=>$_REQUEST['group_id']))->find(); + + $returnData = array('data_president'=>$data_president['data_president'],'list'=>$promoteData); - $this->ajaxReturn(json_encode($promoteData)); + $this->ajaxReturn(json_encode($returnData)); } }