Authored by 周少峰

Merge branch 'feature/globalDetailSeo' into feature/seo

... ... @@ -283,21 +283,31 @@ module.exports = class extends global.yoho.BaseModel {
}
});
let ht;
if (params.keywords) {
nav = [
{
name: '搜索结果'
}
];
ht = `${params.keywords}`;
} else {
nav = _this._getNav(params.id, menuData, params.url);
ht = _.last(nav).name;
}
return {
nav: nav,
data: {
menuData: menuData,
contData: contData
contData: contData,
seoData: {
title: `有货${ht}-帮助中心-YOHO!BUY有货 100%正品保证`,
keywords: `${ht},有货${ht},有货${ht}帮助中心`,
description: `有货${ht}YOHO!BUY有货帮助中心${ht}频道,提供有关${ht}相关问题解答。YOHO!BUY有货100%品牌正品保证,支持货到付款。`
}
}
};
}
... ...
... ... @@ -20,14 +20,7 @@ const config = global.yoho.config;
*/
const index = (req, res, next) => {
let params = req.query;
let resData = {
title: '潮流商品搜索 | YOHO!BUY 有货',
keywords: 'Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,' +
'品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,' +
'new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流',
description: '潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜'
};
let resData = {};
search.getKeyActivity(params.query).then(activityUrl => {
if (activityUrl) {
... ... @@ -38,12 +31,20 @@ const index = (req, res, next) => {
return search.getSearchData(Object.assign(params, {uid: req.user.uid, prid: req.user.prid}),
req.yoho.channel).then(result => {
let queryKey = req.query.query;
Object.assign(resData, result);
if (!_.get(resData, 'search.goods') || !_.get(resData, 'search.goods').length) {
_.set(resData, 'search.keyWord', req.query.query);
_.set(resData, 'search.keyWord', queryKey);
return res.render('search/no-result', resData);
}
Object.assign(resData, {
title: `${queryKey}价格_图片_品牌_怎么样-YOHO!BUY有货`,
keywords: `${queryKey},${queryKey}价格,${queryKey}图片,${queryKey}怎么样,${queryKey}品牌,YOHO!BUY有货`,
description: `YOHO!BUY有货网yohobuy.com是国内专业的${queryKey}网上潮流购物商城,为您找到${_.get(resData, 'search.totalCount', 0)}${queryKey}、产品的详细参数,实时报价,价格行情,图片、评价、品牌等信息。买${queryKey},就上YOHO!BUY有货` // eslint-disable-line
});
res.render('search/index', resData);
});
... ...
... ... @@ -140,6 +140,23 @@ const _handelGlobalSort = (origin, params, originParams) => {
};
};
const _getProductSeoData = (detail) => {
let resData = {};
if (!_.isEmpty(detail)) {
let gn = detail.product_name,
bn = _.get(detail, 'brand_info.brand_name') || detail.product_source;
resData = {
title: `${bn} | ${gn}正品 | YOHO!BUY 有货`,
keywords: `${bn},${bn}官网专卖店,${bn}官方授权店,${bn}正品,${bn}打折,${bn}折扣店,${bn}真品,${bn}代购`,
description: `YOHO!BUY 有货-${bn}官方授权店,${gn}图片、报价、介绍。YOHO!BUY 有货${bn}官网专卖店提供${bn}正品、${bn}真品、 ${bn}打折、${bn}代购等。` // eslint-disable-line
};
}
return resData;
};
const getGlobalProductListData = (params, yoho) => {
let limitNum = params.limit ? params.limit - 1 : 59;
let dps = {};
... ... @@ -340,7 +357,7 @@ const getGlobalProductDetailData = (skn, channelNum, channel) => {
Object.assign(resData, result.header, {
goodsInfo: detailInfo,
detailHtml: html || ''
});
}, _getProductSeoData(detailInfo));
return resData;
});
... ...
... ... @@ -333,7 +333,7 @@ exports.handleOptsData = (params, total, extra) => {
};
// 用来标记是否是折扣专场,折扣专场只需要前三个排序参数
let count = (extra === 'discont') ? 3 : 4;
let count = (extra === 'discont') ? 4 : 5;
for (let i = 0; i < count; i++) {
let opt = {};
... ... @@ -358,6 +358,24 @@ exports.handleOptsData = (params, total, extra) => {
}
break;
case 1:
if (params.order !== 'h_v_desc' && params.order !== 'h_v_asc') {
opt.href = handleFilterUrl(params, {order: 'h_v_desc'}, {page: true});
opt.hasSortOrient = true;
} else {
opt.hasSortOrient = true;
opt.active = true;
if (params.order === 'h_v_desc') {
opt.href = handleFilterUrl(params, {order: 'h_v_asc'}, {page: true});
opt.desc = false;
} else {
opt.href = handleFilterUrl(params, {order: 'h_v_desc'}, {page: true});
opt.desc = true;
}
}
opt.name = '人气';
break;
case 2:
if (params.order !== 's_t_desc' && params.order !== 's_t_asc') {
opt.href = handleFilterUrl(params, {order: 's_t_desc'}, {page: true});
opt.hasSortOrient = true;
... ... @@ -375,7 +393,7 @@ exports.handleOptsData = (params, total, extra) => {
opt.name = '最新';
break;
case 2:
case 3:
if (params.order !== 's_p_desc' && params.order !== 's_p_asc') {
opt.href = handleFilterUrl(params, {order: 's_p_desc'}, {page: true});
opt.hasSortOrient = true;
... ... @@ -393,7 +411,7 @@ exports.handleOptsData = (params, total, extra) => {
opt.name = '价格';
break;
case 3:
case 4:
if (params.order !== 'p_d_desc' && params.order !== 'p_d_asc') {
opt.href = handleFilterUrl(params, {order: 'p_d_desc'}, {page: true});
opt.hasSortOrient = true;
... ...
... ... @@ -31,6 +31,75 @@ module.exports = [
origin: '/new?order=s_t_desc&msort=10',
target: helpers.urlFormat('/lifestyle-new/', null, 'list')
},
// 男生销售类目一级菜单
{
type: TYPE.redirect,
origin: '/?gender=1,3&msort=1,3',
target: helpers.urlFormat('/?category_id=5,8&gender=1,3', null, 'list')
},
{
type: TYPE.redirect,
origin: '/?gender=1,3&msort=6',
target: helpers.urlFormat('/?category_id=11&gender=1,3', null, 'list')
},
{
type: TYPE.redirect,
origin: '/?gender=1,3&msort=7',
target: helpers.urlFormat('/?category_id=14&gender=1,3', null, 'list')
},
{
type: TYPE.redirect,
origin: '/?gender=1,3&msort=8',
target: helpers.urlFormat('/?category_id=17&gender=1,3', null, 'list')
},
// 女生销售类目一级菜单
{
type: TYPE.redirect,
origin: '/?gender=2,3&msort=1,3',
target: helpers.urlFormat('/?category_id=18,31,25&gender=2,3', null, 'list')
},
{
type: TYPE.redirect,
origin: '/?gender=2,3&msort=6',
target: helpers.urlFormat('/?category_id=52&gender=2,3', null, 'list')
},
{
type: TYPE.redirect,
origin: '/?gender=2,3&msort=7',
target: helpers.urlFormat('/?category_id=59&gender=2,3', null, 'list')
},
{
type: TYPE.redirect,
origin: '/?gender=2,3&msort=8,10,241',
target: helpers.urlFormat('/?category_id=76&gender=2,3', null, 'list')
},
// 潮童销售类目一级菜单
{
type: TYPE.redirect,
origin: '/?gender=1,2,3&misort=382,368,372,448,392,388,384,414,429,390,425,464&msort=365',
target: helpers.urlFormat('/?category_id=13,16,15&gender=1,2,3', null, 'list')
},
// 创意生活销售类目一级菜单
{
type: TYPE.redirect,
origin: '/?msort=10&misort=103',
target: helpers.urlFormat('/?category_id=21', null, 'list')
},
{
type: TYPE.redirect,
origin: '/?msort=10&misort=266',
target: helpers.urlFormat('/?category_id=20', null, 'list')
},
{
type: TYPE.redirect,
origin: '/?msort=10&misort=101,280',
target: helpers.urlFormat('/?category_id=251', null, 'list')
},
{
type: TYPE.redirect,
origin: '/?misort=259&msort=10',
target: helpers.urlFormat('/?category_id=23', null, 'list')
},
// 筛选参数排序匹配
{
... ...