Authored by 郭成尧

Merge branch 'feature/optimize' into 'release/5.6'

guang app 跳转



See merge request !502
... ... @@ -233,16 +233,17 @@ const _pageArticleContent = (articleContent, isApp, gender, isWeixin, isqq, isWe
* [处理品牌数据]
* @param {[array]} getBrand [品牌原数据]
*/
const _relatedBrand = (getBrand, isApp) => {
const _relatedBrand = (getBrand, isApp, id) => {
let relatedBrand = getBrand;
relatedBrand.forEach(brand => {
brand.thumb = brand.thumb.replace('http://', '//');
if (isApp) {
brand.url = brand.url + '?openby:yohobuy={"action":"go.brand","params":{"brand_id":"' + brand.id + '}}';
brand.url = 'http://guang.m.yohobuy.com/guang/info/' + id + '.html?openby:yohobuy={"action":"go.brand","params":{"brand_id":"' + brand.id + '"}}';
}
});
return relatedBrand;
};
... ... @@ -253,13 +254,21 @@ const _relatedBrand = (getBrand, isApp) => {
*/
const _relatedTag = (tags, isApp) => {
let relatedTag = [];
let tagUrl;
tags.forEach(value => {
tagUrl = helpers.urlFormat('/tags/index', {query: value.name}, 'guang');
if (!isApp) {
value.url = helpers.urlFormat('/tags/index', {
query: value.name
}, 'guang');
value.url = tagUrl;
} else {
if (value.url.indexOf('openby')) {
value.url = tagUrl + '&openby:yohobuy={"action":"go.h5","params":{"query":"' + value.name + '","type":0","title":"' + value.name + '","url":"http://guang.m.yohobuy.com/tags/index","islogin":"N"}}}';
} else {
value.url = value.url;
}
}
relatedTag.push(value);
});
return relatedTag;
... ... @@ -424,7 +433,7 @@ const index = (req, res, next) => {
// 相关品牌
if (detail.getBrand && detail.getBrand.length) {
guang.relatedBrand = _relatedBrand(detail.getBrand);
guang.relatedBrand = _relatedBrand(detail.getBrand, isApp, id);
}
// 相关标签
... ... @@ -537,7 +546,7 @@ const mini = (req, res, next) => {
// 相关品牌
if (detail.getBrand && detail.getBrand.length) {
guang.relatedBrand = _relatedBrand(detail.getBrand, isApp);
guang.relatedBrand = _relatedBrand(detail.getBrand, isApp, id);
}
// 分享参数
... ...