Authored by 毕凯

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

guang



See merge request !504
... ... @@ -233,14 +233,14 @@ const _pageArticleContent = (articleContent, isApp, gender, isWeixin, isqq, isWe
* [处理品牌数据]
* @param {[array]} getBrand [品牌原数据]
*/
const _relatedBrand = (getBrand, isApp, id) => {
const _relatedBrand = (getBrand, isApp) => {
let relatedBrand = getBrand;
relatedBrand.forEach(brand => {
brand.thumb = brand.thumb.replace('http://', '//');
if (isApp) {
brand.url = 'http://guang.m.yohobuy.com/guang/info/' + id + '.html?openby:yohobuy={"action":"go.brand","params":{"brand_id":"' + brand.id + '"}}';
brand.url = brand.url + '?openby:yohobuy={"action":"go.brand","params":{"brand_id":"' + brand.id + '"}}';
}
});
... ... @@ -257,12 +257,13 @@ const _relatedTag = (tags, isApp) => {
let tagUrl;
tags.forEach(value => {
tagUrl = helpers.urlFormat('/tags/index', {query: value.name}, 'guang');
if (!isApp) {
value.url = tagUrl;
} else {
if (value.url.indexOf('openby')) {
if (value.url.indexOf('openby') >= 0) {
value.url = value.url;
} else {
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"}}}';
... ... @@ -271,6 +272,7 @@ const _relatedTag = (tags, isApp) => {
relatedTag.push(value);
});
return relatedTag;
};
... ... @@ -297,6 +299,7 @@ const _relatedInfo = (getOtherArticle, isApp) => {
value.thumb = helpers.image(value.thumb, 279, 175);
relatedInfo.push(value);
});
return relatedInfo;
};
... ... @@ -433,7 +436,7 @@ const index = (req, res, next) => {
// 相关品牌
if (detail.getBrand && detail.getBrand.length) {
guang.relatedBrand = _relatedBrand(detail.getBrand, isApp, id);
guang.relatedBrand = _relatedBrand(detail.getBrand, isApp);
}
// 相关标签
... ... @@ -546,7 +549,7 @@ const mini = (req, res, next) => {
// 相关品牌
if (detail.getBrand && detail.getBrand.length) {
guang.relatedBrand = _relatedBrand(detail.getBrand, isApp, id);
guang.relatedBrand = _relatedBrand(detail.getBrand, isApp);
}
// 分享参数
... ...