Authored by 梁志锋

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

... ... @@ -23,18 +23,17 @@ class Yohobuy
// const SERVICE_URL = 'http://service.api.yohobuy.com/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_URL = 'http://apih5.yoho.cn/';
// const API_URL2 = 'http://apih5.yoho.cn/';
// const SERVICE_URL = 'http://serviceh5.yoho.cn/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://api2.open.yohobuy.com/';
/* 测试环境 */
const API_URL = 'http://testapi.yoho.cn:28078/';
const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
const API_URL = 'http://apih5.yoho.cn/';
const API_URL2 = 'http://apih5.yoho.cn/';
const SERVICE_URL = 'http://serviceh5.yoho.cn/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_OLD = 'http://test2.open.yohobuy.com/';
const API_OLD = 'http://api2.open.yohobuy.com/';
// /* 测试环境 */
// const API_URL = 'http://testapi.yoho.cn:28078/';
// const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://test2.open.yohobuy.com/';
/**
* 私钥列表
... ...
... ... @@ -24,15 +24,20 @@ class LoginData
* @param string $area 地区编号
* @param string $profile 邮箱或手机号
* @param string $password 密码
* @param string $shoppingKey 未登录用户唯一识别码, 默认为空
* @return array
*/
public static function signin($area, $profile, $password)
public static function signin($area, $profile, $password, $shoppingKey = null)
{
$param = Yohobuy::param();
$param['method'] = 'app.passport.signin';
$param['area'] = $area;
$param['profile'] = $profile;
$param['password'] = $password;
if (!empty($shoppingKey)) {
$param['shopping_key'] = $shoppingKey;
}
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(Yohobuy::API_URL, $param);
... ... @@ -59,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();
... ... @@ -71,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);
}
... ...
... ... @@ -14,7 +14,7 @@
{{#if freebieOrAdvanceBuy}}
<ul class="freebie-and-advance-buy">
{{# freebie}}
{{#if freebie}}
<li class="freebie">
<a href="/cart/index/gift?cartType={{cartType}}">
<span class="iconfont">&#xe620;</span>
... ... @@ -23,7 +23,7 @@
<span class="count">{{giftCount}}</span>
</a>
</li>
{{/ freebie}}
{{/if}}
{{#if advanceBuy}}
<li class="advance-buy">
<a href="/cart/index/advanceBuy?cartType={{cartType}}">
... ...
... ... @@ -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)) {
... ...
... ... @@ -124,7 +124,9 @@ class LoginController extends AbstractAction
}
/* 调用登录接口进行登录 */
$data = LoginData::signin($area, $profile, $password);
// 获取未登录时的唯一识别码
$shoppingKey = Helpers::getShoppingKeyByCookie();
$data = LoginData::signin($area, $profile, $password, $shoppingKey);
if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) {
break;
}
... ... @@ -191,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);
}
//判定是否需要绑定手机号
... ... @@ -227,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);
}
//判定是否需要绑定手机号
... ... @@ -264,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') {
... ...