Authored by 郝肖肖

加入购物车判断是否返回shoppingkey

... ... @@ -134,7 +134,13 @@ exports.addToCart = (req, res, next) => {
shoppingKey: req.cookies._SPK || null,
uid: req.user.uid
}).then((result) => {
res.cookie('_SPK', result.data.shopping_key, {maxAge: 1000 * 60 * 60 * 24 * 365, httpOnly: true, path: '/'});
if (result.data && result.data.shopping_key) {
res.cookie(
'_SPK',
result.data.shopping_key,
{maxAge: 1000 * 60 * 60 * 24 * 365, httpOnly: true, path: '/'}
);
}
res.json(result);
}).catch(next);
};
... ...