Example #1
0
 /**
  * 用户注册
  * Enter description here ...
  * @param string $username
  * @param string $email
  * @param string $password
  * @param string $question
  * @param string $answer
  * @param string $regip
  * @return int
  */
 public function register($username, $email, $password, $question = '', $answer = '', $regip = '')
 {
     Wind::import('WINDID:service.user.dm.WindidUserDm');
     $dm = new WindidUserDm();
     $dm->setUsername($username)->setEmail($email)->setPassword($password)->setQuestion($question)->setAnswer($answer)->setRegip($regip);
     $result = $this->_getUserDs()->addUser($dm);
     if ($result instanceof WindidError) {
         return $result->getCode();
     }
     $uid = (int) $result;
     $client = Windid::client();
     if ($client->windid == 'local') {
         $srv = Windid::load('user.srv.WindidUserService');
         $result = $srv->defaultAvatar($uid, 'face');
     } else {
         $params = array('uid' => $uid, 'type' => 'face');
         WindidApi::open('avatar/default', array(), $params);
     }
     $this->_getNotifyClient()->send('register', $uid);
     return $uid;
 }
Example #2
0
 /**
  * 用户注册
  *
  * @param string $username
  * @param string $email
  * @param string $password
  * @param string $question
  * @param string $answer
  * @param string $regip
  * @return int
  */
 public function register($username, $email, $password, $question = '', $answer = '', $regip = '')
 {
     Wind::import('WSRV:user.dm.WindidUserDm');
     $dm = new WindidUserDm();
     $dm->setUsername($username)->setEmail($email)->setPassword($password)->setQuestion($question)->setAnswer($answer)->setRegip($regip);
     return $this->addDmUser($dm);
 }
Example #3
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);
 }
 public function setUser($username, $password, $email, $groupid = 3, $uid = 0)
 {
     if (!$email) {
         return new PwError('ADMIN:founder.edit.fail.email.empty');
     }
     Wind::import('WSRV:user.dm.WindidUserDm');
     $userDm = new WindidUserDm($uid);
     $userDm->setEmail($email);
     //$userDm->setGroupid($groupid);
     $password && $userDm->setPassword($password);
     if (!$uid) {
         $userDm->setUsername($username);
         return $this->loadUser()->addUser($userDm);
     } else {
         return $this->loadUser()->editUser($userDm);
     }
 }
Example #5
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));
 }