/** * 代理修改 */ 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); } $aProxy = $this->_checkData('update'); if (empty($aProxy)) { return null; } $aProxy['iProxyID'] = intval($this->getParam('iProxyID')); $aOldProxy = Model_CrawlProxy::getDetail($aProxy['iProxyID']); if (!$aOldProxy) { return $this->showMsg('代理信息更新失败!', false); } if (1 == Model_CrawlProxy::updData($aProxy)) { return $this->showMsg('代理信息更新成功!', true); } else { return $this->showMsg('代理信息更新失败!', false); } } else { $iProxyID = intval($this->getParam('id')); $aProxy = Model_CrawlProxy::getDetail($iProxyID); $this->assign('aProxy', $aProxy); } }
/** * 编辑权限点 * * @return boolean */ public function editAction() { if ($this->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); } $aPermission = $this->_checkData(); if (empty($aPermission)) { return null; } $aPermission['iPermissionID'] = intval($this->getParam('iPermissionID')); if (1 == Model_Permission::updData($aPermission)) { return $this->showMsg('权限点信息更新成功!', true); } else { return $this->showMsg('权限点信息更新失败!', false); } } else { $iPermissionID = intval($this->getParam('id')); $aPermission = Model_Permission::getDetail($iPermissionID); $this->assign('aPermission', $aPermission); $this->assign('aMenuTree', Model_Menu::getMenus()); } }
/** * 增加城市 */ public function addAction() { 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); } $aCity = $this->_checkData('add'); if (empty($aCity)) { return null; } if (Model_City::getCityByName($aCity['sCityName'])) { return $this->showMsg('城市已经存在!', false); } if (Model_City::addData($aCity) > 0) { return $this->showMsg('城市增加成功!', true); } else { return $this->showMsg('城市增加失败!', false); } } }
/** * 编辑角色 * @return NULL|boolean */ public function editAction() { if ($this->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); } $aRole = $this->_checkData('update'); if (empty($aRole)) { return null; } $aRole['iRoleID'] = intval($this->getParam('iRoleID')); if (1 == Model_Role::updData($aRole)) { return $this->showMsg('角色信息更新成功!', true); } else { return $this->showMsg('角色信息更新失败!', false); } } else { $iRoleID = intval($this->getParam('id')); $aRole = Model_Role::getDetail($iRoleID); $aRole['aPermission'] = explode(',', $aRole['sPermission']); $aRole['aModule'] = explode(',', $aRole['sModule']); $this->assign('aRole', $aRole); $this->assign('aPermissionList', Model_Permission::getAllPermissions()); $this->assign('aMenuList', Model_Menu::getMenus()); } }
{ $aUser = Model_Admin::getDetail($iAdminID); if ($aUser['sRoleID'] === '-1') { return -1; } $aRoleList = Model_Role::getPKIDList($aUser['sRoleID']); $aModuleID = array(); foreach ($aRoleList as $aRole) { if (!empty($aRole['sModule'])) { $aModuleID = array_merge($aModuleID, explode(',', $aRole['sModule'])); } } return array_flip($aModuleID); } /** * 取得用户所有访问权限 * * @param array $aUser * @return array */ public static function getUserPermissions($iAdminID)
/** * 更换城市 */ public function changeAction() { // 当前用户 $aCookie = Util_Cookie::get(Yaf_G::getConf('authkey', 'cookie')); if (empty($aCookie)) { return $this->redirect('/admin/login'); } $this->aCurrUser = $aCookie; $iCityID = $this->getParam('id'); $aCity = Model_City::getDetail($iCityID); if (empty($aCity) || $aCity['iBackendShow'] == 0 || $aCity['iStatus'] == 0) { return $this->showMsg('城市不存在或未开放!', false); } $aUser = Model_Admin::getDetail($this->aCurrUser['iAdminID']); $aCityID = explode(',', $aUser['sCityID']); if ($aUser['sCityID'] != '-1' && !in_array($iCityID, $aCityID)) { return $this->showMsg('您没有访问该城市的权限,请联系管理员!', false); } Util_Cookie::set('city', $iCityID); return $this->showMsg('城市切换成功!', true); }
/** * 基础配置修改 */ 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); } $aDomain = $this->_checkData('update'); if (empty($aDomain)) { return null; } $aDomain['iAutoID'] = intval($this->getParam('iAutoID')); $aOldDomain = Model_Domain::getDetail($aDomain['iAutoID']); if (empty($aOldDomain)) { return $this->showMsg('基础配置不存在!', false); } if ($aOldDomain['sName'] != $aDomain['sName']) { if (Model_Domain::getRow(array('where' => array('sName' => $aDomain['sName'], 'iType' => $aDomain['iType'], 'iStatus' => 1)))) { return $this->showMsg('基础配置已经存在!', false); } } if (1 == Model_Domain::updData($aDomain)) { return $this->showMsg('基础配置信息更新成功!', true); } else { return $this->showMsg('基础配置信息更新失败!', false); } } else { $iAutoID = intval($this->getParam('id')); $aDomain = Model_Domain::getDetail($iAutoID); $this->assign('aDomain', $aDomain); } $this->assign('iType', Model_Domain::$iType); }
/** * 编辑菜单 */ public function editAction() { if ($this->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); } $aMenu = $this->_checkData('update'); if (empty($aMenu)) { return null; } $aMenu['iMenuID'] = intval($this->getParam('iMenuID')); $aOldMenu = Model_Menu::getDetail($aMenu['iMenuID']); if (empty($aOldMenu)) { return $this->showMsg('菜单不存在!', false); } //更新排序,加在最后面 if ($aOldMenu['iParentID'] != $aMenu['iParentID']) { $aMenu['iOrder'] = Model_Menu::getNextOrder($aMenu['iParentID']); } if (1 == Model_Menu::updData($aMenu)) { return $this->showMsg('菜单信息更新成功!', true); } else { return $this->showMsg('菜单信息更新失败!', false); } } else { $iMenuID = intval($this->getParam('id')); $aMenu = Model_Menu::getDetail($iMenuID); $aTree = Model_Menu::getMenus(); $this->assign('aTree', $aTree); $this->assign('aMenu', $aMenu); } }
/** * 敏感词修改 */ 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); } $aBadword = $this->_checkData('update'); if (empty($aBadword)) { return null; } $aBadword['iAutoID'] = intval($this->getParam('iAutoID')); $aOldBadword = Model_Badword::getDetail($aBadword['iAutoID']); if (empty($aOldBadword)) { return $this->showMsg('敏感词不存在!', false); } if ($aOldBadword['sWord'] != $aBadword['sWord']) { if (Model_Badword::getBadwordByWord($aBadword['sWord'])) { return $this->showMsg('敏感词已经存在!', false); } } if (1 == Model_Badword::updData($aBadword)) { return $this->showMsg('敏感词信息更新成功!', true); } else { return $this->showMsg('敏感词信息更新失败!', false); } } else { $iBadwordID = intval($this->getParam('id')); $aBadword = Model_Badword::getDetail($iBadwordID); $this->assign('aBadword', $aBadword); } }
/** * 财务修改 */ 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); } $aFinance = $this->_checkData('update'); if (empty($aFinance)) { return null; } $aFinance['iAutoID'] = intval($this->getParam('iAutoID')); $aOldFinance = Model_Finance::getDetail($aFinance['iAutoID']); if (empty($aOldFinance)) { return $this->showMsg('财务不存在!', false); } if (1 == Model_Finance::updData($aFinance)) { if ($aOldFinance['iPayStatus'] == 0 && $aFinance['iPayStatus'] == 1) { // 邮件通知 $sTitle = Model_Kv::getValue('finance_forget_email_title'); $sContent = Model_Kv::getValue('finance_forget_email_content'); $aUser = Model_Finance::getDetail($aFinance['iAutoID']); $time = date('Y-m-d H:i:s', $aUser['iUpdateTime']); $email = Model_User::getDetail($aUser['iUserID']); // 短信通知 // $iTempID = Util_Common::getConf(1, 'aSmsTempID'); Util_Mail::send($email['sEmail'], $sTitle, $sContent, array($email['sEmail'], $time, $aUser['iPayMoney'])); // Util_Sms::sendTemplateSms($email['sMobile'], array( // $aUser['sMediaName'] // ), $iTempID); } return $this->showMsg('财务更新成功!', true); } else { return $this->showMsg('财务更新失败!', false); } } else { $iFinanceID = intval($this->getParam('id')); $aFinance = Model_Finance::getDetail($iFinanceID); $aUser = Model_User::getDetail($aFinance['iUserID']); $this->assign('aUser', $aUser); $this->assign('aFinance', $aFinance); } }
/** * 更换自媒体 */ public function changeAction() { $iCityID = $this->getParam('id'); $aCity = Model_Media::getDetail($iCityID); if (empty($aCity) || $aCity['iBackendShow'] == 0 || $aCity['iStatus'] == 0) { return $this->showMsg('自媒体不存在或未开放!', false); } $aUser = Model_Admin::getDetail($this->aCurrUser['iAdminID']); $aCityID = explode(',', $aUser['sCityID']); if ($aUser['sCityID'] != '-1' && !in_array($iCityID, $aCityID)) { return $this->showMsg('您没有访问该自媒体的权限,请联系管理员!', false); } Util_Cookie::set('city', $iCityID); return $this->showMsg('自媒体切换成功!', true); }
/** * 用户修改 */ 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()); } }