Beispiel #1
0
 private function AddData($params)
 {
     $rolename = $params['rolename'];
     unset($params['rolename']);
     $menusArr = array_keys($params);
     $ch_groupname = Bll_Authority::check_group_info_by_group_name($rolename);
     if (empty($ch_groupname)) {
         //添加角色表
         $data = array('group_name' => $rolename, 'operation_name' => $this->get_user_name(), 'operation_id' => $this->get_user_id(), 'status' => '1', 'create_time' => time());
         $result = BLL_Authority::insert_group_info($data);
         //给角色添加菜单权限表
         if (!empty($menusArr)) {
             foreach ($menusArr as $menusArrVal) {
                 $AddAuthoritydata = array('group_id' => $result, 'menu_code' => $menusArrVal, 'operation_name' => $this->get_user_name(), 'operation_id' => $this->get_user_id(), 'status' => '1', 'create_time' => time());
                 BLL_Authority::insert_authority_info($AddAuthoritydata);
             }
         }
         $url = $this->build_url(__CLASS__, array('action' => 0));
         $this->response->redirect($url);
         exit;
     } else {
         //表示用户名已存在
         $url = $this->build_url(__CLASS__, array('action' => 1));
         $this->response->redirect($url);
         exit;
     }
 }