...
|
...
|
@@ -17,10 +17,9 @@ const helpers = require(`${library}/helpers`); |
|
|
const detailAPI = require('./detail-main-api');
|
|
|
const commentAPI = require('./detail-comment-api');
|
|
|
const consultAPI = require('./detail-consult-api');
|
|
|
const hotAreaAPI = require('./detail-hotarea-api');
|
|
|
|
|
|
const hotAreaService = require('./detail-hotarea-api');
|
|
|
const brandService = require('./brand-service');
|
|
|
|
|
|
const favoriteBrandService = require('./favorite-brand-service');
|
|
|
const favoriteProductService = require('./favorite-product-service');
|
|
|
|
...
|
...
|
@@ -1440,63 +1439,4 @@ module.exports.showMainAsync = (data) => { |
|
|
/**
|
|
|
* 获取某一个商品的热区数据
|
|
|
*/
|
|
|
module.exports.indexHotAreaAsync = (pid) => {
|
|
|
return co(function *() {
|
|
|
let data = yield hotAreaAPI.indexAsync(pid);
|
|
|
|
|
|
if (!data.code && !(data.code === 200) && !data.data) {
|
|
|
return [];
|
|
|
}
|
|
|
|
|
|
return data.data.reduce((result, area) => {
|
|
|
let item = {};
|
|
|
|
|
|
if (area.imageUrl) {
|
|
|
item.img = helpers.getForceSourceUrl(area.imageUrl);
|
|
|
}
|
|
|
|
|
|
item.list = area.infos.reduce((acc, cur, index) => {
|
|
|
if (!cur.product || !cur.product.goodsList) {
|
|
|
return acc;
|
|
|
}
|
|
|
|
|
|
let point = {
|
|
|
label: index + 1,
|
|
|
top: cur.top,
|
|
|
left: cur.left,
|
|
|
height: cur.height,
|
|
|
width: cur.width
|
|
|
};
|
|
|
|
|
|
let goods = _.head(cur.product.goodsList);
|
|
|
|
|
|
// 封面图
|
|
|
point.img = helpers.getForceSourceUrl(goods.colorImage, 60, 60);
|
|
|
|
|
|
// 商品相关信息
|
|
|
point.product = {
|
|
|
salePrice: cur.product.productPriceBo.formatSalesPrice,
|
|
|
marketPrice: cur.product.productPriceBo.formatMarketPrice,
|
|
|
productName: cur.product.productName,
|
|
|
href: helpers.getUrlBySkc(
|
|
|
_.head(goods.goodsImagesList).productId,
|
|
|
_.head(goods.goodsImagesList).goodsId,
|
|
|
cur.product.cnAlphabet
|
|
|
)
|
|
|
};
|
|
|
acc.push(point);
|
|
|
|
|
|
return acc;
|
|
|
}, []);
|
|
|
|
|
|
if (_.isEmpty(item)) {
|
|
|
return result;
|
|
|
} else {
|
|
|
result.push(item);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
}, []);
|
|
|
|
|
|
})();
|
|
|
}; |
|
|
module.exports.indexHotAreaAsync = hotAreaService.indexAsync; |
...
|
...
|
|