Authored by 郭成尧

Merge branch 'feature/seo2' of git.yoho.cn:fe/yohobuywap-node into feature/seo2

@@ -86,17 +86,20 @@ const _relatedTag = (tags, isApp) => { @@ -86,17 +86,20 @@ const _relatedTag = (tags, isApp) => {
86 */ 86 */
87 const _relatedInfo = (getOtherArticle, isApp) => { 87 const _relatedInfo = (getOtherArticle, isApp) => {
88 let relatedInfo = []; 88 let relatedInfo = [];
89 - let articleUrl;  
90 89
91 getOtherArticle.forEach(value => { 90 getOtherArticle.forEach(value => {
92 - articleUrl = helpers.urlFormat('/info/index', {  
93 - id: value.id  
94 - }, 'guang');  
95 -  
96 if (isApp) { 91 if (isApp) {
97 - value.url = articleUrl + '&openby:yohobuy={"action":"go.h5","params":{"id":"' + value.id + '","shareparam":{"id":"' + value.id + '"},"islogin":"N","type":1,"url":"http://guang.m.yohobuy.com/info/index","param":{"id":"' + value.id + '"}}}'; 92 + if (value.url.indexOf('guang.m.yohobuy.com') < 0) {
  93 + value.url = `${helpers.https(value.url)}?openby:yohobuy={"url":"${value.url}","islogin":"N"}}`;
  94 + } else {
  95 + value.url = `//m.yohobuy.com/guang/info/${value.id}.html?openby:yohobuy={"action":"go.h5","params":{"param":{"id":"${value.id}"},"shareparam":{"id":"${value.id}"},"share":"/guang/api/v1/share/guang","id":${value.id},"type":1,"url":"http://m.yohobuy.com/guang/info/${value.id}.html","islogin":"N"}}`;
  96 + }
98 } else { 97 } else {
99 - value.url = articleUrl; 98 + if (value.url.indexOf('guang.m.yohobuy.com') < 0) {
  99 + value.url = value.url;
  100 + } else {
  101 + value.url = `//m.yohobuy.com/guang/info/${value.id}.html`;
  102 + }
100 } 103 }
101 104
102 value.thumb = helpers.image(value.thumb, 279, 175); 105 value.thumb = helpers.image(value.thumb, 279, 175);
@@ -79,11 +79,11 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid, top) => { @@ -79,11 +79,11 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid, top) => {
79 if (!articleData.id) { 79 if (!articleData.id) {
80 return false; 80 return false;
81 } 81 }
  82 +
82 let result = { 83 let result = {
83 id: articleData.id, 84 id: articleData.id,
84 showTags: showTag, 85 showTags: showTag,
85 img: articleData.src ? helpers.image(articleData.src, 640, 640) : '', 86 img: articleData.src ? helpers.image(articleData.src, 640, 640) : '',
86 - url: isApp ? `//m.yohobuy.com/guang/info/${articleData.id}.html?openby:yohobuy={"action":"go.h5","params":{"param":{"id":"${articleData.id}"},"shareparam":{"id":"${articleData.id}"},"share":"/guang/api/v1/share/guang","id":${articleData.id},"type":1,"url":"http://m.yohobuy.com/guang/info/${articleData.id}.html","islogin":"N"}}` : `//m.yohobuy.com/guang/info/${articleData.id}.html`, //eslint-disable-line  
87 title: articleData.title, 87 title: articleData.title,
88 text: articleData.intro, 88 text: articleData.intro,
89 publishTime: articleData.publish_time, 89 publishTime: articleData.publish_time,
@@ -91,6 +91,20 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid, top) => { @@ -91,6 +91,20 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid, top) => {
91 pageView: articleData.views_num 91 pageView: articleData.views_num
92 }; 92 };
93 93
  94 + if (isApp) {
  95 + if (articleData.url.indexOf('guang.m.yohobuy.com') < 0) {
  96 + result.url = `${helpers.https(articleData.url)}?openby:yohobuy={"url":"${articleData.url}","islogin":"N"}}`;
  97 + } else {
  98 + result.url = `//m.yohobuy.com/guang/info/${articleData.id}.html?openby:yohobuy={"action":"go.h5","params":{"param":{"id":"${articleData.id}"},"shareparam":{"id":"${articleData.id}"},"share":"/guang/api/v1/share/guang","id":${articleData.id},"type":1,"url":"http://m.yohobuy.com/guang/info/${articleData.id}.html","islogin":"N"}}`;
  99 + }
  100 + } else {
  101 + if (articleData.url.indexOf('guang.m.yohobuy.com') < 0) {
  102 + result.url = articleData.url;
  103 + } else {
  104 + result.url = `//m.yohobuy.com/guang/info/${articleData.id}.html`;
  105 + }
  106 + }
  107 +
94 if (result.url.includes('feature.yoho.cn') || 108 if (result.url.includes('feature.yoho.cn') ||
95 result.url.includes('cdn.yoho.cn')) { 109 result.url.includes('cdn.yoho.cn')) {
96 result.url = transHttpsUrl(result.url); 110 result.url = transHttpsUrl(result.url);
@@ -237,7 +237,7 @@ exports.processProductList = (list, options) => { @@ -237,7 +237,7 @@ exports.processProductList = (list, options) => {
237 237
238 product.seoTitle = `${product.brand_name}|${seoGender}${product.small_sort_name}|${product.product_name}|YOHO!BUY有货`; // eslint-disable-line 238 product.seoTitle = `${product.brand_name}|${seoGender}${product.small_sort_name}|${product.product_name}|YOHO!BUY有货`; // eslint-disable-line
239 239
240 - product.imgAlt = _.compact([product.brand_name, (product.gender ? GENDER[product.gender] : false), product.small_sort_name, product.product_name]).join('|'); 240 + product.imgAlt = _.compact([product.brand_name, (product.gender ? GENDER[product.gender] : false), product.small_sort_name, product.product_name]).join('|'); // eslint-disable-line
241 241
242 pruductList.push(product); 242 pruductList.push(product);
243 }); 243 });