コード例 #1
0
ファイル: RegisterAction.php プロジェクト: caidongyun/CS
 private function _register($res, $username, $password, $email, $mobile, $code, $isValidation)
 {
     if ($isValidation) {
         // 是否开启注册手机验证
         $isRegisterValidation = WebUtils::getDzPluginAppbymeAppConfig('mobcent_register_validation');
         if ($isRegisterValidation) {
             $checkInfo = UserUtils::checkMobileCode($res, $mobile, $code);
             if ($checkInfo['rs'] == 0) {
                 return $this->makeErrorInfo($res, $checkInfo['errcode']);
             }
         }
     }
     $regInfo = UserUtils::register($username, $password, $email);
     if ($regInfo['errcode']) {
         return $this->makeErrorInfo($res, $regInfo['message']);
     }
     if ($isValidation) {
         if ($isRegisterValidation) {
             // 注册完毕之后更新手机验证信息
             $updataArr = array('uid' => $regInfo['info']['uid']);
             AppbymeSendsms::updateMobile($mobile, $updataArr);
         }
     }
     $userInfo = AppbymeUserAccess::registerProcess($regInfo['info']['uid'], $password);
     $res['token'] = (string) $userInfo['token'];
     $res['secret'] = (string) $userInfo['secret'];
     $res['uid'] = (int) $regInfo['info']['uid'];
     return $res;
 }
コード例 #2
0
 private function _register($res, $username, $password, $email)
 {
     $regInfo = UserUtils::register($username, $password, $email);
     if ($regInfo['errcode']) {
         return $this->makeErrorInfo($res, $regInfo['message']);
     }
     $userInfo = AppbymeUserAccess::registerProcess($regInfo['info']['uid'], $password);
     $res['token'] = (string) $userInfo['token'];
     $res['secret'] = (string) $userInfo['secret'];
     $res['uid'] = (int) $regInfo['info']['uid'];
     return $res;
 }
コード例 #3
0
 private function _saveInfo($res, $username, $email, $oauthToken, $openId, $gender, $platformId)
 {
     $username = WebUtils::t(rawurldecode($username));
     $email = WebUtils::t(rawurldecode($email));
     $password = MOBCENT_HACKER_PASSWORD;
     $regInfo = UserUtils::register($username, $password, $email, 'qq');
     if ($regInfo['errcode']) {
         return $this->makeErrorInfo($res, $regInfo['message']);
     }
     $uid = $regInfo['info']['uid'];
     $userInfo = UserUtils::getUserInfo($uid);
     $userAccess = AppbymeUserAccess::registerProcess($uid, $password);
     if (!empty($platformId) && $platformId == 20) {
         $qqdata = array('uid' => $uid, 'conuin' => $oauthToken, 'conuinsecret' => '', 'conopenid' => $openId, 'conisfeed' => 1, 'conispublishfeed' => 1, 'conispublisht' => 1, 'conisregister' => 1, 'conisqzoneavatar' => 1, 'conisqqshow' => 1);
         $qqbind = array('mblid' => '', 'uid' => $uid, 'uin' => $openId, 'type' => 1, 'dateline' => time());
         $this->_inserBindlog($qqbind);
         $this->_inserConnect($qqdata);
         $updateInfo = array('avatarstatus' => 1, 'conisbind' => 1);
         // 用户是否绑定QQ
         DzCommonMember::updateMember($updateInfo, array('uid' => $uid));
         $setarr['gender'] = intval($gender);
         C::t('common_member_profile')->update($uid, $setarr);
         $ipArray = explode('.', $_G['clientip']);
         $sid = FileUtils::getRandomFileName('', 6);
         $data = array('sid' => $sid, 'ip1' => $ipArray[0], 'ip2' => $ipArray[1], 'ip3' => $ipArray[2], 'ip4' => $ipArray[3], 'uid' => $userInfo['uid'], 'username' => $userInfo['username'], 'groupid' => $userInfo['groupid'], 'invisible' => '0', 'action' => '', 'lastactivity' => time(), 'fid' => '0', 'tid' => '0', 'lastolupdate' => '0');
         DzCommonSession::insertComSess($data);
         require_once libfile('cache/userstats', 'function');
         build_cache_userstats();
         $res['token'] = (string) $userAccess['token'];
         $res['secret'] = (string) $userAccess['secret'];
         $res['uid'] = (int) $regInfo['info']['uid'];
         return $res;
     }
     // 客户端参数不正确
     return $this->makeErrorInfo($res, 'mobcent_error_params');
 }
コード例 #4
0
 private function _saveWxInfo($res, $username, $oauthToken, $password, $openId, $email, $gender, $act, $platformId)
 {
     if ($act == 'register') {
         $regInfo = UserUtils::register($username, $password, $email);
         if ($regInfo['errcode']) {
             return $this->makeErrorInfo($res, $regInfo['message']);
         }
         $uid = $regInfo['info']['uid'];
         $member = UserUtils::getUserInfo($uid);
         $userInfo = AppbymeUserAccess::registerProcess($regInfo['info']['uid'], $password);
         $data = array('uid' => $uid, 'openid' => $openId, 'status' => 1, 'type' => 1);
         AppbymeConnection::insertMobcentWx($data);
         $res['body']['uid'] = (int) $uid;
         $res['body']['token'] = (string) $userInfo['token'];
         $res['body']['secret'] = (string) $userInfo['secret'];
     } elseif ($act == 'bind') {
         global $_G;
         $logInfo = UserUtils::login($username, $password);
         if ($logInfo['errcode']) {
             UserUtils::delUserAccessByUsername($username);
             return $this->makeErrorInfo($res, 'mobcent_bind_error');
         }
         $isBind = AppbymeConnection::getUserBindInfo($_G['uid']);
         if ($isBind) {
             return $this->makeErrorInfo($res, 'mobcent_bind_error_repeat');
         }
         $data = array('uid' => $_G['uid'], 'openid' => $openId, 'status' => 1, 'type' => 1);
         AppbymeConnection::insertMobcentWx($data);
         $userInfo = AppbymeUserAccess::loginProcess($_G['uid'], $password);
         $userAvatar = UserUtils::getUserAvatar($_G['uid']);
         $res['body']['token'] = (string) $userInfo['token'];
         $res['body']['secret'] = (string) $userInfo['secret'];
         $res['body']['uid'] = (int) $_G['uid'];
         $res['body']['avatar'] = (string) $userAvatar;
         $res['body']['userName'] = (string) $_G['username'];
     }
     return $res;
 }