...
|
...
|
@@ -69,6 +69,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { |
|
|
skns.push(goods.id);
|
|
|
arr[goods.id] = goods.src;
|
|
|
});
|
|
|
|
|
|
// 通过SKN获取商品信息
|
|
|
productDetailModel.productInfoBySkns(skns).then((product) => {
|
|
|
if (product.data.product_list) {
|
...
|
...
|
@@ -155,10 +156,10 @@ const _pageArticleContent = (articleContent, isApp, gender) => { |
|
|
} else {
|
|
|
resolve(contents);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
joinContentFunc(0, articleContent.length);
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* [处理品牌数据]
|
...
|
...
|
@@ -170,7 +171,8 @@ const _relatedBrand = (getBrand) => { |
|
|
brand.thumb = brand.thumb.replace('http://', '//');
|
|
|
});
|
|
|
return relatedBrand;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* [处理标签数据]
|
|
|
* @param {[array]} tags [标签原数据]
|
...
|
...
|
@@ -187,7 +189,8 @@ const _relatedTag = (tags, isApp) => { |
|
|
relatedTag.push(value);
|
|
|
});
|
|
|
return relatedTag;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* [处理相关文章数据]
|
|
|
* @param {[array]} getOtherArticle [相关文章原数据]
|
...
|
...
|
@@ -205,7 +208,8 @@ const _relatedInfo = (getOtherArticle, isApp) => { |
|
|
relatedInfo.push(value);
|
|
|
});
|
|
|
return relatedInfo;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* [处理分享内容]
|
|
|
* @param {[int]} id [资讯id]
|
...
|
...
|
@@ -224,7 +228,8 @@ const _shareInfo = (id, getArticle) => { |
|
|
shareInfo.shareImg = helpers.image(getArticle.cover_image, 640, 320);
|
|
|
}
|
|
|
return shareInfo;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* [逛资讯详情页]
|
|
|
*/
|
...
|
...
|
@@ -287,7 +292,7 @@ const index = (req, res, next) => { |
|
|
|
|
|
|
|
|
if (detail.getArticleContent) {
|
|
|
//生成内容部分
|
|
|
// 生成内容部分
|
|
|
return _pageArticleContent(detail.getArticleContent, isApp, gender).then((contents) => {
|
|
|
guang.detail.content = contents;
|
|
|
|
...
|
...
|
@@ -333,6 +338,7 @@ const index = (req, res, next) => { |
|
|
}
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* [逛mini内容页]
|
|
|
*/
|
...
|
...
|
@@ -370,9 +376,10 @@ const mini = (req, res, next) => { |
|
|
|
|
|
|
|
|
if (detail.getArticleContent) {
|
|
|
//生成内容部分
|
|
|
// 生成内容部分
|
|
|
return _pageArticleContent(detail.getArticleContent, isApp, gender).then((contents) => {
|
|
|
guang.detail.content = contents;
|
|
|
|
|
|
// 相关品牌
|
|
|
if (detail.getBrand && detail.getBrand.length) {
|
|
|
guang.relatedBrand = _relatedBrand(detail.getBrand);
|
...
|
...
|
@@ -428,16 +435,17 @@ const foryoho = (req, res, next) => { |
|
|
data.brand = detail.getBrand;
|
|
|
|
|
|
if (detail.getArticleContent) {
|
|
|
//生成内容部分
|
|
|
// 生成内容部分
|
|
|
return _pageArticleContent(detail.getArticleContent, isApp, gender).then((contents) => {
|
|
|
data.content = contents;
|
|
|
//内容中的相关推荐和悬浮商品移到data层级
|
|
|
|
|
|
// 内容中的相关推荐和悬浮商品移到data层级
|
|
|
let relatedRecoIndex = data.content.findIndex((cont) => {
|
|
|
return typeof cont.relatedReco !== 'undefined';
|
|
|
})
|
|
|
});
|
|
|
let collocationIndex = data.content.findIndex((cont) => {
|
|
|
return typeof cont.collocation !== 'undefined';
|
|
|
})
|
|
|
});
|
|
|
if (relatedRecoIndex > 0) {
|
|
|
data.goods = data.content[relatedRecoIndex].relatedReco;
|
|
|
data.content.splice(relatedRecoIndex, 1);
|
...
|
...
|
@@ -455,7 +463,7 @@ const foryoho = (req, res, next) => { |
|
|
|
|
|
}
|
|
|
}).catch(next);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
index,
|
...
|
...
|
|