Showing
1 changed file
with
37 additions
and
39 deletions
@@ -1019,51 +1019,40 @@ const _getIntroInfo = (productSkn, maxSortId, additionalData)=> { | @@ -1019,51 +1019,40 @@ const _getIntroInfo = (productSkn, maxSortId, additionalData)=> { | ||
1019 | * @param array $navs | 1019 | * @param array $navs |
1020 | * @return array | 1020 | * @return array |
1021 | */ | 1021 | */ |
1022 | -const _getSeoByGoodsInfo = (req, goodsInfo, navs) => { | ||
1023 | - return co(function*() { | ||
1024 | - let title, keywords, description; | ||
1025 | - let redisSeo = yield tdk('skn', goodsInfo.skn, req); | ||
1026 | - | ||
1027 | - if (redisSeo[0]) { | ||
1028 | - req.tdk = { | ||
1029 | - title: redisSeo[1], | ||
1030 | - keywords: redisSeo[2], | ||
1031 | - description: redisSeo[3] | ||
1032 | - }; | ||
1033 | - } | ||
1034 | - let brandName = ''; | ||
1035 | - let sortName = ''; | 1022 | +const _getSeoByGoodsInfo = (goodsInfo, navs) => { |
1023 | + let title = ''; | ||
1024 | + let brandName = ''; | ||
1025 | + let sortName = ''; | ||
1036 | 1026 | ||
1037 | - goodsInfo = goodsInfo || {}; | ||
1038 | - navs = navs || []; | 1027 | + goodsInfo = goodsInfo || {}; |
1028 | + navs = navs || []; | ||
1039 | 1029 | ||
1040 | - if (goodsInfo.brandName) { | ||
1041 | - title = goodsInfo.brandName + ' '; | ||
1042 | - brandName = goodsInfo.brandName; | ||
1043 | - } | 1030 | + if (goodsInfo.brandName) { |
1031 | + title = goodsInfo.brandName + ' '; | ||
1032 | + brandName = goodsInfo.brandName; | ||
1033 | + } | ||
1044 | 1034 | ||
1045 | - if (_.get(navs, '[1].name')) { | ||
1046 | - sortName = navs[1].name; | ||
1047 | - title += navs[1].name + '|'; | ||
1048 | - } | 1035 | + if (_.get(navs, '[1].name')) { |
1036 | + sortName = navs[1].name; | ||
1037 | + title += navs[1].name + '|'; | ||
1038 | + } | ||
1049 | 1039 | ||
1050 | - title += goodsInfo.name + '正品 | YOHO!BUY 有货'; | 1040 | + title += goodsInfo.name + '正品 | YOHO!BUY 有货'; |
1051 | 1041 | ||
1052 | - keywords = brandName + sortName + ',' + brandName + '官网专卖店,' + brandName + '官方授权店,' + | ||
1053 | - brandName + '正品,' + brandName + '打折,' + brandName + '折扣店,' + brandName + '真品,' + brandName + '代购'; | 1042 | + let keywords = brandName + sortName + ',' + brandName + '官网专卖店,' + brandName + '官方授权店,' + |
1043 | + brandName + '正品,' + brandName + '打折,' + brandName + '折扣店,' + brandName + '真品,' + brandName + '代购'; | ||
1054 | 1044 | ||
1055 | - description = `YOHO!BUY 有货-${brandName}官方授权店,${goodsInfo.name}图片、报价、介绍。` + | ||
1056 | - `YOHO!BUY 有货${brandName}官网专卖店提供${brandName}正品、${brandName}真品、 ${brandName}打折、${brandName}代购等。`; | 1045 | + let description = `YOHO!BUY 有货-${brandName}官方授权店,${goodsInfo.name}图片、报价、介绍。` + |
1046 | + `YOHO!BUY 有货${brandName}官网专卖店提供${brandName}正品、${brandName}真品、 ${brandName}打折、${brandName}代购等。`; | ||
1057 | 1047 | ||
1058 | - let cononicalURL = goodsInfo.productUrl; | 1048 | + let cononicalURL = goodsInfo.productUrl; |
1059 | 1049 | ||
1060 | - return { | ||
1061 | - title: title, | ||
1062 | - keywords: keywords.replace(/~+/, ''), | ||
1063 | - description: description, | ||
1064 | - cononicalURL: cononicalURL | ||
1065 | - }; | ||
1066 | - })(); | 1050 | + return { |
1051 | + title: title, | ||
1052 | + keywords: keywords.replace(/~+/, ''), | ||
1053 | + description: description, | ||
1054 | + cononicalURL: cononicalURL | ||
1055 | + }; | ||
1067 | }; | 1056 | }; |
1068 | 1057 | ||
1069 | // 优惠券 | 1058 | // 优惠券 |
@@ -1549,7 +1538,8 @@ const showMainAsync = (req, data) => { | @@ -1549,7 +1538,8 @@ const showMainAsync = (req, data) => { | ||
1549 | _getSortNavAsync(smallSortId, data.gender), // 面包屑导航 | 1538 | _getSortNavAsync(smallSortId, data.gender), // 面包屑导航 |
1550 | HeaderModel.requestHeaderData(data.channel), // 通用头部数据 | 1539 | HeaderModel.requestHeaderData(data.channel), // 通用头部数据 |
1551 | _getProductIntroAsync(productId, productSkn), // 商品详细介绍 | 1540 | _getProductIntroAsync(productId, productSkn), // 商品详细介绍 |
1552 | - curUserProduct(productData) // 商品详细价格 | 1541 | + curUserProduct(productData), // 商品详细价格 |
1542 | + tdk('skn', data.skn, req) //seo | ||
1553 | ]); | 1543 | ]); |
1554 | 1544 | ||
1555 | let smallSortNavigator = requestData[0]; | 1545 | let smallSortNavigator = requestData[0]; |
@@ -1557,6 +1547,14 @@ const showMainAsync = (req, data) => { | @@ -1557,6 +1547,14 @@ const showMainAsync = (req, data) => { | ||
1557 | let productDescription = requestData[2]; | 1547 | let productDescription = requestData[2]; |
1558 | let productInfo = requestData[3]; | 1548 | let productInfo = requestData[3]; |
1559 | 1549 | ||
1550 | + if (requestData[4][0]) { | ||
1551 | + req.tdk = { | ||
1552 | + title: requestData[4][1], | ||
1553 | + keywords: requestData[4][2], | ||
1554 | + description: requestData[4][3] | ||
1555 | + }; | ||
1556 | + } | ||
1557 | + | ||
1560 | // 拼装数据 | 1558 | // 拼装数据 |
1561 | let result = {}; | 1559 | let result = {}; |
1562 | 1560 | ||
@@ -1570,7 +1568,7 @@ const showMainAsync = (req, data) => { | @@ -1570,7 +1568,7 @@ const showMainAsync = (req, data) => { | ||
1570 | result.deatil = Object.assign(result.detail, intro); | 1568 | result.deatil = Object.assign(result.detail, intro); |
1571 | 1569 | ||
1572 | // seo | 1570 | // seo |
1573 | - result.seo = yield _getSeoByGoodsInfo(req, productInfo.goodsInfo, smallSortNavigator); | 1571 | + result.seo = _getSeoByGoodsInfo(productInfo.goodsInfo, smallSortNavigator); |
1574 | 1572 | ||
1575 | // 商品页面统计 | 1573 | // 商品页面统计 |
1576 | result.statGoodsInfo = Object.assign({fullSortName: smallSortNavigator.map(x => x.name).join('-')}, | 1574 | result.statGoodsInfo = Object.assign({fullSortName: smallSortNavigator.map(x => x.name).join('-')}, |
-
Please register or login to post a comment