Exemplo n.º 1
0
 /**
  * 检查用户名的唯一性
  */
 public function checkusernameAction()
 {
     $username = $this->getInput('username', 'post');
     $result = PwUserValidator::isUsernameValid($username);
     if ($result instanceof PwError) {
         $this->showError($result->getError());
     }
     $this->showMessage();
 }
Exemplo n.º 2
0
 public function weixinRegisterUserAction()
 {
     $result = array("Success" => 0, "ErrorMessage" => "");
     $mobile = $this->getInput("mobile");
     //$code = $this->getInput("code");
     $password = $this->getInput("password");
     $username = $this->getInput("username");
     //register user
     Wind::import('SRV:user.srv.PwRegisterService');
     Wind::import('APPS:u.service.helper.PwUserHelper');
     Wind::import('SRV:user.validator.PwUserValidator');
     Wind::import('Wind:utility.WindValidator');
     //check if user name duplicated
     $checkResult = PwUserValidator::isUsernameValid($username);
     if ($checkResult instanceof PwError) {
         $error = $checkResult->getError(false);
         if ($error == 'USER:user.error.-5' || $error == 'USER:user.error.-4') {
             $result['Success'] = 0;
             $result['ErrorMessage'] = '用户已存在,请重新注册';
             $this->output($result);
         }
     }
     $registerService = new PwRegisterService();
     $UserDM = $this->_UserDM($mobile, $password, $username);
     $registerService->setUserDm($UserDM);
     if (($info = $registerService->register()) instanceof PwError) {
         $result['Success'] = 0;
         $result['ErrorMessage'] = '注册错误,请联系管理员';
         $this->output($result);
     } else {
         $uid = $info['uid'];
         $pwUserMobile = Wekit::load('user.PwUserMobile');
         $pwUserMobile->replaceMobile($uid, $mobile);
         $result['Success'] = 1;
         $result['ErrorMessage'] = '';
         $result['User'] = $this->getUserInfo($uid);
         $this->output($result);
     }
 }