예제 #1
0
 /** 
  * 编辑用户信息操作
  * 
  * @return voido
  */
 public function doEditAction()
 {
     $uid = (int) $this->getInput('uid', 'post');
     if (!$uid) {
         $this->showError('WINDID:fail');
     }
     Wind::import('WINDID:service.user.dm.WindidUserDm');
     $dm = new WindidUserDm($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->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');
     /* @var $srv PwAreaService */
     $srv = Wekit::load('area.srv.PwAreaService');
     $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->setEmail($this->getInput('email', 'post'));
     $dm->setAliww($this->getInput('aliww', 'post'));
     $dm->setQq($this->getInput('qq', 'post'));
     $dm->setMsn($this->getInput('msn', 'post'));
     $ds = Windid::load('user.WindidUser');
     $result = $ds->editUser($dm);
     if ($result instanceof PwError) {
         $this->showError($result->getError());
     }
     $srv = Windid::load('notify.srv.WindidNotifyClient');
     $srv->send('202', $dm->getData(), true);
     $this->showMessage('WINDID:success', 'windid/user/edit?uid=' . $uid);
 }
예제 #2
0
 /**
  * 修改用户信息
  */
 public function editUserAction()
 {
     list($uid, $username, $password, $old_password, $email, $question, $answer, $regip, $realname, $profile, $regdate, $gender, $byear, $bmonth, $bday, $hometown, $location, $homepage, $qq, $msn, $aliww, $mobile, $alipay, $addmessages, $messages) = $this->getInput(array('uid', 'username', 'password', 'old_password', 'email', 'question', 'answer', 'regip', 'realname', 'profile', 'regdate', 'gender', 'byear', 'bmonth', 'bday', 'hometown', 'location', 'homepage', 'qq', 'msn', 'aliww', 'mobile', 'alipay', 'addmessages', 'messages'), 'post');
     Wind::import('WSRV:user.dm.WindidUserDm');
     $dm = new WindidUserDm($uid);
     isset($username) && $dm->setUsername($username);
     isset($password) && $dm->setPassword($password);
     isset($old_password) && $dm->setOldpwd($old_password);
     isset($email) && $dm->setEmail($email);
     isset($question) && $dm->setQuestion($question);
     isset($answer) && $dm->setAnswer($answer);
     isset($regip) && $dm->setRegip($regip);
     isset($realname) && $dm->setRealname($realname);
     isset($profile) && $dm->setProfile($profile);
     isset($regdate) && $dm->setRegdate($regdate);
     isset($gender) && $dm->setGender($gender);
     isset($byear) && $dm->setByear($byear);
     isset($bmonth) && $dm->setBmonth($bmonth);
     isset($bday) && $dm->setBday($bday);
     isset($hometown) && $dm->setHometown($hometown);
     isset($location) && $dm->setLocation($location);
     isset($homepage) && $dm->setHomepage($homepage);
     isset($qq) && $dm->setQq($qq);
     isset($msn) && $dm->setMsn($msn);
     isset($aliww) && $dm->setAliww($aliww);
     isset($mobile) && $dm->setMobile($mobile);
     isset($alipay) && $dm->setAlipay($alipay);
     isset($addmessages) && $dm->addMessages($addmessages);
     isset($messages) && $dm->setMessageCount($messages);
     $result = $this->_getUserDs()->editUser($dm);
     if ($result instanceof WindidError) {
         $this->output($result->getCode());
     }
     $this->_getNotifyService()->send('editUser', array('uid' => $uid, 'changepwd' => $dm->password ? 1 : 0), $this->appid);
     $this->output(WindidUtility::result(true));
 }