...
|
...
|
@@ -531,6 +531,29 @@ function _getSortNavAsync(smallSortId, gender) { |
|
|
})();
|
|
|
}
|
|
|
|
|
|
// 保存在 gids 和 skns ,最近流览功能
|
|
|
const saveRecentGoodInCookies = (oldGids, oldSkns, res, addGids, addSkns) => {
|
|
|
oldGids = (oldGids || '').split(',');
|
|
|
oldSkns = (oldSkns || '').split(',');
|
|
|
addSkns = `${addSkns}-${addGids}`;
|
|
|
|
|
|
_.remove(oldGids, addGids);
|
|
|
_.remove(oldSkns, addSkns);
|
|
|
|
|
|
oldGids.unshift(addGids);
|
|
|
oldSkns.unshift(addSkns);
|
|
|
|
|
|
res.cookie('_browse', oldGids.splice(0, 30).join(','), {
|
|
|
maxAge: 2000000000,
|
|
|
domain: 'yohobuy.com'
|
|
|
});
|
|
|
|
|
|
res.cookie('_browseskn', oldSkns.splice(0, 30).join(','), {
|
|
|
maxAge: 2000000000,
|
|
|
domain: 'yohobuy.com'
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 详情页数据格式化
|
|
|
* @param origin Object 原始数据
|
...
|
...
|
@@ -632,7 +655,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => { |
|
|
if (origin.brand) {
|
|
|
result.brandImg = helpers.image(origin.brand.brandIco, 47, 47);
|
|
|
result.brandName = origin.brand.brandName;
|
|
|
result.brandUrl = helpers.urlFormat('', {}, origin.brand.brandDomain);
|
|
|
result.brandUrl = helpers.urlFormat('', null, origin.brand.brandDomain);
|
|
|
banner = _getBrandDataByProductBaseInfo(origin);
|
|
|
if (banner.isCollect && favoriteData.brand) {
|
|
|
banner.isCollect = favoriteData.brand;
|
...
|
...
|
@@ -723,7 +746,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => { |
|
|
// 分享相关,产品的链接
|
|
|
result.weixinUrl = helpers.urlFormat(origin.productUrl, {}, 'item');
|
|
|
result.shareTitle = result.name;
|
|
|
result.shareImg = result.img;
|
|
|
result.shareImg = 'http:' + result.img;
|
|
|
result.shareDesc = result.phrase;
|
|
|
|
|
|
// 统计需要的商品信息
|
...
|
...
|
@@ -746,18 +769,19 @@ const _detailDataPkg = (origin, uid, vipLevel) => { |
|
|
|
|
|
if (domainBrand.type && domainBrand.shopId) {
|
|
|
switch (parseInt(domainBrand.type, 10)) {
|
|
|
case 1:
|
|
|
case 1: {
|
|
|
// 多品店不显示
|
|
|
banner = [];
|
|
|
break;
|
|
|
case 2:
|
|
|
}
|
|
|
case 2: {
|
|
|
// 单品店显示新版的店铺banner
|
|
|
let basisData = yield shopService.basisTemplateAsync(domainBrand.shopId);
|
|
|
|
|
|
banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
|
|
|
break;
|
|
|
default:
|
|
|
{
|
|
|
}
|
|
|
default: {
|
|
|
break;
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -1378,12 +1402,17 @@ const showMainAsync = (data) => { |
|
|
HeaderModel.requestHeaderData(data.channel)
|
|
|
]);
|
|
|
|
|
|
// 分类导航
|
|
|
// 分类导航 ,seo
|
|
|
let navs = requestData[0];
|
|
|
const seo = _getSeoByGoodsInfo(productInfo.goodsInfo, navs);
|
|
|
|
|
|
result.seo = seo;
|
|
|
|
|
|
// 最近浏览功能 ,限量商品不能使用这个功能
|
|
|
if (!_.has(productInfo, 'goodsInfo.fashionTopGoods')) {
|
|
|
data.saveInCookies(data.gid, _.get(productInfo, 'goodsInfo.skn', ''));
|
|
|
}
|
|
|
|
|
|
// 获取商品尺寸相关
|
|
|
let sizeInfo = _getSizeInfo(productInfo.goodsInfo, productInfo.goodsInfo.maxSortId);
|
|
|
|
...
|
...
|
@@ -1413,5 +1442,6 @@ module.exports = { |
|
|
indexConsultAsync: consultService.indexAsync, // 获取咨询列表
|
|
|
createConsultAsync: consultService.createAsync, // 添加咨询
|
|
|
showMainAsync: showMainAsync, // 获取某一个商品详情主页面
|
|
|
indexHotAreaAsync: hotAreaService.indexAsync // 获取某一个商品的热区数据
|
|
|
indexHotAreaAsync: hotAreaService.indexAsync, // 获取某一个商品的热区数据
|
|
|
saveRecentGoodInCookies // 保存最近的商品
|
|
|
}; |
...
|
...
|
|