Authored by yangyang

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into feature/web-list

... ... @@ -30,7 +30,6 @@ class LoginData extends \LibModels\Wap\Passport\LoginData
// 构建必传参数
$param = Yohobuy::param();
$param['v'] = '4';
$param['method'] = 'app.passport.signinByOpenID';
$param['openId'] = $openId;
$param['source_type'] = $sourceType;
... ...
... ... @@ -26,8 +26,8 @@ class PassportModel
const AUTOUSERINFO_LEFT_BANNER_CODE = 'c62d5da06d843b6ed78d8d27e87fa143'; //完善信息页左边的banner
const BACK_FIND_SECRET_KEY = '_+@#$%^';
//简单头部
public static function getSimpleHeader($isLogin, $username = '')
//默认简单头部(不带登录信息 请登录/注册)
public static function getSimpleHeader()
{
//拼接简单头部
$tool = array(
... ... @@ -36,20 +36,10 @@ class PassportModel
'orderHref' => Helpers::url('/home/orders?t=' . time()), //订单中心连接
'helpHref' => Helpers::url('/help'),
);
if ($isLogin) {
$tool+=array(
'user' => $username,
'userCenter' => Helpers::url('/home?t=' . time()), //用户中心链接
'logoutHref' => Helpers::url('/logout.html?t=' . time()), //退出
);
}
else {
$tool+=array(
'loginHref' => Helpers::url('/signin.html'), //登录链接,已登录不传
'registerHref' => Helpers::url('/reg.html'), //注册链接,已登录不传
);
}
$simpleHeader = array(
'logo' => array(
'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png',
... ... @@ -57,7 +47,6 @@ class PassportModel
),
'tool' => $tool
);
return $simpleHeader;
}
... ...
... ... @@ -133,20 +133,16 @@ class AutosignController extends WebAction
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
$refer = SITE_MAIN;
}
else {
$refer = rawurldecode($refer);
}
//判定是否需要绑定手机号
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$fillHerf = rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $access['openid'], 'sourceType' => 'qq', 'nickname' => $partnerInfo['nickname'])));
$this->go(Helpers::syncUserSession($result['data']['uid'], $fillHerf));
if (isset($result['data']['is_bind']) && $result['data']['is_bind'] == 'N') {
$fillHerf = Helpers::url('/passport/thirdlogin/index', array('openId' => $access['openid'], 'sourceType' => 'qq', 'nickname' => $partnerInfo['nickname']));
$this->go($fillHerf);
}
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
... ... @@ -273,7 +269,7 @@ class AutosignController extends WebAction
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$fillHerf =rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $access['douban_user_id'], 'sourceType' => 'douban', 'nickname' => $partnerInfo['name'])));
$fillHerf = rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $access['douban_user_id'], 'sourceType' => 'douban', 'nickname' => $partnerInfo['name'])));
$this->go(Helpers::syncUserSession($result['data']['uid'], $fillHerf));
}
... ... @@ -311,7 +307,7 @@ class AutosignController extends WebAction
$result = array();
if ($partnerInfo && is_array($partnerInfo)) {
$shoppingKey = Helpers::getShoppingKeyByCookie();
$result = LoginData::signinByOpenID($partnerInfo['nickname'],$partnerInfo['openid'], 'wechat', $shoppingKey,$partnerInfo['openid']);
$result = LoginData::signinByOpenID($partnerInfo['nickname'], $partnerInfo['openid'], 'wechat', $shoppingKey, $partnerInfo['openid']);
}
//判定是否需要绑定手机号
... ... @@ -320,7 +316,7 @@ class AutosignController extends WebAction
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$fillHerf =rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $partnerInfo['openid'], 'sourceType' => 'wechat', 'nickname' => $partnerInfo['nickname'])));
$fillHerf = rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $partnerInfo['openid'], 'sourceType' => 'wechat', 'nickname' => $partnerInfo['nickname'])));
$this->go(Helpers::syncUserSession($result['data']['uid'], $fillHerf));
}
... ... @@ -343,4 +339,5 @@ class AutosignController extends WebAction
$this->go($refer);
}
}
}
... ...
... ... @@ -39,7 +39,7 @@ class AutouserinfoController extends WebAction
$isLogin = true;
$username = $this->_uname;
}
$simpleHeader = PassportModel::getSimpleHeader($isLogin, $username);
$simpleHeader = PassportModel::getSimpleHeader();
$cover = PassportModel::getLeftBanner(PassportModel::AUTOUSERINFO_LEFT_BANNER_CODE);
//整合
... ... @@ -76,15 +76,7 @@ class AutouserinfoController extends WebAction
$openId = $this->get('openId');
$sourceType = $this->get('sourceType');
if (!$uid) {
$isLogin = false;
$username = '';
}
else {
$isLogin = true;
$username = $this->_uname;
}
$simpleHeader = PassportModel::getSimpleHeader($isLogin, $username);
$simpleHeader = PassportModel::getSimpleHeader();
$cover = PassportModel::getLeftBanner(PassportModel::AUTOUSERINFO_LEFT_BANNER_CODE);
//整合
$data = array(
... ... @@ -224,7 +216,7 @@ class AutouserinfoController extends WebAction
$code = trim($this->post('code')); //短信验证码
//校验手机号格式
if (!is_numeric($phoneNum) || !is_numeric($areaCode)) {
$data['code'] = 401;
$data['code'] = 400;
$data['message'] = '手机号码格式不正确';
break;
}
... ... @@ -264,23 +256,25 @@ class AutouserinfoController extends WebAction
//校验手机号格式
if (!is_numeric($phoneNum) || !is_numeric($areaCode)) {
$data['code'] = 401;
$data['code'] = 400;
$data['message'] = '手机号码格式不正确';
break;
}
//校验图形验证码
$picFlag = PassportModel::verifyCode($verifyCode);
if (!$picFlag) {
$data['code'] = 402;
$data['code'] = 400;
$data['message'] = '图形验证码不正确';
break;
}
//校验手机验证码
$bindMsgFlag = BindData::checkBindCode($areaCode, $phoneNum, $code);
if (isset($bindMsgFlag['code']) && $bindMsgFlag['code'] != 200) {
$data['code'] = 403;
$data['code'] = 400;
$data['message'] = '短信验证码不正确';
break;
}
//绑定手机号
$res = BindData::bindMobile($openId, $sourceType, $phoneNum, $areaCode, $password);
if (!isset($res['code'])) {
break;
... ...
... ... @@ -13,7 +13,7 @@ class BackController extends WebAction {
public function indexAction() {
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'simpleHeader' => PassportModel::getSimpleHeader(),
'backPage' => true,
'back' => array (
'coverHref' => $banner ['url'],
... ... @@ -128,7 +128,7 @@ class BackController extends WebAction {
$emailUrl = 'http://mail.'.$emailArr[1];
}
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'simpleHeader' => PassportModel::getSimpleHeader(),
'sendEmail' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
... ... @@ -166,7 +166,7 @@ class BackController extends WebAction {
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'simpleHeader' => PassportModel::getSimpleHeader(),
'resetPage' => true,
'resetPwd' => array (
'coverHref' => $banner ['url'],
... ... @@ -224,7 +224,7 @@ class BackController extends WebAction {
{
$banner = PassportModel::getLeftBanner ( PassportModel::BACK_LFFT_BANNER_CODE );
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader ( false ),
'simpleHeader' => PassportModel::getSimpleHeader (),
'resetSuccess' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
... ... @@ -247,7 +247,7 @@ class BackController extends WebAction {
}
$banner = PassportModel::getLeftBanner (PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader ( false ),
'simpleHeader' => PassportModel::getSimpleHeader (),
'vertificationPage' => true,
'verification' => array (
'coverHref' => $banner ['url'],
... ...
... ... @@ -23,17 +23,7 @@ class LoginController extends WebAction
if (!empty($refer)) {
$this->setCookie('refer', $refer);
}
//获取用户
$uid = $this->getUid(true);
if (!$uid) {
$isLogin = false;
$username = '';
}
else {
$isLogin = true;
$username = $this->_uname;
}
$simpleHeader = PassportModel::getSimpleHeader($isLogin, $username);
$simpleHeader = PassportModel::getSimpleHeader();
//获取登陆页左侧资源
$cover = PassportModel::getLeftBanner(PassportModel::SIGNIN_LEFT_BANNER_CODE);
//是否记住密码
... ...
... ... @@ -17,7 +17,7 @@ class RegisterController extends WebAction
$this->setSession('effective_time', time() + 1800);
$data = array(
'registerPage' => true,
'simpleHeader' => PassportModel::getSimpleHeader(false),
'simpleHeader' => PassportModel::getSimpleHeader(),
'passport' => array(
'actionUrl' => SITE_MAIN.'/passport/register/mobileregister',
'region' => RegData::getAreasData(),
... ...
<?php
use Action\WebAction;
use Passport\PassportModel;
use LibModels\Wap\Passport\RegData;
class ThirdloginController extends WebAction
{
/**
* 登录
* 第三方联合登录手机绑定流程
*/
public function indexAction()
{
$this->setTitle('联合登录补全信息');
// $nickname = $this->get('nickname');
$openId = trim($this->get('openId'));
$sourceType = trim($this->get('sourceType'));
//登录后跳转页面
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN;
}
else {
$refer = rawurldecode($refer);
}
$simpleHeader = PassportModel::getSimpleHeader();
//整合
$data = array(
'thirdLogin' => true,
'simpleHeader' => $simpleHeader,
'openId' => $openId,
'sourceType' => $sourceType,
'region' => RegData::getAreasData(),
);
$this->_view->display('index', $data);
}
}
... ...