|
@@ -531,6 +531,29 @@ function _getSortNavAsync(smallSortId, gender) { |
|
@@ -531,6 +531,29 @@ function _getSortNavAsync(smallSortId, gender) { |
531
|
})();
|
531
|
})();
|
532
|
}
|
532
|
}
|
533
|
|
533
|
|
|
|
534
|
+// 保存在 gids 和 skns ,最近流览功能
|
|
|
535
|
+const saveRecentGoodInCookies = (oldGids, oldSkns, res, addGids, addSkns) => {
|
|
|
536
|
+ oldGids = (oldGids || '').split(',');
|
|
|
537
|
+ oldSkns = (oldSkns || '').split(',');
|
|
|
538
|
+ addSkns = `${addSkns}-${addGids}`;
|
|
|
539
|
+
|
|
|
540
|
+ _.remove(oldGids, addGids);
|
|
|
541
|
+ _.remove(oldSkns, addSkns);
|
|
|
542
|
+
|
|
|
543
|
+ oldGids.unshift(addGids);
|
|
|
544
|
+ oldSkns.unshift(addSkns);
|
|
|
545
|
+
|
|
|
546
|
+ res.cookie('_browse', oldGids.splice(0, 30).join(','), {
|
|
|
547
|
+ maxAge: 2000000000,
|
|
|
548
|
+ domain: 'yohobuy.com'
|
|
|
549
|
+ });
|
|
|
550
|
+
|
|
|
551
|
+ res.cookie('_browseskn', oldSkns.splice(0, 30).join(','), {
|
|
|
552
|
+ maxAge: 2000000000,
|
|
|
553
|
+ domain: 'yohobuy.com'
|
|
|
554
|
+ });
|
|
|
555
|
+};
|
|
|
556
|
+
|
534
|
/**
|
557
|
/**
|
535
|
* 详情页数据格式化
|
558
|
* 详情页数据格式化
|
536
|
* @param origin Object 原始数据
|
559
|
* @param origin Object 原始数据
|
|
@@ -632,7 +655,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => { |
|
@@ -632,7 +655,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => { |
632
|
if (origin.brand) {
|
655
|
if (origin.brand) {
|
633
|
result.brandImg = helpers.image(origin.brand.brandIco, 47, 47);
|
656
|
result.brandImg = helpers.image(origin.brand.brandIco, 47, 47);
|
634
|
result.brandName = origin.brand.brandName;
|
657
|
result.brandName = origin.brand.brandName;
|
635
|
- result.brandUrl = helpers.urlFormat('', {}, origin.brand.brandDomain);
|
658
|
+ result.brandUrl = helpers.urlFormat('', null, origin.brand.brandDomain);
|
636
|
banner = _getBrandDataByProductBaseInfo(origin);
|
659
|
banner = _getBrandDataByProductBaseInfo(origin);
|
637
|
if (banner.isCollect && favoriteData.brand) {
|
660
|
if (banner.isCollect && favoriteData.brand) {
|
638
|
banner.isCollect = favoriteData.brand;
|
661
|
banner.isCollect = favoriteData.brand;
|
|
@@ -723,7 +746,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => { |
|
@@ -723,7 +746,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => { |
723
|
// 分享相关,产品的链接
|
746
|
// 分享相关,产品的链接
|
724
|
result.weixinUrl = helpers.urlFormat(origin.productUrl, {}, 'item');
|
747
|
result.weixinUrl = helpers.urlFormat(origin.productUrl, {}, 'item');
|
725
|
result.shareTitle = result.name;
|
748
|
result.shareTitle = result.name;
|
726
|
- result.shareImg = result.img;
|
749
|
+ result.shareImg = 'http:' + result.img;
|
727
|
result.shareDesc = result.phrase;
|
750
|
result.shareDesc = result.phrase;
|
728
|
|
751
|
|
729
|
// 统计需要的商品信息
|
752
|
// 统计需要的商品信息
|
|
@@ -746,18 +769,19 @@ const _detailDataPkg = (origin, uid, vipLevel) => { |
|
@@ -746,18 +769,19 @@ const _detailDataPkg = (origin, uid, vipLevel) => { |
746
|
|
769
|
|
747
|
if (domainBrand.type && domainBrand.shopId) {
|
770
|
if (domainBrand.type && domainBrand.shopId) {
|
748
|
switch (parseInt(domainBrand.type, 10)) {
|
771
|
switch (parseInt(domainBrand.type, 10)) {
|
749
|
- case 1:
|
772
|
+ case 1: {
|
750
|
// 多品店不显示
|
773
|
// 多品店不显示
|
751
|
banner = [];
|
774
|
banner = [];
|
752
|
break;
|
775
|
break;
|
753
|
- case 2:
|
776
|
+ }
|
|
|
777
|
+ case 2: {
|
754
|
// 单品店显示新版的店铺banner
|
778
|
// 单品店显示新版的店铺banner
|
755
|
let basisData = yield shopService.basisTemplateAsync(domainBrand.shopId);
|
779
|
let basisData = yield shopService.basisTemplateAsync(domainBrand.shopId);
|
756
|
|
780
|
|
757
|
banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
|
781
|
banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
|
758
|
break;
|
782
|
break;
|
759
|
- default:
|
|
|
760
|
- {
|
783
|
+ }
|
|
|
784
|
+ default: {
|
761
|
break;
|
785
|
break;
|
762
|
}
|
786
|
}
|
763
|
}
|
787
|
}
|
|
@@ -1378,12 +1402,17 @@ const showMainAsync = (data) => { |
|
@@ -1378,12 +1402,17 @@ const showMainAsync = (data) => { |
1378
|
HeaderModel.requestHeaderData(data.channel)
|
1402
|
HeaderModel.requestHeaderData(data.channel)
|
1379
|
]);
|
1403
|
]);
|
1380
|
|
1404
|
|
1381
|
- // 分类导航
|
1405
|
+ // 分类导航 ,seo
|
1382
|
let navs = requestData[0];
|
1406
|
let navs = requestData[0];
|
1383
|
const seo = _getSeoByGoodsInfo(productInfo.goodsInfo, navs);
|
1407
|
const seo = _getSeoByGoodsInfo(productInfo.goodsInfo, navs);
|
1384
|
|
1408
|
|
1385
|
result.seo = seo;
|
1409
|
result.seo = seo;
|
1386
|
|
1410
|
|
|
|
1411
|
+ // 最近浏览功能 ,限量商品不能使用这个功能
|
|
|
1412
|
+ if (!_.has(productInfo, 'goodsInfo.fashionTopGoods')) {
|
|
|
1413
|
+ data.saveInCookies(data.gid, _.get(productInfo, 'goodsInfo.skn', ''));
|
|
|
1414
|
+ }
|
|
|
1415
|
+
|
1387
|
// 获取商品尺寸相关
|
1416
|
// 获取商品尺寸相关
|
1388
|
let sizeInfo = _getSizeInfo(productInfo.goodsInfo, productInfo.goodsInfo.maxSortId);
|
1417
|
let sizeInfo = _getSizeInfo(productInfo.goodsInfo, productInfo.goodsInfo.maxSortId);
|
1389
|
|
1418
|
|
|
@@ -1413,5 +1442,6 @@ module.exports = { |
|
@@ -1413,5 +1442,6 @@ module.exports = { |
1413
|
indexConsultAsync: consultService.indexAsync, // 获取咨询列表
|
1442
|
indexConsultAsync: consultService.indexAsync, // 获取咨询列表
|
1414
|
createConsultAsync: consultService.createAsync, // 添加咨询
|
1443
|
createConsultAsync: consultService.createAsync, // 添加咨询
|
1415
|
showMainAsync: showMainAsync, // 获取某一个商品详情主页面
|
1444
|
showMainAsync: showMainAsync, // 获取某一个商品详情主页面
|
1416
|
- indexHotAreaAsync: hotAreaService.indexAsync // 获取某一个商品的热区数据
|
1445
|
+ indexHotAreaAsync: hotAreaService.indexAsync, // 获取某一个商品的热区数据
|
|
|
1446
|
+ saveRecentGoodInCookies // 保存最近的商品
|
1417
|
}; |
1447
|
}; |