Authored by htoooth

Merge branch 'feature/seo-product' into release/6.3

... ... @@ -41,7 +41,7 @@ const tdk = require('./utils/getTDK');
helpers.image = _.flow(helpers.image, fp.replace(/\/quality\/\d*$/, '/quality/90'));
// NOTE:这里修改了参数的个数
helpers.getUrlBySkc = skn => `//item.yohobuy.com/${skn}.html`;
helpers.getUrlBySkc = skn => `//www.yohobuy.com/product/${skn}.html`;
global.middleware = path.resolve('./doraemon/middleware');
global.utils = path.resolve('./utils');
... ...
... ... @@ -158,7 +158,7 @@
{{/if_cond}}
</td>
<td class="border-top color-size">
颜色:<span class="color">{{color_name}}</span>
颜色:<span class="color">{{factory_goods_name}}</span>
尺码:<span class="size">{{size_name}}</span>
</td>
<td class="border-top price">
... ...
... ... @@ -760,8 +760,10 @@ module.exports = class extends global.yoho.BaseModel {
let arr = {};
for (let it of val.list) {
productSkn.push(it.id);
arr[it.id] = it.src;
if (it) {
productSkn.push(it.id);
arr[it.id] = it.src;
}
}
if (productSkn.length) {
... ...
... ... @@ -909,6 +909,24 @@ function _getIntroInfo(productSkn, maxSortId, additionalData) {
return result;
}
function _genderHelper(gender) {
gender = gender || '';
switch (gender) {
case '1':
case '1,3': {
return '男款';
}
case '2':
case '2,3': {
return '女款';
}
default: {
return '';
}
}
}
/**
* 获取seo信息
*
... ... @@ -924,17 +942,28 @@ function _getSeoByGoodsInfo(goodsInfo, navs) {
goodsInfo = goodsInfo || {};
navs = navs || [];
if (goodsInfo.brandName) {
title = goodsInfo.brandName + ' ';
if (_.get(goodsInfo, 'data.brand_info.brand_name', '')) {
brandName = goodsInfo.brandName;
}
if (_.get(goodsInfo, 'data.brand_info.brand_name_en')) {
title += _.get(goodsInfo, 'data.brand_info.brand_name_en') + '|';
}
if (_.get(goodsInfo, 'data.brand_info.brand_name_cn')) {
title += _.get(goodsInfo, 'data.brand_info.brand_name_cn') + '|';
}
if (_.get(goodsInfo, 'data.gender')) {
title += _genderHelper(_.get(goodsInfo, 'data.gender', '1,3')) + '|';
}
if (_.get(navs, '[1].name')) {
sortName = navs[1].name;
title += navs[1].name + '|';
}
title += goodsInfo.name + '正品 | YOHO!BUY 有货';
title += _.get(goodsInfo, 'data.product_name') + '正品 | YOHO!BUY 有货';
let keywords = brandName + sortName + ',' + brandName + '专卖店,' + brandName + '官方授权店,' +
brandName + '正品,' + brandName + '打折,' + brandName + '折扣店,' + brandName + '真品,' + brandName + '代购';
... ... @@ -1534,7 +1563,7 @@ function showMainAsync(req, data) {
result.detail.goodsInfo.imageBanner = _getProductActivityBanner(productDescription.banner);
// seo
result.seo = _getSeoByGoodsInfo(productInfo.goodsInfo, sortNavigator);
result.seo = _getSeoByGoodsInfo(productData, sortNavigator);
// 商品页面统计
result.statGoodsInfo = Object.assign({fullSortName: sortNavigator.map(x => x.name).join('-')},
... ... @@ -1595,7 +1624,7 @@ function recommendAsync(skn, page, limit) {
}
const formatPrice = p => ${p}`;
const productUrl = (productSkn) => helpers.getUrlBySkc(productSkn);
const productUrl = helpers.getUrlBySkc;
const productImageUrl = Fn.pipe(Fn.prop('default_images'), _.partial(helpers.image, _, 280, 382, 2, 70));
let products = _.get(recommendData, 'data.product_list', []).map((rp) => {
... ...
... ... @@ -27,54 +27,55 @@ const channelMap = {
const sortMap = {
boys: [
{misort: 18, viewNum: 5},
{misort: 20, viewNum: 5},
{misort: 16, viewNum: 5},
{misort: 21, viewNum: 5},
{misort: 1900, viewNum: 5},
{misort: 1904, viewNum: 5},
{misort: 226, viewNum: 5},
{misort: 1896, viewNum: 5},
{misort: 44, viewNum: 5},
{misort: 26, viewNum: 5},
{misort: 27, viewNum: 5},
{misort: 44, viewNum: 5},
{misort: 1900, viewNum: 5},
{misort: 45, viewNum: 5},
{misort: 1892, viewNum: 5},
{misort: 49, viewNum: 5},
{misort: 60, viewNum: 5},
{misort: 39, viewNum: 5}
{misort: 1896, viewNum: 5},
{misort: 39, viewNum: 5},
{misort: 59, viewNum: 5}
],
girls: [
{misort: 18, viewNum: 4},
{misort: 20, viewNum: 4},
{misort: 21, viewNum: 4},
{misort: 16, viewNum: 4},
{misort: 1900, viewNum: 4},
{misort: 1904, viewNum: 4},
{misort: 1896, viewNum: 4},
{misort: 1892, viewNum: 4},
{misort: 20, viewNum: 4},
{misort: 1896, viewNum: 4},
{misort: 44, viewNum: 4},
{misort: 26, viewNum: 4},
{misort: 27, viewNum: 4},
{misort: 26, viewNum: 4},
{misort: 45, viewNum: 4},
{misort: 226, viewNum: 4},
{misort: 172, viewNum: 4},
{misort: 31, viewNum: 4},
{misort: 49, viewNum: 4},
{misort: 50, viewNum: 4},
{misort: 60, viewNum: 4},
{misort: 65, viewNum: 4}
{misort: 66, viewNum: 4},
{misort: 39, viewNum: 4},
{misort: 60, viewNum: 4}
],
kids: [
{misort: 400, viewNum: 4},
{misort: 430, viewNum: 4},
{misort: 423, viewNum: 4},
{misort: 396, viewNum: 4},
{misort: 404, viewNum: 4},
{misort: 400, viewNum: 4},
{misort: 368, viewNum: 4},
{misort: 406, viewNum: 4},
{misort: 390, viewNum: 4},
{misort: 414, viewNum: 4},
{misort: 448, viewNum: 4},
{misort: 368, viewNum: 4},
{misort: 384, viewNum: 4},
{misort: 369, viewNum: 4},
{misort: 388, viewNum: 4},
{misort: 392, viewNum: 4},
{misort: 429, viewNum: 4},
{misort: 448, viewNum: 4},
{misort: 408, viewNum: 4},
{misort: 470, viewNum: 4},
{misort: 406, viewNum: 4},
{misort: 388, viewNum: 4}
{misort: 414, viewNum: 4}
],
lifestyle: [
{msort: 1170, viewNum: 5},
... ...
... ... @@ -56,7 +56,7 @@ module.exports = (req, res, next) => {
_.includes(PATH_WHITE_LIST, req.path) || req.xhr || !_.isEmpty(_.get(req, 'user.uid'));
const enabled = !_.get(req.app.locals, 'pc.sys.noLimiter');
logger.info(`request remote ip: ${remoteIp}; excluded: ${excluded}; enabled: ${enabled}`);
logger.debug(`request remote ip: ${remoteIp}; excluded: ${excluded}; enabled: ${enabled}`);
// 判断获取remoteIp成功,并且开关未关闭
if (enabled && remoteIp && !excluded) {
... ...