Пример #1
0
 /**
  * 城市修改
  */
 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);
         }
         $aCity = $this->_checkData('update');
         if (empty($aCity)) {
             return null;
         }
         $aCity['iCityID'] = intval($this->getParam('iCityID'));
         $aOldCity = Model_City::getDetail($aCity['iCityID']);
         if (empty($aOldCity)) {
             return $this->showMsg('城市不存在!', false);
         }
         if ($aOldCity['sCityName'] != $aCity['sCityName']) {
             if (Model_City::getCityByName($aCity['sCityName'])) {
                 return $this->showMsg('城市已经存在!', false);
             }
         }
         if (1 == Model_City::updData($aCity)) {
             return $this->showMsg('城市信息更新成功!', true);
         } else {
             return $this->showMsg('城市信息更新失败!', false);
         }
     } else {
         $iCityID = intval($this->getParam('id'));
         $aCity = Model_City::getDetail($iCityID);
         $this->assign('aCity', $aCity);
     }
 }