Authored by 周少峰

Merge branch 'master' into feature/new-product-arrive

... ... @@ -112,6 +112,10 @@ app.use((req, res, next) => {
req.session2.sessionBack = req.session;
} else {
req.session = new MemcachedSession.Session(req);
req.session.cookie = new MemcachedSession.Cookie({
domain: 'yohobuy.com',
httpOnly: false
});
req.session = _.assign(req.session, req.session2.sessionBack);
}
... ...
... ... @@ -1135,6 +1135,7 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => {
result.productId = propOrigin('product_id');
result.shopId = propOrigin('shop_id', 0);
result.brandId = propOrigin('brand_info.brand_id', '');
result.brandName = propOrigin('brand_info.brand_name', '');
result.maxSortId = propOrigin('maxSortId', '');
result.smallSortId = propOrigin('smallSortId', '');
... ... @@ -1445,7 +1446,7 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => {
// 分享相关,产品的链接
result.weixinUrl = propOrigin('product_url');
result.shareTitle = result.name;
result.shareImg = 'http:' + result.img; // 分享图片必须使用http
result.shareImg = helpers.getForceSourceUrl(result.img);
result.shareDesc = result.phrase;
// 统计需要的商品信息
... ... @@ -1458,7 +1459,7 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => {
statGoodsInfo.brandName = (result.brandName || '').replace('\'', '’');
statGoodsInfo.marketPrice = (result.marketPrice ? result.marketPrice : result.presalePrice).replace('¥', ''); // 数字
statGoodsInfo.salePrice = (result.salePrice ? result.salePrice : (result.marketPrice || result.presalePrice)).replace('¥', ''); // 数字
statGoodsInfo.imageUrl = 'http:' + result.img.split('?')[0];
statGoodsInfo.imageUrl = helpers.getForceSourceUrl(result.img);
statGoodsInfo.productUrl = 'http:' +
helpers.urlFormat(url.parse(propOrigin('product_url')).pathname, null, 'item');
statGoodsInfo.smallSortId = result.smallSortId;
... ... @@ -1607,6 +1608,12 @@ const showMainAsync = (data) => {
[{name: _.get(productInfo, 'goodsInfo.name')}]
);
// 统计代码中需要新的path
result.statGoodsInfo.category = _.concat(
homeService.getHomeChannelNav(data.channel),
smallSortNavigator
).map(n => n.name).join('>');
// 头部数据
result.headerData = navigatorHeader.headerData;
... ...
... ... @@ -567,4 +567,21 @@
s.parentNode.insertBefore(mvl, s);
})();
</script>
<script>
window.PING_YOU_VIEW_ITEM = {
'product_no':'{{productId}}',
'spu_id': '{{skn}}',
'name': '{{{productName}}}',
'category': '{{{category}}}',
'brand': '{{{brandName}}}',
'price': {{salePrice}},
'orig_price': {{marketPrice}},
'currency_code': 'CNY',
'product_url': '{{{productUrl}}}',
'pic_size': '',// 宽x高
'pc_pic_url': '{{{imageUrl}}}',
'promotion': '',
'sold_out': {{soldOut}}
};
</script>
{{/statGoodsInfo}}
... ...
... ... @@ -18,6 +18,16 @@ var _gaq = _gaq || [];
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
// 新品友代码
(function(w,d,s,l,a){
w._CommandName_=l;w[l]=w[l]||function(){(w[l].q=w[l].q||[]).push(arguments);
w[l].track = function(){(w[l].q[w[l].q.length-1].t=[]).push(arguments)};return w[l]},w[l].a=a,w[l].l=1*new Date();
var c = d.createElement(s);c.async=1;
c.src='//fm.ipinyou.com/j/t/a.js';
var h = d.getElementsByTagName(s)[0];h.parentNode.insertBefore(c, h);
})(window,document,'script','py','MC..o8vMMWxEXDCiqYckD81lUX');
py('set','user',{'id':'0'});
py('event','viewPage');
}
if (window.addEventListener) {
window.addEventListener('load', async_load, false);
... ...
{
"name": "yohobuy-node",
"version": "5.3.11",
"version": "5.3.12",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -215,6 +215,16 @@ function isLogin() {
}
}
// 品友
function addPyEvent(eventName, val) {
if (typeof window.py === 'function') {
window.py('event', eventName, val);
} else {
setTimeout(function() {
addPyEvent(eventName, val);
}, 3000);
}
}
window.cookie = cookie;
window.setCookie = setCookie;
... ... @@ -238,6 +248,7 @@ window.registerUrl = registerUrl;
window.jumpUrl = jumpUrl;
window.once = once;
window.addPyEvent = addPyEvent;
require('./header');
require('./footer');
... ...
... ... @@ -1844,8 +1844,9 @@ $(function() {
});
});
yasAtBottom.yasBottom();
// 统计代码
require('./detail/stat')();
... ...
/**
* 统计代码作用
*/
module.exports = function() {
// 品友统计代码
window.addPyEvent('viewItem', window.PING_YOU_VIEW_ITEM);
};
... ...
... ... @@ -88,6 +88,8 @@ $(function() {
// 关键词搜索结果页展示时
yas.givePoint(opt, loadYas);
// 品友
window.addPyEvent('viewSearch', qs.query || '');
});
// 点击搜索列表商品
... ...