Authored by htoooth

merge master

... ... @@ -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);
}
... ...
... ... @@ -295,6 +295,8 @@ let success = (req, res, next) => {
regService.getRegData().then((result) => {
res.render('reg/success', {
title: '注册成功',
module: 'passport',
page: 'reg-success',
simpleHeader: simpleHeaderModel.setSimpleHeaderData(),
passport: {
goUrl: goUrl,
... ...
... ... @@ -70,13 +70,8 @@ const showMain = (req, res, next) => {
}, nullUserInfo)).then((result)=> {
return res.render('product/detail', Object.assign({
module: 'product',
page: 'detail',
title_more: true,
title: _.get(result, 'seo.title', '') + ' | ' + SEO_SLOGAN,
keywords: _.get(result, 'seo.keywords', '').replace(/~+/, ''),
description_more: true,
description: result.description
}, result));
page: 'detail'
}, result.seo, result));
}).catch(next);
};
... ...
... ... @@ -6,6 +6,7 @@
'use strict';
const mRoot = '../models';
const list = require(`${mRoot}/list`);
const listSeoMap = require(`${global.middleware}/seo/listSeoMap`);
const helpers = global.yoho.helpers;
const _ = require('lodash');
... ... @@ -78,17 +79,21 @@ const shop = (shopId, req, res, next, brandInfo) => {
*/
exports.index = (req, res, next) => {
let resData = {};
let qs = req._parsedOriginalUrl.query || '';
list.getListData(req.query, req.yoho.channel).then(result => {
Object.assign(resData, result);
if (qs) {
Object.assign(resData, listSeoMap[qs] || {});
}
// 查询结果为空则不cache
if (_.isEmpty(_.get(resData, 'list.goods', []))) {
res.set('Cache-Control', 'no-cache');
}
res.render('list/index', resData);
}).catch(next);
};
/**
... ...
... ... @@ -1089,15 +1089,21 @@ const _getSeoByGoodsInfo = (goodsInfo, navs) => {
title += navs[1].name + '|';
}
title += goodsInfo.name + '正品 ';
title += goodsInfo.name + '正品 | YOHO!BUY 有货';
let keywords = brandName + sortName + ',' + brandName + '官网专卖店,' + brandName + '官方授权店,' +
brandName + '正品,' + brandName + '打折,' + brandName + '折扣店,' + brandName + '真品,' + brandName + '代购';
let description = !goodsInfo.shareDesc ? goodsInfo.name : goodsInfo.shareDesc;
let description = `YOHO!BUY 有货-${brandName}官方授权店,${goodsInfo.name}图片、报价、介绍。` +
`YOHO!BUY 有货${brandName}官网专卖店提供${brandName}正品、${brandName}真品、 ${brandName}打折、${brandName}代购等。`;
let cononicalURL = goodsInfo.productUrl;
return {
title: title,
keywords: keywords,
description: description
keywords: keywords.replace(/~+/, ''),
description: description,
cononicalURL: cononicalURL
};
};
... ... @@ -1157,6 +1163,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', '');
... ... @@ -1467,7 +1474,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;
// 统计需要的商品信息
... ... @@ -1480,12 +1487,14 @@ 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;
statGoodsInfo.soldOut = soldOut ? 1 : 0;
result.productUrl = statGoodsInfo.productUrl;
// 商品的品牌信息
let bandInfo = {};
... ... @@ -1627,6 +1636,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;
... ...
... ... @@ -49,3 +49,4 @@
</div>
{{> product/stat}}
... ...
... ... @@ -28,4 +28,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}}
... ...
const seoMap = {
/* eslint-disable */
'gender=1,3&msort=1,3': {
title: '服饰|男装潮男服饰搭配,时尚休闲男装,商务男装|YOHO!BUY有货 100%正品保证',
keywords: '服饰,男装,潮男服饰,时尚休闲男装,商务男装,YOHO!BUY有货',
description: 'YOHO!BUY有货男装服饰提供时尚休闲男装,商务男装,潮男服饰搭配,教你穿出气质,搭出风采.购买当季最新款男装就到YOHO!BUY有货,100%正品保证'
},
'gender=1,3&msort=6': {
title: '鞋履|男鞋,休闲男鞋,商务男鞋,品牌男鞋|YOHO!BUY有货 100%正品保证',
keywords: '鞋履,男鞋,休闲男鞋,商务男鞋,品牌男鞋,YOHO!BUY有货',
description: 'YOHO!BUY有货男鞋鞋履频道提供品牌男鞋,休闲男鞋,商务男鞋,男鞋价格、评论、图片以及男鞋尺码对照表等相关信息等,购买男鞋就到YOHO!BUY有货,100%正品保证!'
},
'gender=1,3&msort=7': {
title: '包袋|男士手包,时尚男包,男包品牌,真皮男包新品|YOHO!BUY有货 100%正品保证',
keywords: '男包,男士手包,时尚男包,男包品牌,真皮男包',
description: 'YOHO!BUY有货男包频道提供精品男包,囊括商务公文包,单肩斜跨包,男士手包,男士钱包,双肩包等几大丰富品类,购买男包就到YOHO!BUY有货,100%正品保证!'
},
'gender=1,3&msort=8,10,241': {
title: '配饰其他|男士配饰,男士时尚配饰|YOHO!BUY有货 100%正品保证',
keywords: '配饰其他,男士配饰,男士时尚配饰,YOHO!BUY有货',
description: 'YOHO!BUY有货配饰其他频道提供新款男士配饰,时尚帽子、围巾、耳机音响、自拍神器等男士潮流配饰搭配商品。购买男士配饰就到YOHO!BUY有货,100%正品保证!'
},
'gender=2,3&msort=1,3': {
title: '服饰|女装,时尚女装品牌,潮流女装|YOHO!BUY有货 100%正品保证',
keywords: '服饰,女装,时尚女装,女装品牌,潮流女装,YOHO!BUY有货',
description: 'YOHO!BUY有货女装服饰提供时尚女装,女装品牌,潮流女装搭配,教你穿出气质,搭出风采.购买当季最新款女装就到YOHO!BUY有货,100%正品保证'
},
'gender=2,3&msort=6': {
title: '鞋履|女鞋,休闲女鞋,时尚女鞋,品牌女鞋|YOHO!BUY有货 100%正品保证',
keywords: '鞋履,女鞋,休闲女鞋,时尚女鞋,品牌女鞋,YOHO!BUY有货',
description: 'YOHO!BUY有货女鞋鞋履频道提供品牌女鞋,休闲女鞋,时尚女鞋,女鞋价格、评论、图片以及女鞋尺码对照表等相关信息等,购买女鞋就到YOHO!BUY有货,100%正品保证!'
},
'gender=2,3&msort=7': {
title: '包袋|女士手包,时尚女包,女包品牌,真皮女包新品|YOHO!BUY有货 100%正品保证',
keywords: '女包,女士手包,时尚女包,女包品牌,真皮女包,YOHO!BUY有货',
description: 'YOHO!BUY有货女包频道提供精品女包,囊括电脑包,女士手包,女士钱包,女士腰包,单肩斜跨包,双肩包等几大丰富品类,购买女包就到YOHO!BUY有货,100%正品保证!'
},
'gender=2,3&msort=8,10,241': {
title: '配饰其他|女士配饰,女士时尚配饰|YOHO!BUY有货 100%正品保证',
keywords: '配饰其他,女士配饰,女士时尚配饰,YOHO!BUY有货',
description: 'YOHO!BUY有货配饰其他频道提供新款女士配饰,时尚帽子、围巾、耳钉手链、腰带胸针等女士潮流配饰搭配商品。购买女士配饰就到YOHO!BUY有货,100%正品保证!'
},
'msort=365&gender=1,3&order=s_t_desc': {
title: '男童服饰|男童上衣外套,下装,时尚男童鞋包配饰|YOHO!BUY有货 100%正品保证',
keywords: '男童服饰,男童上衣外套,男童下装,时尚男童鞋包配饰,YOHO!BUY有货',
description: 'YOHO!BUY有货男童服饰提供时尚男童上衣外套,下装,时尚男童鞋包配饰,教你穿出可爱,搭出时尚.购买当季最新款男童服饰就到YOHO!BUY有货,100%正品保证'
},
'msort=365&order=s_t_desc&gender=2,3': {
title: '女童服饰|女童上衣外套,下装,时尚女童鞋包配饰|YOHO!BUY有货 100%正品保证',
keywords: '女童服饰,女童上衣外套,女童下装,时尚女童鞋包配饰,YOHO!BUY有货',
description: 'YOHO!BUY有货女童服饰提供时尚女童上衣外套,下装,时尚女童鞋包配饰,教你穿出可爱,搭出时尚.购买当季最新款女童服饰就到YOHO!BUY有货,100%正品保证'
},
'msort=365&misort=368,392,414,421,429,419,408': {
title: '潮童鞋包配饰|儿童鞋,儿童包,时尚潮童配饰|YOHO!BUY有货 100%正品保证',
keywords: '潮童鞋包配饰,儿童鞋,儿童包,时尚潮童配饰',
description: 'YOHO!BUY有货潮童鞋包配饰提供儿童鞋,儿童包,时尚潮童配饰,教你穿出可爱,搭出时尚.购买当季最新款潮童鞋包配饰就到YOHO!BUY有货,100%正品保证'
},
'msort=10&misort=103': {
title: '数码3c|数码,3c,数码产品配件|YOHO!BUY有货 100%正品保证',
keywords: '数码,3c,3c数码,数码产品配件,YOHO!BUY有货',
description: 'YOHO!BUY有货数码3c汇集数码产品配件,提供手机/ipad壳套,数码配件,耳机,手机配件,相机,智能装备,U盘,电脑架.购买3c数码就到YOHO!BUY有货,100%正品保证'
},
'msort=10&misort=266': {
title: '居家用品|居家生活,居家装修装饰购物|YOHO!BUY有货 100%正品保证',
keywords: '居家,居家用品,居家装修,居家装饰,居家生活',
description: 'YOHO!BUY有货居家频道提供家装修装饰购物,居家生活日用品、居家饰品,汇集家居饰品,杯子,储物收纳,雨伞,抱枕,香薰,床上用品等。购买居家日用品就到YOHO!BUY有货,100%正品保证!'
},
'msort=10&misort=101,280': {
title: '玩具娱乐|玩具,玩偶,DIY,文具,毛绒玩具|YOHO!BUY有货 100%正品保证',
keywords: '玩具娱乐,玩具,玩偶,DIY,文具,毛绒玩具',
description: 'YOHO!BUY有货玩具娱乐频道提供玩具娱乐,玩具,玩偶,DIY,文具,毛绒玩具等,购买娱乐玩具就到YOHO!BUY有货,100%正品保证!'
},
'msort=10&misort=259': {
title: '美妆|美白化妆品,日系美妆,美妆新品|YOHO!BUY有货 100%正品保证',
keywords: '美妆,美白化妆品,日系美妆,美妆新品',
description: 'YOHO!BUY有货美妆频道提供美白化妆品,日系美妆,美妆新品,汇集彩妆,香水,个人护理,纹身贴,面部护肤,美体瘦身等商品。购买美妆产品就到YOHO!BUY有货,100%正品保证!'
}
/* eslint-enable */
};
module.exports = seoMap;
... ...
... ... @@ -19,6 +19,11 @@ const seoMap = {
title: '创意生活|创意生活馆,潮流创意家居,家居生活用品|YOHO!BUY 有货 100%正品保证',
keywords: '创意生活,创意生活馆,潮流家居,潮流创意家居,家居生活用品,YOHO!BUY有货',
description: 'YOHO!BUY有货官网创意生活频道汇集了创意生活馆,潮流创意家居,家居生活用品等正品网购,给您的生活带来更多创意。YOHO!BUY有货购物100%正品保证,支持货到付款。'
},
'/coupon/index': {
title: '有货优惠券_有货现金优惠券,全场券,品类券,品牌券_领券频道-YOHO!BUY有货',
keywords: '有货优惠券,有货现金优惠券,全场券,品类券,品牌券',
description: 'YOHO!BUY有货官网领券频道,提供有货优惠券,有货现金优惠券,有货全场券,有货品类券,品牌券免费领取,让你做网购达人,省钱又省心!'
}
/* eslint-enable */
};
... ...
... ... @@ -4,6 +4,7 @@
* @date: 2016/6/16
*/
'use strict';
const helpers = global.yoho.helpers;
module.exports = () => {
return (req, res, next) => {
... ... @@ -11,6 +12,9 @@ module.exports = () => {
guangReg = /^\/guang/,
guangDetailReg = /.html$/;
if (req.subdomains.length > 1 && req.subdomains[1] === 'www') {
res.redirect(301, helpers.urlFormat(req.path, req.query || '', req.subdomains[0]));
}
if (req.subdomains.length) {
switch (req.subdomains[0]) {
case 'www': // 主站
... ...
... ... @@ -5,6 +5,7 @@
<title>{{title}}</title>
<meta name="keywords" content="{{keywords}}">
<meta name="description" content="{{description}}">
{{#if cononicalURL}} <link rel="cononical" href="{{cononicalURL}}"/> {{/if}}
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta http-equiv="cleartype" content="on">
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
... ...
... ... @@ -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.7",
"version": "5.3.12",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ... @@ -38,6 +38,7 @@
"cheerio": "^0.22.0",
"client-sessions": "^0.7.0",
"compression": "^1.6.2",
"connect-memcached": "^0.2.0",
"connect-multiparty": "^2.0.0",
"cookie-parser": "^1.4.3",
"cookie-session": "^1.2.0",
... ... @@ -59,6 +60,7 @@
"request-promise": "^3.0.0",
"serve-favicon": "^2.3.0",
"uuid": "^2.0.2",
"yoho-express-session": "^2.0.0",
"yoho-node-lib": "0.2.2",
"yoho-zookeeper": "^1.0.6"
},
... ... @@ -99,7 +101,7 @@
"shelljs": "^0.7.0",
"stylelint": "^6.8.0",
"stylelint-config-yoho": "^1.2.4",
"webpack": "^1.13.1",
"webpack": "1.13.2",
"webpack-dev-server": "^1.14.1",
"webpack-stream": "^3.1.0",
"yoho-eventproxy": "^0.3.6",
... ...
... ... @@ -7,6 +7,8 @@
"exec_mode": "cluster",
"merge_logs": true,
"log_date_format": "YYYY-MM-DD HH:mm Z",
"error_file": "/Data/logs/node/yohobuy-node-err.log",
"out_file": "/Data/logs/node/yohobuy-node-out.log",
"env": {
"TZ": "Asia/Shanghai",
"PORT": 6002
... ...
... ... @@ -109,7 +109,7 @@ function getShoppingKey() {
a.src = j;
m.parentNode.insertBefore(a, m);
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https' : 'http') + '://' + // eslint-disable-line
'cdn.yoho.cn/yas-jssdk/1.0.18/yas.js', '_yas')); // eslint-disable-line
'cdn.yoho.cn/yas-jssdk/2.1.1/yas.js', '_yas')); // eslint-disable-line
(function() {
var uid = getUid();
... ... @@ -119,7 +119,7 @@ function getShoppingKey() {
window._ozuid = uid; // 暴露ozuid
if (window._yas) {
window._yas(1 * new Date(), '1.0.18', 'yohobuy_web', uid, '', '');
window._yas(1 * new Date(), '2.1.1', 'yohobuy_web', uid, '', '');
}
}());
... ... @@ -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');
... ...
require('../common');
var $ = require('yoho-jquery'), // eslint-disable-line
yas = require('../common/data-yas');
var $countDown = $('#count-down'), // eslint-disable-line
$successBtn = $('.success-btn'),
countDown = 5,
clearT; // 注册成功页面5秒后跳转
if ($('.success-box').length > 0) {
clearT = setInterval(function() {
if (countDown === 0) {
window.location.href = $successBtn.attr('data-url');
clearInterval(clearT);
}
$countDown.text(countDown--);
}, 1000);
}
$(function() {
yas.givePoint('YB_REGISTER_SUCCESS_L');
});
... ...
... ... @@ -13,10 +13,6 @@ var $registerPage = $('.register-page'),
$pwdTip1 = $pwdTips.find('#pwd-tip1'),
$errTip = $('#err-tip'),
$registerBtn = $('#register-btn'),
$countDown = $('#count-down'),
$successBtn = $('.success-btn'),
countDown = 5,
clearT,
captchaImage = new Captcha('#captcha-img').init();
var $sendCaptcha = $('#send-captcha'),
... ... @@ -641,18 +637,4 @@ exports.init = function(page) {
});
}
});
// 注册成功页面5秒后跳转
if ($('.success-box').length > 0) {
clearT = setInterval(function() {
if (countDown === 0) {
window.location.href = $successBtn.attr('data-url');
clearInterval(clearT);
}
$countDown.text(countDown--);
}, 1000);
}
};
... ...
... ... @@ -1866,8 +1866,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 || '');
});
// 点击搜索列表商品
... ...
... ... @@ -1319,7 +1319,7 @@
.model-cards-wrapper {
height: 60px;
color: black;
margin-bottom: 20px;
margin-bottom: 30px;
.model-card-item {
... ...