...
|
...
|
@@ -19,6 +19,7 @@ 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 brandAPI = require('./brand-api');
|
|
|
const favoriteAPI = require('./favorite-api');
|
|
|
const shopAPI = require('./shop-api');
|
...
|
...
|
@@ -76,9 +77,6 @@ function getMultiDataByResourceName(resourceName) { |
|
|
|
|
|
/**
|
|
|
* 获取商品的喜欢
|
|
|
* @param uid
|
|
|
* @param pid
|
|
|
* @param bid
|
|
|
*/
|
|
|
const getProductFavoriteData = (uid, pid, bid) => {
|
|
|
return co(function*() {
|
...
|
...
|
@@ -233,7 +231,6 @@ const getActivityDataByProductBaseInfo = (data) => { |
|
|
/**
|
|
|
* 获取商品咨询和评论数据
|
|
|
* @param data
|
|
|
* @returns {{}}
|
|
|
*/
|
|
|
const getConsultCommentDataByProductInfo = (data) => {
|
|
|
|
...
|
...
|
@@ -262,7 +259,6 @@ const getConsultCommentDataByProductInfo = (data) => { |
|
|
|
|
|
/**
|
|
|
* 获取品牌数据
|
|
|
* @param data
|
|
|
*/
|
|
|
const getBrandDataByProductBaseInfo = (data) => {
|
|
|
|
...
|
...
|
@@ -325,8 +321,6 @@ const getBrandDataByProductBaseInfo = (data) => { |
|
|
|
|
|
/**
|
|
|
* 获得sku商品数据
|
|
|
* @param data
|
|
|
* @returns {{defaultImage: number, skuGoods: number, totalStorageNum: number}}
|
|
|
*/
|
|
|
const getSkuDataByProductBaseInfo = (data) => {
|
|
|
let totalStorageNum = 0;
|
...
|
...
|
@@ -517,7 +511,6 @@ const getFashionTopGoodsStatus = (uid, showStatus, isBeginSale) => { |
|
|
|
|
|
/**
|
|
|
* 获取分类导航列表
|
|
|
* @returns {Promise.<{}>}
|
|
|
*/
|
|
|
// controller item.php 32;
|
|
|
function getSortNavAsync(smallSortId, gender) {
|
...
|
...
|
@@ -1339,9 +1332,6 @@ const getSizeInfoAsync = (productSkn, maxSortId)=> { |
|
|
|
|
|
/**
|
|
|
* 获取评论
|
|
|
* @param pid
|
|
|
* @param page
|
|
|
* @param size
|
|
|
*/
|
|
|
module.exports.indexCommentAsync = (pid, page, size) => {
|
|
|
return co(function *() {
|
...
|
...
|
@@ -1403,14 +1393,14 @@ module.exports.indexConsultAsync = (uid, pid, page, size) => { |
|
|
|
|
|
/**
|
|
|
* 添加咨询
|
|
|
* @param uid
|
|
|
* @param pid
|
|
|
* @param content
|
|
|
*/
|
|
|
module.exports.createConsultAsync = (uid, pid, content) => {
|
|
|
return consultAPI.createAsync(uid, pid, content);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取某一个商品详情主页面
|
|
|
*/
|
|
|
module.exports.showMainAsync = (data) => {
|
|
|
|
|
|
return co(function * () {
|
...
|
...
|
@@ -1442,3 +1432,62 @@ module.exports.showMainAsync = (data) => { |
|
|
return result;
|
|
|
})();
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取某一个商品的热区数据
|
|
|
*/
|
|
|
module.exports.indexHotAreaAsync = (pid) => {
|
|
|
return co(function *() {
|
|
|
let data = yield hotAreaAPI.indexAsync(pid);
|
|
|
|
|
|
if (data.code && data.code === 200 && data.data) {
|
|
|
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);
|
|
|
}, []);
|
|
|
|
|
|
if (_.isEmpty(item)) {
|
|
|
return result;
|
|
|
} else {
|
|
|
result.push(item);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
}, []);
|
|
|
}
|
|
|
|
|
|
return [];
|
|
|
})();
|
|
|
} |
...
|
...
|
|