Authored by 周少峰

Merge branch 'hotfix/pz'

@@ -55,7 +55,7 @@ const getCoupons = (req, res, next) => { @@ -55,7 +55,7 @@ const getCoupons = (req, res, next) => {
55 */ 55 */
56 const setShoppingCookie = (req, res) => { 56 const setShoppingCookie = (req, res) => {
57 57
58 - let uid = req.user.uid || true; 58 + let uid = req.user.uid;
59 let shoppingKey = helper.getShoppingKeyByCookie(req); 59 let shoppingKey = helper.getShoppingKeyByCookie(req);
60 60
61 return service.getCartCount(uid, shoppingKey).then(ret => { 61 return service.getCartCount(uid, shoppingKey).then(ret => {
@@ -29,6 +29,8 @@ module.exports = (limiter, policy) => { @@ -29,6 +29,8 @@ module.exports = (limiter, policy) => {
29 29
30 const key = `pc:limiter:${limiter.remoteIp}`; 30 const key = `pc:limiter:${limiter.remoteIp}`;
31 31
  32 + let isNew = false;
  33 +
32 res.on('render', function() { 34 res.on('render', function() {
33 let route = req.route ? req.route.path : ''; 35 let route = req.route ? req.route.path : '';
34 let appPath = req.app.mountpath; 36 let appPath = req.app.mountpath;
@@ -44,7 +46,7 @@ module.exports = (limiter, policy) => { @@ -44,7 +46,7 @@ module.exports = (limiter, policy) => {
44 pageIncr = 5; 46 pageIncr = 5;
45 } 47 }
46 48
47 - if (pageIncr > 0) { 49 + if (pageIncr > 0 && !isNew) {
48 cache.incrAsync(key, pageIncr); 50 cache.incrAsync(key, pageIncr);
49 } 51 }
50 }); 52 });
@@ -70,6 +72,7 @@ module.exports = (limiter, policy) => { @@ -70,6 +72,7 @@ module.exports = (limiter, policy) => {
70 } 72 }
71 } else { 73 } else {
72 cache.setAsync(key, 1, 60); // 设置key,1m失效 74 cache.setAsync(key, 1, 60); // 设置key,1m失效
  75 + isNew = true;
73 return Promise.resolve(true); 76 return Promise.resolve(true);
74 } 77 }
75 }); 78 });
1 { 1 {
2 "name": "yohobuy-node", 2 "name": "yohobuy-node",
3 - "version": "5.4.12", 3 + "version": "5.4.13",
4 "private": true, 4 "private": true,
5 "description": "A New Yohobuy Project With Express", 5 "description": "A New Yohobuy Project With Express",
6 "repository": { 6 "repository": {
@@ -772,7 +772,7 @@ $('#order-submit').click(function() { @@ -772,7 +772,7 @@ $('#order-submit').click(function() {
772 window._fxcmd.push(['trackOrder', { 772 window._fxcmd.push(['trackOrder', {
773 oid: rdata.order_code, 773 oid: rdata.order_code,
774 otp: rdata.order_amount, 774 otp: rdata.order_amount,
775 - u_info: window.getUser(), 775 + u_info: window.getUid(),
776 u_type: newUser 776 u_type: newUser
777 }, []]); 777 }, []]);
778 window.setCookie('__NEW_USER', 0); 778 window.setCookie('__NEW_USER', 0);