Esempio n. 1
0
 /** 
  * 编辑用户信息操作
  * 
  * @return voido
  */
 public function doEditAction()
 {
     $info = $this->checkUser();
     Wind::import('SRC:service.user.dm.PwUserInfoDm');
     $dm = new PwUserInfoDm($info['uid']);
     //用户信息
     //$dm->setUsername($this->getInput('username', 'post'));
     list($password, $repassword) = $this->getInput(array('password', 'repassword'), 'post');
     if ($password) {
         if ($password != $repassword) {
             $this->showError('USER:user.error.-20');
         }
         $dm->setPassword($password);
     }
     $dm->setEmail($this->getInput('email', 'post'));
     list($question, $answer) = $this->getInput(array('question', 'answer'), 'post');
     switch ($question) {
         case '-2':
             $dm->setQuestion('', '');
             break;
         case '-1':
         default:
             break;
     }
     $dm->setRegdate(Pw::str2time($this->getInput('regdate', 'post')));
     $dm->setRegip($this->getInput('regip', 'post'));
     $dm->setOnline(intval($this->getInput('online', 'post')) * 3600);
     //基本资料
     $dm->setRealname($this->getInput('realname', 'post'));
     $dm->setGender($this->getInput('gender', 'post'));
     $birthday = $this->getInput('birthday', 'post');
     if ($birthday) {
         $bir = explode('-', $birthday);
         isset($bir[0]) && $dm->setByear($bir[0]);
         isset($bir[1]) && $dm->setBmonth($bir[1]);
         isset($bir[2]) && $dm->setBday($bir[2]);
     } else {
         $dm->setBday('')->setByear('')->setBmonth('');
     }
     list($hometown, $location) = $this->getInput(array('hometown', 'location'), 'post');
     $srv = WindidApi::api('area');
     $areas = $srv->fetchAreaInfo(array($hometown, $location));
     $dm->setLocation($location, isset($areas[$location]) ? $areas[$location] : '');
     $dm->setHometown($hometown, isset($areas[$hometown]) ? $areas[$hometown] : '');
     $dm->setHomepage($this->getInput('homepage', 'post'));
     $dm->setProfile($this->getInput('profile', 'post'));
     //交易信息
     $dm->setAlipay($this->getInput('alipay', 'post'));
     $dm->setMobile($this->getInput('mobile', 'post'));
     $dm->setTelphone($this->getInput('telphone', 'post'));
     $dm->setAddress($this->getInput('address', 'post'));
     $dm->setZipcode($this->getInput('zipcode', 'post'));
     //联系信息
     $dm->setEmail($this->getInput('email', 'post'));
     $dm->setAliww($this->getInput('aliww', 'post'));
     $dm->setQq($this->getInput('qq', 'post'));
     $dm->setMsn($this->getInput('msn', 'post'));
     /* @var $pwUser PwUser */
     $pwUser = Wekit::load('user.PwUser');
     $result = $pwUser->editUser($dm);
     if ($result instanceof PwError) {
         $this->showError($result->getError());
     }
     $isFounder = $this->isFounder($info['username']);
     $this->showMessage($isFounder ? 'USER:founder.update.success' : 'USER:update.success', 'u/manage/edit?uid=' . $info['uid']);
 }
Esempio n. 2
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');
     }
 }