Beispiel #1
0
 private function _edit_user($params)
 {
     if (!empty($params['userid']) && !empty($params['groupid']) && !empty($params['groupname'])) {
         $data = array('citys' => implode(',', $params['citys']), 'group_id' => $params['groupid'], 'group_name' => $params['groupname']);
         $whereArr = array('user_id' => $params['userid']);
         $result = Bll_Authority::update_user_info($data, $whereArr);
         if ($result) {
             $_res = array("code" => "success", "mes" => "成功!", "info" => $result);
         } else {
             $_res = array("code" => "fail", "mes" => "无权操作!", "info" => $result);
         }
         echo json_encode($_res);
         exit;
     }
 }
Beispiel #2
0
 public function handle_request_internel()
 {
     $params = $this->getParam();
     $res = $this->_res;
     switch ($params['page']) {
         case 'authority':
             $userlevel = Bll_Authority::get_user_level($this->get_user_id());
             if ($userlevel != Const_Cms::CMS_USER_LEVEL_SUPPER) {
                 //不是超级管理员
                 $res = $this->init_res('', false);
             } else {
                 if (!empty($params['userid']) && !empty($params['level'])) {
                     $data = array('level' => $params['level']);
                     $whereArr = array('user_id' => $params['userid']);
                     $result = Bll_Authority::update_user_info($data, $whereArr);
                     $res = $this->init_res($result);
                 }
             }
             break;
         case 'delete':
             //删除用户
             $userlevel = Bll_Authority::get_user_level($this->get_user_id());
             if ($userlevel != Const_Cms::CMS_USER_LEVEL_SUPPER) {
                 //不是超级管理员
                 $res = $this->init_res('', false);
             } else {
                 if ($params['userid'] == $this->get_user_id()) {
                     //不可以删除自己
                     $res = $this->init_res('', false);
                 }
                 if (!empty($params['userid'])) {
                     $result = Bll_Authority::delete_user_info_by_user_id($params['userid']);
                     $res = $this->init_res($result);
                 }
             }
             break;
         default:
             $res = $this->_res;
             break;
     }
     echo json_encode($res);
     exit;
 }
Beispiel #3
0
 /**
  * 检查登录者信息是否保存,不保存则保存值数据库中
  */
 private function _check_user_info($userId)
 {
     //添加登陆者的信息到user_info表
     if (!empty($userId)) {
         $IsExite = BLL_Authority::get_user_Info_by_user_id($userId, '');
         $getuserinfo = $this->get_user_info();
         if (empty($IsExite)) {
             $IsExite = array('user_id' => $getuserinfo['user_id'], 'user_name' => $getuserinfo['name'], 'bu_id' => $getuserinfo['bu_id'], 'bu_name' => $getuserinfo['department_name'], 'level' => 0, 'operation_name' => $this->get_user_name(), 'operation_id' => 0, 'status' => 1, 'create_time' => time());
             Bll_Authority::insert_user_info_data_row($IsExite);
         } else {
             //存在信息不一样,直接更新
             if ($IsExite['bu_id'] != $getuserinfo['bu_id'] || $IsExite['bu_name'] != $getuserinfo['department_name']) {
                 $data = array('bu_id' => $getuserinfo['bu_id'], 'bu_name' => $getuserinfo['department_name']);
                 $whereArr = array('user_id' => $getuserinfo['user_id']);
                 Bll_Authority::update_user_info($data, $whereArr);
             }
         }
         /*有些optools功能迁移到cms,所以mid保存,以便写入操作日志时调用*/
         if (empty($IsExite['operation_id'])) {
             $userName = $this->get_user_name();
             $ajkAdminManager = Dao_AjkAdminManager::get_admin_manager_by_userName($userName);
             if ($ajkAdminManager) {
                 $data = array('operation_id' => $ajkAdminManager[0]['MId']);
                 $whereArr = array('user_id' => $getuserinfo['user_id']);
                 Bll_Authority::update_user_info($data, $whereArr);
                 $this->mid = $IsExite['operation_id'] = $ajkAdminManager[0]['MId'];
             }
         } else {
             $this->mid = $IsExite['operation_id'];
         }
         $this->_userInfo = $IsExite['status'] == 1 ? $IsExite : array();
     }
 }