Authored by 陈峰

Merge branch 'hotfix/cookie' into 'gray'

Hotfix/cookie



See merge request !188
... ... @@ -10,7 +10,7 @@ const TYPE = require('../type');
module.exports = [
{
type: TYPE.redirect,
origin: /\/about\?shopId=([\d]+)/,
origin: /^\/about\?shopId=([\d]+)/,
target: (req, match, id) => {
return helpers.urlFormat(`/shop${id}-about`, null, req.subdomains[0]);
}
... ...
... ... @@ -139,7 +139,7 @@ module.exports = [
},
{
type: TYPE.rewrite,
origin: /\/(.*)-new/,
origin: /^\/(.*)-new/,
target: (req, match, channel) => {
return `/product/list/${channel}-new`;
}
... ...
... ... @@ -102,7 +102,7 @@ module.exports = [
// 新品到着
{
type: TYPE.rewrite,
origin: /\/(.*)-new/,
origin: /^\/(.*)-new/,
target: (req, match, channel) => {
return `/product/list/${channel}-new`;
}
... ... @@ -179,7 +179,7 @@ module.exports = [
},
{
type: TYPE.rewrite,
origin: /\/shop([\d]+)-about/,
origin: /^\/shop([\d]+)-about/,
target: (req, match, id) => {
req.query.domain = req.subdomains[0];
req.query.shopId = id;
... ...
... ... @@ -45,7 +45,7 @@ var _gaq = _gaq || [];
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
if (getUid() !== 0) {
if (window.getUid && window.getUid() !== 0) {
_hmt.push(['_setCustomVar', 2, 'login', 'PC', 2]);
}
})();
... ...
... ... @@ -18,7 +18,11 @@ function cookie(name) {
var re = new RegExp(name + '=([^;$]*)', 'i'),
matchPattern = '$1';
return re.test(decodeURIComponent(document.cookie)) ? RegExp[matchPattern] : '';
try {
return re.test(decodeURIComponent(document.cookie)) ? RegExp[matchPattern] : '';
} catch (e) {
return decodeURIComponent(re.test(document.cookie) ? RegExp[matchPattern] : '');
}
}
function setCookie(name, value, options) {
... ...
... ... @@ -7,6 +7,7 @@
'use strict';
const _ = require('lodash');
// const logger = global.yoho.logger;
const queryString = require('querystring');
... ... @@ -57,6 +58,7 @@ const transformKey = (params, isFull) => {
matchParams[name] = value;
} else {
extraParams[key] = value;
// logger.info(`list parameter [${key}] map value not found`);
}
});
... ...