/**
  * 检查发布的城市是否有效.
  * 
  * @access private
  * @param string $cityName 城市名称.
  * @return array 无效时抛异常.
  */
 private function _checkCity($cityName)
 {
     $cityName = (string) $cityName;
     if (empty($cityName)) {
         throw new \Exception(Message::get(Message::PARAM_ERROR), Message::PARAM_ERROR);
     }
     $modelCity = new CityModel();
     // 城市模型.
     $cityInfo = $modelCity->fetchNameByName($cityName);
     unset($modelCity);
     if (NULL === $cityInfo) {
         throw new \Exception(Message::get(Message::PARAM_ERROR), Message::PARAM_ERROR);
     }
     return $cityInfo;
 }
 /**
  * 更新个人信息.
  * 
  * @access public
  * @return void
  */
 public function updatePerInfoAction()
 {
     $gender = I('post.gender', '');
     $birthday = I('post.birthday', '');
     $livingCountry = I('post.livingCountry', '');
     // 国家名称.
     $livingCity = I('post.livingCity', '');
     // 城市名称.
     $qq = I('post.qq', '');
     $facebook = I('post.facebook', '');
     $livingProvince = 0;
     // 居住地省 ID.
     $arrGender = [0 => '', 1 => '男', 2 => '女'];
     $intGenderKey = array_search($gender, $arrGender);
     $gender = FALSE === $intGenderKey ? 0 : $intGenderKey;
     // 入库的性别值, 0: 未设置, 1: 男, 2: 女.
     unset($intGenderKey);
     // 校验国家.
     if (!empty($livingCountry)) {
         $modelCountry = new CountryModel();
         $countryInfo = $modelCountry->fetchNameByName($livingCountry);
         $livingCountry = NULL === $countryInfo ? 0 : $countryInfo['id'];
         // 国家 ID.
         unset($modelCountry, $countryInfo);
     }
     // 校验城市是否为有效的, 且国家与城市所对应的国家是否匹配; 不匹配用城市的的国家替代 $livingCounty.
     if (!empty($livingCity)) {
         $modelCity = new CityModel();
         $cityInfo = $modelCity->fetchNameByName($livingCity);
         if (NULL === $cityInfo) {
             $livingCity = 0;
         } else {
             $livingCountry = $cityInfo['countryID'];
             // 将国家设置为城市所在的国家.
             $livingProvince = $cityInfo['areaID'];
             // 城市所属的省份.
             $livingCity = $cityInfo['id'];
             // 城市 ID.
         }
         unset($modelCity, $cityInfo);
     }
     // 计算生日.
     $birthY = $birthM = $birthD = 0;
     if (!empty($birthday)) {
         $arrDate = date_parse($birthday);
         $birthY = $arrDate['year'];
         $birthM = $arrDate['month'];
         $birthD = $arrDate['day'];
         unset($arrDate);
     }
     // 准备入库.
     $data = ['sex' => $gender, 'birthYear' => (int) $birthY, 'birthMonth' => (int) $birthM, 'birthDay' => (int) $birthD, 'resideCountry' => (int) $livingCountry, 'resideProvince' => (int) $livingProvince, 'resideCity' => (int) $livingCity, 'qq' => $qq, 'facebook' => $facebook];
     unset($birthY, $birthM, $birthD);
     unset($gender, $arrGender, $birthday, $livingCountry, $livingProvince, $livingCity, $qq, $facebook);
     $modelMember = new MemberModel();
     if (FALSE === $modelMember->updatePerInfo($this->getLoginedUserInfo('uid'), $data)) {
         $this->setAjaxData(Message::FAILED, '修改失败')->myAjaxReturn();
     }
     $this->setAjaxData(Message::SUCCESS, '修改成功')->myAjaxReturn();
 }