...
|
...
|
@@ -29,6 +29,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { |
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
let joinContentFunc = (i, len) => {
|
|
|
|
|
|
if (i < len) {
|
|
|
let build = {};
|
|
|
let art = articleContent[i];
|
...
|
...
|
@@ -72,32 +73,35 @@ const _pageArticleContent = (articleContent, isApp, gender) => { |
|
|
|
|
|
// 通过SKN获取商品信息
|
|
|
productDetailModel.productInfoBySkns(skns).then((product) => {
|
|
|
if (product.data && product.data.product_list) {
|
|
|
let d = [];
|
|
|
if (product && product.data) {
|
|
|
if (product.data.product_list) {
|
|
|
let d = [];
|
|
|
|
|
|
for (let o = 0; o < product.data.product_list.length; o++) {
|
|
|
let goods = product.data.product_list[o];
|
|
|
for (let o = 0; o < product.data.product_list.length; o++) {
|
|
|
let goods = product.data.product_list[o];
|
|
|
|
|
|
// 最多显示4个
|
|
|
if (o > 3) {
|
|
|
break;
|
|
|
// 最多显示4个
|
|
|
if (o > 3) {
|
|
|
break;
|
|
|
}
|
|
|
d.push(guangProcess.formatProduct(goods, false, true, true, 235, 314, isApp, true, gender));
|
|
|
}
|
|
|
d.push(guangProcess.formatProduct(goods, false, true, true, 235, 314, isApp, true, gender));
|
|
|
d.forEach(p => {
|
|
|
if (arr[p.id]) {
|
|
|
p.thumb = helpers.image(arr[p.id], 235, 314);
|
|
|
reco.push(p);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
d.forEach(p => {
|
|
|
if (arr[p.id]) {
|
|
|
p.thumb = helpers.image(arr[p.id], 235, 314);
|
|
|
reco.push(p);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 多个商品
|
|
|
if (product.data.product_list.length > 1) {
|
|
|
build.relatedReco = reco;
|
|
|
} else if (product.data.product_list.length === 1) { // 单个商品
|
|
|
build.relatedReco = reco[0];
|
|
|
// 多个商品
|
|
|
if (product.data.product_list.length && (product.data.product_list.length > 1)) {
|
|
|
build.relatedReco = reco;
|
|
|
} else if (product.data.product_list.length === 1) { // 单个商品
|
|
|
build.relatedReco = reco[0];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
contents.push(build);
|
|
|
joinContentFunc(++i, len);
|
|
|
});
|
...
|
...
|
@@ -120,7 +124,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { |
|
|
|
|
|
// 通过SKN获取商品信息
|
|
|
productDetailModel.productInfoBySkns(skns).then((product) => {
|
|
|
if (product.data.product_list) {
|
|
|
if (product && product.data && product.data.product_list) {
|
|
|
let g = [];
|
|
|
|
|
|
product.data.product_list.forEach(_ => {
|
...
|
...
|
@@ -157,6 +161,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { |
|
|
resolve(contents);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
joinContentFunc(0, articleContent.length);
|
|
|
});
|
|
|
};
|
...
|
...
|
@@ -167,6 +172,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { |
|
|
*/
|
|
|
const _relatedBrand = (getBrand) => {
|
|
|
let relatedBrand = getBrand;
|
|
|
|
|
|
relatedBrand.forEach(brand => {
|
|
|
brand.thumb = brand.thumb.replace('http://', '//');
|
|
|
});
|
...
|
...
|
@@ -180,6 +186,7 @@ const _relatedBrand = (getBrand) => { |
|
|
*/
|
|
|
const _relatedTag = (tags, isApp) => {
|
|
|
let relatedTag = [];
|
|
|
|
|
|
tags.forEach(value => {
|
|
|
if (!isApp) {
|
|
|
value.url = helpers.urlFormat('/tags/index', {
|
...
|
...
|
@@ -198,6 +205,7 @@ const _relatedTag = (tags, isApp) => { |
|
|
*/
|
|
|
const _relatedInfo = (getOtherArticle, isApp) => {
|
|
|
let relatedInfo = [];
|
|
|
|
|
|
getOtherArticle.forEach(value => {
|
|
|
if (!isApp) {
|
|
|
value.url = helpers.urlFormat('/info/index', {
|
...
|
...
|
@@ -217,6 +225,7 @@ const _relatedInfo = (getOtherArticle, isApp) => { |
|
|
*/
|
|
|
const _shareInfo = (id, getArticle) => {
|
|
|
let shareInfo = {};
|
|
|
|
|
|
shareInfo.shareLink = helpers.urlFormat('/info/index', {
|
|
|
id: id
|
|
|
}, 'guang');
|
...
|
...
|
@@ -234,7 +243,7 @@ const _shareInfo = (id, getArticle) => { |
|
|
* [逛资讯详情页]
|
|
|
*/
|
|
|
const index = (req, res, next) => {
|
|
|
let id = req.query.id,
|
|
|
let id = req.query.id || req.params.id,
|
|
|
gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || 1,
|
|
|
isApp = req.query.app_version || req.query.appVersion || false, // 标识是不是APP访问的
|
|
|
parameter = {},
|
...
|
...
|
@@ -314,6 +323,7 @@ const index = (req, res, next) => { |
|
|
// 分享参数
|
|
|
if (detail.getArticle.cover_image) {
|
|
|
let shareInfo = _shareInfo(id, detail.getArticle);
|
|
|
|
|
|
Object.assign(guang, shareInfo);
|
|
|
data.title = detail.getArticle.article_title + ' | Yoho!Buy有货 | 潮流购物逛不停';
|
|
|
data.title_more = true;
|
...
|
...
|
@@ -388,6 +398,7 @@ const mini = (req, res, next) => { |
|
|
// 分享参数
|
|
|
if (detail.getArticle.cover_image) {
|
|
|
let shareInfo = _shareInfo(id, detail.getArticle);
|
|
|
|
|
|
Object.assign(guang, shareInfo);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -443,9 +454,11 @@ const foryoho = (req, res, next) => { |
|
|
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);
|
...
|
...
|
|