/** * 增加城市 */ 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); } } }