Authored by hf

code review by hf: fixes some bugs

... ... @@ -129,7 +129,7 @@ class Helpers
*/
public static function getShoppingKeyByCookie()
{
$cookie = isset($_COOKIE['_Spk']) ? $_COOKIE['_Spk'] : '';
$cookie = isset($_COOKIE['_SPK']) ? $_COOKIE['_SPK'] : '';
return $cookie;
}
... ...
... ... @@ -71,7 +71,7 @@ class HomeModel
/**
* 设置选择的频道保存到浏览器COOKIE
* (已废弃,改成JS设置)
* (已废弃,改成JS设置)
*
* @param string $cookie
* @return void
... ...
... ... @@ -456,8 +456,8 @@ class IndexController extends AbstractAction
$result = CartModel::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid, $shoppingKey);
// 设置加入购物车凭证到客户端浏览器
if (!$shoppingKey && isset($result['data']['shopping_key'])) {
$this->setCookie('_Spk', $result['data']['shopping_key']);
if (empty($shoppingKey) && isset($result['data']['shopping_key'])) {
$this->setCookie('_SPK', $result['data']['shopping_key'], time() + 86400 * 360);
}
}
... ...
... ... @@ -77,6 +77,7 @@ class LoginController extends AbstractAction
// 清除客户端
$this->setCookie('_UID', '');
$this->setCookie('_TOKEN', '');
$this->setCookie('_SPK', '');
// 清除服务端会话
$this->setSession('_TOKEN', '');
... ...