Authored by hf

code review by hf: fixes some bugs to merge code

... ... @@ -34,7 +34,6 @@ class LoginData
$param['area'] = $area;
$param['profile'] = $profile;
$param['password'] = $password;
if (!empty($shoppingKey)) {
$param['shopping_key'] = $shoppingKey;
}
... ... @@ -65,9 +64,10 @@ class LoginData
* @param string $nickname 姓名
* @param string $openId 第三方唯一识别码
* @param string $sourceType 登录方式
* @param string $shoppingKey 未登录用户唯一识别码, 默认为空
* @return array 登录返回结果
*/
public static function signinByOpenID($nickname, $openId, $sourceType)
public static function signinByOpenID($nickname, $openId, $sourceType, $shoppingKey = null)
{
// 构建必传参数
$param = Yohobuy::param();
... ... @@ -77,6 +77,9 @@ class LoginData
$param['source_type'] = $sourceType;
$param['nickname'] = $nickname;
$param['client_secret'] = Sign::getSign($param);
if (!empty($shoppingKey)) {
$param['shopping_key'] = $shoppingKey;
}
return Yohobuy::get(Yohobuy::API_URL, $param);
}
... ...
... ... @@ -782,7 +782,7 @@ class HomeController extends AbstractAction
$this->auditJumpLogin();
$this->setTitle('支付中心');
$this->setNavHeader('支付中心', Helpers::url('/cart/index/index'));
$this->setNavHeader('支付中心', Helpers::url('/home/orders'));
$orderCode = $this->get('order_code');
if (empty($orderCode)) {
... ...
... ... @@ -193,7 +193,8 @@ class LoginController extends AbstractAction
$result = array();
if (isset($realName, $email, $userId)) {
$result = LoginData::signinByOpenID($realName, $userId, 'alipay');
$shoppingKey = Helpers::getShoppingKeyByCookie();
$result = LoginData::signinByOpenID($realName, $userId, 'alipay', $shoppingKey);
}
//判定是否需要绑定手机号
... ... @@ -229,7 +230,8 @@ class LoginController extends AbstractAction
$partnerInfo = $qqconnect->getUserInfo($access);
$result = array();
if (!empty($partnerInfo) && isset($partnerInfo['nickname'])) {
$result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['openid'], 'qq');
$shoppingKey = Helpers::getShoppingKeyByCookie();
$result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['openid'], 'qq', $shoppingKey);
}
//判定是否需要绑定手机号
... ... @@ -266,7 +268,8 @@ class LoginController extends AbstractAction
$result = array();
if ($partnerInfo && is_array($partnerInfo)) {
$result = LoginData::signinByOpenID($partnerInfo['screen_name'], $access['uid'], 'sina');
$shoppingKey = Helpers::getShoppingKeyByCookie();
$result = LoginData::signinByOpenID($partnerInfo['screen_name'], $access['uid'], 'sina', $shoppingKey);
}
//判定是否需要绑定手机号
if (isset($result['data']['is_bind']) && $result['data']['is_bind'] == 'N') {
... ...