Exemplo n.º 1
0
 /** 
  * 编辑联系方式
  */
 public function docontactAction()
 {
     $userDm = new PwUserInfoDm($this->loginUser->uid);
     $userDm->setTelphone($this->getInput('telphone', 'post'));
     $userDm->setAddress($this->getInput('address', 'post'));
     $userDm->setZipcode($this->getInput('zipcode', 'post'));
     $userDm->setAliww($this->getInput('aliww', 'post'));
     $userDm->setQq($this->getInput('qq', 'post'));
     $userDm->setMsn($this->getInput('msn', 'post'));
     list($alipay, $mobile, $email) = $this->getInput(array('alipay', 'mobile', 'email'), 'post');
     if ($alipay) {
         $r = PwUserValidator::isAlipayValid($alipay, $this->loginUser->username);
         if ($r instanceof PwError) {
             $this->showError($r->getError());
         }
     }
     if ($mobile) {
         $r = PwUserValidator::isMobileValid($mobile);
         if ($r instanceof PwError) {
             $this->showError($r->getError());
         }
     }
     if ($email) {
         $r = PwUserValidator::isEmailValid($email, $this->loginUser->username);
         if ($r instanceof PwError) {
             $this->showError($r->getError());
         }
     }
     $userDm->setEmail($email);
     $userDm->setMobile($mobile);
     $userDm->setAlipay($alipay);
     $result = $this->_editUser($userDm, PwUser::FETCH_MAIN + PwUser::FETCH_INFO);
     if ($result instanceof PwError) {
         $this->showError($result->getError());
     } else {
         $this->loginUser->info = array_merge($this->loginUser->info, $userDm->getData());
         $this->showMessage('USER:user.edit.contact.success');
     }
 }