Merge branch 'develop' into test
Showing
4 changed files
with
12 additions
and
8 deletions
@@ -24,15 +24,21 @@ class LoginData | @@ -24,15 +24,21 @@ class LoginData | ||
24 | * @param string $area 地区编号 | 24 | * @param string $area 地区编号 |
25 | * @param string $profile 邮箱或手机号 | 25 | * @param string $profile 邮箱或手机号 |
26 | * @param string $password 密码 | 26 | * @param string $password 密码 |
27 | + * @param string $shoppingKey 未登录用户唯一识别码, 默认为空 | ||
27 | * @return array | 28 | * @return array |
28 | */ | 29 | */ |
29 | - public static function signin($area, $profile, $password) | 30 | + public static function signin($area, $profile, $password, $shoppingKey = null) |
30 | { | 31 | { |
31 | $param = Yohobuy::param(); | 32 | $param = Yohobuy::param(); |
32 | $param['method'] = 'app.passport.signin'; | 33 | $param['method'] = 'app.passport.signin'; |
33 | $param['area'] = $area; | 34 | $param['area'] = $area; |
34 | $param['profile'] = $profile; | 35 | $param['profile'] = $profile; |
35 | $param['password'] = $password; | 36 | $param['password'] = $password; |
37 | + | ||
38 | + if (!empty($shoppingKey)) { | ||
39 | + $param['shopping_key'] = $shoppingKey; | ||
40 | + } | ||
41 | + | ||
36 | $param['client_secret'] = Sign::getSign($param); | 42 | $param['client_secret'] = Sign::getSign($param); |
37 | 43 | ||
38 | return Yohobuy::post(Yohobuy::API_URL, $param); | 44 | return Yohobuy::post(Yohobuy::API_URL, $param); |
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | 14 | ||
15 | {{#if freebieOrAdvanceBuy}} | 15 | {{#if freebieOrAdvanceBuy}} |
16 | <ul class="freebie-and-advance-buy"> | 16 | <ul class="freebie-and-advance-buy"> |
17 | - {{# freebie}} | 17 | + {{#if freebie}} |
18 | <li class="freebie"> | 18 | <li class="freebie"> |
19 | <a href="/cart/index/gift?cartType={{cartType}}"> | 19 | <a href="/cart/index/gift?cartType={{cartType}}"> |
20 | <span class="iconfont"></span> | 20 | <span class="iconfont"></span> |
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | <span class="count">{{giftCount}}</span> | 23 | <span class="count">{{giftCount}}</span> |
24 | </a> | 24 | </a> |
25 | </li> | 25 | </li> |
26 | - {{/ freebie}} | 26 | + {{/if}} |
27 | {{#if advanceBuy}} | 27 | {{#if advanceBuy}} |
28 | <li class="advance-buy"> | 28 | <li class="advance-buy"> |
29 | <a href="/cart/index/advanceBuy?cartType={{cartType}}"> | 29 | <a href="/cart/index/advanceBuy?cartType={{cartType}}"> |
@@ -63,10 +63,6 @@ class CartModel | @@ -63,10 +63,6 @@ class CartModel | ||
63 | 63 | ||
64 | // 调用接口获取购物车的数据 | 64 | // 调用接口获取购物车的数据 |
65 | $cartData = CartData::cartData($uid, $shoppingKey); | 65 | $cartData = CartData::cartData($uid, $shoppingKey); |
66 | - // 当购物车为空时,用户也已经登录过, 再取一次 | ||
67 | - if (empty($cartData['data']) && is_numeric($uid) && !empty($shoppingKey)) { | ||
68 | - $cartData = CartData::cartData(0, $shoppingKey); | ||
69 | - } | ||
70 | 66 | ||
71 | // 处理普通购物车和预售购物车的数据 | 67 | // 处理普通购物车和预售购物车的数据 |
72 | do { | 68 | do { |
@@ -124,7 +124,9 @@ class LoginController extends AbstractAction | @@ -124,7 +124,9 @@ class LoginController extends AbstractAction | ||
124 | } | 124 | } |
125 | 125 | ||
126 | /* 调用登录接口进行登录 */ | 126 | /* 调用登录接口进行登录 */ |
127 | - $data = LoginData::signin($area, $profile, $password); | 127 | + // 获取未登录时的唯一识别码 |
128 | + $shoppingKey = Helpers::getShoppingKeyByCookie(); | ||
129 | + $data = LoginData::signin($area, $profile, $password, $shoppingKey); | ||
128 | if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) { | 130 | if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) { |
129 | break; | 131 | break; |
130 | } | 132 | } |
-
Please register or login to post a comment