code review by hf: fixes some bugs
Showing
4 changed files
with
5 additions
and
4 deletions
@@ -129,7 +129,7 @@ class Helpers | @@ -129,7 +129,7 @@ class Helpers | ||
129 | */ | 129 | */ |
130 | public static function getShoppingKeyByCookie() | 130 | public static function getShoppingKeyByCookie() |
131 | { | 131 | { |
132 | - $cookie = isset($_COOKIE['_Spk']) ? $_COOKIE['_Spk'] : ''; | 132 | + $cookie = isset($_COOKIE['_SPK']) ? $_COOKIE['_SPK'] : ''; |
133 | 133 | ||
134 | return $cookie; | 134 | return $cookie; |
135 | } | 135 | } |
@@ -456,8 +456,8 @@ class IndexController extends AbstractAction | @@ -456,8 +456,8 @@ class IndexController extends AbstractAction | ||
456 | $result = CartModel::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid, $shoppingKey); | 456 | $result = CartModel::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid, $shoppingKey); |
457 | 457 | ||
458 | // 设置加入购物车凭证到客户端浏览器 | 458 | // 设置加入购物车凭证到客户端浏览器 |
459 | - if (!$shoppingKey && isset($result['data']['shopping_key'])) { | ||
460 | - $this->setCookie('_Spk', $result['data']['shopping_key']); | 459 | + if (empty($shoppingKey) && isset($result['data']['shopping_key'])) { |
460 | + $this->setCookie('_SPK', $result['data']['shopping_key'], time() + 86400 * 360); | ||
461 | } | 461 | } |
462 | } | 462 | } |
463 | 463 |
@@ -77,6 +77,7 @@ class LoginController extends AbstractAction | @@ -77,6 +77,7 @@ class LoginController extends AbstractAction | ||
77 | // 清除客户端 | 77 | // 清除客户端 |
78 | $this->setCookie('_UID', ''); | 78 | $this->setCookie('_UID', ''); |
79 | $this->setCookie('_TOKEN', ''); | 79 | $this->setCookie('_TOKEN', ''); |
80 | + $this->setCookie('_SPK', ''); | ||
80 | // 清除服务端会话 | 81 | // 清除服务端会话 |
81 | $this->setSession('_TOKEN', ''); | 82 | $this->setSession('_TOKEN', ''); |
82 | 83 |
-
Please register or login to post a comment