Authored by hf

Merge branch 'develop' into test

... ... @@ -24,15 +24,21 @@ 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);
... ...
... ... @@ -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}}">
... ...
... ... @@ -63,10 +63,6 @@ class CartModel
// 调用接口获取购物车的数据
$cartData = CartData::cartData($uid, $shoppingKey);
// 当购物车为空时,用户也已经登录过, 再取一次
if (empty($cartData['data']) && is_numeric($uid) && !empty($shoppingKey)) {
$cartData = CartData::cartData(0, $shoppingKey);
}
// 处理普通购物车和预售购物车的数据
do {
... ...
... ... @@ -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;
}
... ...