/** * 用户修改 */ public function editAction() { if ($this->_request->isPost()) { //修改密码验证 $aCookie = Util_Cookie::get(Yaf_G::getConf('authkey', 'cookie')); $iAdminID = $aCookie['iAdminID']; $aUser = Model_Admin::getDetail($iAdminID); $pwd = $this->getParam('pwd'); if (!isset($pwd) || $pwd == '') { return $this->showMsg('修改密码不可以为空', false); } if ($aUser['sEditPassword'] != md5($pwd)) { return $this->showMsg('修改密码不正确', false); } $aUser = $this->_checkData('update'); if (empty($aUser)) { return null; } $aUser['iAdminID'] = intval($this->getParam('iAdminID')); $aOldUser = Model_Admin::getDetail($aUser['iAdminID']); if (empty($aOldUser)) { return $this->showMsg('用户不存在!', false); } if ($aOldUser['sAdminName'] != $aUser['sAdminName']) { if (Model_Admin::getAdminByName($aUser['sAdminName'])) { return $this->showMsg('用户已经存在!', false); } } if (1 == Model_Admin::updData($aUser)) { return $this->showMsg('用户信息更新成功!', true); } else { return $this->showMsg('用户信息更新失败!', false); } } else { $iAdminID = intval($this->getParam('id')); $aUser = Model_Admin::getDetail($iAdminID); $aUser['aCityID'] = explode(',', $aUser['sCityID']); $aUser['aRoleID'] = explode(',', $aUser['sRoleID']); $this->assign('aUser', $aUser); $this->assign('aCity', Model_City::getPairCitys()); $this->assign('aRole', Model_Role::getPairRoles()); } }