...
|
...
|
@@ -177,7 +177,6 @@ const _getShopData = (channel, params, shopInfo) => { |
|
|
sknList.push(value.productSkn);
|
|
|
});
|
|
|
|
|
|
let articleApiMethod = []; // 通过品牌获取相关文章接口
|
|
|
let apiMethod = [
|
|
|
searchApi.getProductList({
|
|
|
viewNum: sknList.length,
|
...
|
...
|
@@ -191,16 +190,11 @@ const _getShopData = (channel, params, shopInfo) => { |
|
|
|
|
|
_.forEach(result.brands.data, value => {
|
|
|
brands.push(value.brand_id);
|
|
|
articleApiMethod.push(
|
|
|
searchApi.getArticleByBrand(value.brand_id, 'udid') // 品牌推荐文章
|
|
|
);
|
|
|
});
|
|
|
|
|
|
resData.shopBrands = brands.join(',');
|
|
|
}
|
|
|
|
|
|
apiMethod = _.concat(apiMethod, articleApiMethod);
|
|
|
|
|
|
let subRes = yield Promise.all(apiMethod);
|
|
|
|
|
|
// 设置资源位商品封面图
|
...
|
...
|
@@ -238,31 +232,7 @@ const _getShopData = (channel, params, shopInfo) => { |
|
|
}
|
|
|
}
|
|
|
|
|
|
let articleList = [];
|
|
|
|
|
|
for (let i = 2; i < subRes.length; i++) {
|
|
|
articleList = _.concat(articleList, _.get(subRes[i], 'data', []));
|
|
|
}
|
|
|
|
|
|
if (articleList.length >= 3) {
|
|
|
let trendList = [];
|
|
|
|
|
|
for (let i = 0; i < 3; i++) {
|
|
|
trendList.push({
|
|
|
href: helpers.urlFormat(`/guang/${articleList[i].id}.html`, null),
|
|
|
src: helpers.getForceSourceUrl(articleList[i].src) +
|
|
|
'?imageView2/1/w/{width}/h/{height}',
|
|
|
mainTitle: articleList[i].title,
|
|
|
Subtitle: articleList[i].intro
|
|
|
});
|
|
|
articleList = _.concat(articleList, _.get(subRes[i], 'data', []));
|
|
|
}
|
|
|
|
|
|
resData.trendInfo = {
|
|
|
name: '潮流资讯 HOT ITEMS',
|
|
|
trendList: trendList
|
|
|
};
|
|
|
}
|
|
|
resData.trendInfo = true; // 展示店铺推荐文章
|
|
|
|
|
|
return resData;
|
|
|
})();
|
...
|
...
|
@@ -649,3 +619,40 @@ exports.queryShopByBrandIdAsync = (sid, bid) => { |
|
|
return _.get(result, 'data[0]', {});
|
|
|
})();
|
|
|
};
|
|
|
|
|
|
exports.getShopArticleByBrandsAsync = (brands) => {
|
|
|
let resData = {};
|
|
|
|
|
|
brands = _.split(brands, ',');
|
|
|
|
|
|
if (!brands.length) {
|
|
|
return Promise.resolve(resData);
|
|
|
}
|
|
|
|
|
|
return Promise.all(brands.map(value => searchApi.getArticleByBrand(value))).then(result => {
|
|
|
let articleList = [];
|
|
|
|
|
|
for (let i = 0; i < result.length; i++) {
|
|
|
articleList = _.concat(articleList, _.get(result[i], 'data', []));
|
|
|
}
|
|
|
|
|
|
if (articleList.length >= 3) {
|
|
|
articleList.length = 3;
|
|
|
|
|
|
resData.trendInfo = {
|
|
|
name: '潮流资讯 HOT ITEMS',
|
|
|
trendList: articleList.map(value => {
|
|
|
return {
|
|
|
href: helpers.urlFormat(`/guang/${value.id}.html`, null),
|
|
|
src: helpers.getForceSourceUrl(value.src) +
|
|
|
'?imageView2/1/w/{width}/h/{height}',
|
|
|
mainTitle: value.title,
|
|
|
Subtitle: value.intro
|
|
|
}
|
|
|
})
|
|
|
};
|
|
|
}
|
|
|
|
|
|
return resData;
|
|
|
});
|
|
|
}; |
...
|
...
|
|