...
|
...
|
@@ -18,6 +18,7 @@ const headerModel = require('../../../doraemon/models/header'); |
|
|
const _ = require('lodash');
|
|
|
|
|
|
const publicHandler = require('./public-handler');
|
|
|
const log = require(`${global.library}/logger`);
|
|
|
|
|
|
// 奥莱频道资源码
|
|
|
const channelCode = {
|
...
|
...
|
@@ -41,10 +42,6 @@ exports.getOutletsIndexData = (params, channel) => { |
|
|
outletsApi.getOutletsActivityOrigin({type: '1', channel: channel}), // 获取限时活动列表
|
|
|
outletsApi.getOutletsActivityOrigin({type: '2', channel: channel}), // 获取即将结束列表
|
|
|
outletsApi.getOutletsTrendData({limit: '30', channel: channel}), // 获取潮流速递商品数据
|
|
|
outletsApi.getOutletsGoodsList(Object.assign(
|
|
|
params,
|
|
|
{limit: params.limit || '100', channel: channel}
|
|
|
)), // 获取底部商品数据
|
|
|
outletsApi.getOutletsActivityOrigin({type: '3', channel: channel}) // tar add 16171552 即将上线数据
|
|
|
]).then(result => {
|
|
|
|
...
|
...
|
@@ -77,35 +74,51 @@ exports.getOutletsIndexData = (params, channel) => { |
|
|
finalResult.limitedBuy.extra.trendGood = outletsProcess.handleOutletstrendGoodData(result[4].data);
|
|
|
}
|
|
|
|
|
|
// 处理底部商品数据
|
|
|
// 处理即将上架品牌数据
|
|
|
if (result[5].code === 200 && !_.isEmpty(result[5].data)) {
|
|
|
Object.assign(finalResult.goodsBoard, {
|
|
|
sort: Object.assign(publicHandler.handleSaleOptsData(params, result[5].data.total), {newPage: true}),
|
|
|
list: productProcess.processProductList(result[5].data.product_list)
|
|
|
});
|
|
|
|
|
|
// 添加锚点
|
|
|
if (finalResult.goodsBoard.sort.sortType) {
|
|
|
_.forEach(finalResult.goodsBoard.sort.sortType, (value, key) => {
|
|
|
finalResult.goodsBoard.sort.sortType[key].href += '#otspool';
|
|
|
});
|
|
|
if (finalResult.goodsBoard.sort.preHref) {
|
|
|
finalResult.goodsBoard.sort.preHref += '#otspool';
|
|
|
}
|
|
|
if (finalResult.goodsBoard.sort.nextHref) {
|
|
|
finalResult.goodsBoard.sort.nextHref += '#otspool';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
finalResult.goodsBoard.pager = publicHandler.handleSalePagerData(result[5].data.total, params);
|
|
|
finalResult.limitedBuy.extra.comeSoon = outletsProcess.handleComeSoonData(result[5].data);
|
|
|
}
|
|
|
|
|
|
// 处理即将上架品牌数据
|
|
|
if (result[6].code === 200 && !_.isEmpty(result[6].data)) {
|
|
|
finalResult.limitedBuy.extra.comeSoon = outletsProcess.handleComeSoonData(result[6].data);
|
|
|
// 如果后台没配分类,不显示商品列表
|
|
|
if (!finalResult.goodsBoard.goodsMenu.msort && !finalResult.goodsBoard.goodsMenu.msort) {
|
|
|
log.info('no config index sort');
|
|
|
return finalResult;
|
|
|
}
|
|
|
|
|
|
return finalResult;
|
|
|
// 获取底部商品数据
|
|
|
return api.all([
|
|
|
outletsApi.getOutletsGoodsList(Object.assign(
|
|
|
params,
|
|
|
{limit: params.limit || '100', channel: channel, method: 'app.search.category',
|
|
|
msort: finalResult.goodsBoard.goodsMenu.msort.join(','),
|
|
|
misort: finalResult.goodsBoard.goodsMenu.misort.join(',')
|
|
|
}
|
|
|
))
|
|
|
]).then(data => {
|
|
|
// 处理底部商品数据
|
|
|
if (data[0].code === 200 && !_.isEmpty(data[0].data)) {
|
|
|
Object.assign(finalResult.goodsBoard, {
|
|
|
sort: Object.assign(publicHandler.handleSaleOptsData(params, data[0].data.total), {newPage: true}),
|
|
|
list: productProcess.processProductList(data[0].data.product_list)
|
|
|
});
|
|
|
|
|
|
// 添加锚点
|
|
|
if (finalResult.goodsBoard.sort.sortType) {
|
|
|
_.forEach(finalResult.goodsBoard.sort.sortType, (value, key) => {
|
|
|
finalResult.goodsBoard.sort.sortType[key].href += '#otspool';
|
|
|
});
|
|
|
if (finalResult.goodsBoard.sort.preHref) {
|
|
|
finalResult.goodsBoard.sort.preHref += '#otspool';
|
|
|
}
|
|
|
if (finalResult.goodsBoard.sort.nextHref) {
|
|
|
finalResult.goodsBoard.sort.nextHref += '#otspool';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
finalResult.goodsBoard.pager = publicHandler.handleSalePagerData(data[0].data.total, params);
|
|
|
}
|
|
|
return finalResult;
|
|
|
});
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
@@ -135,10 +148,7 @@ exports.getOutletsChannelData = (params, channel) => { |
|
|
size: 0,
|
|
|
channel: channel,
|
|
|
type: 1
|
|
|
}),
|
|
|
|
|
|
// 获取奥莱商品列表
|
|
|
outletsApi.getOutletsGoodsList(Object.assign(params, {channel: channel}))
|
|
|
})
|
|
|
];
|
|
|
|
|
|
return api.all(apiArr).then(result => {
|
...
|
...
|
@@ -162,31 +172,47 @@ exports.getOutletsChannelData = (params, channel) => { |
|
|
channelData.nearOver = outletsProcess.handleOutletsActivityData(result[2].data, '限时嗨购');
|
|
|
}
|
|
|
|
|
|
// 商品列表
|
|
|
if (result[3].code === 200) {
|
|
|
if (!channelData.goodsBoard) {
|
|
|
channelData.goodsBoard = {};
|
|
|
}
|
|
|
channelData.goodsBoard.sort = publicHandler.handleSaleOptsData(params, result[3].data.total);
|
|
|
channelData.goodsBoard.sort.newPage = true;
|
|
|
channelData.goodsBoard.list = productProcess.processProductList(result[3].data.product_list);
|
|
|
channelData.goodsBoard.pager = publicHandler.handleSalePagerData(result[3].data.total, params);
|
|
|
|
|
|
// 添加锚点
|
|
|
if (channelData.goodsBoard.sort.sortType) {
|
|
|
_.forEach(channelData.goodsBoard.sort.sortType, (value, key) => {
|
|
|
channelData.goodsBoard.sort.sortType[key].href += '#otspool';
|
|
|
});
|
|
|
if (channelData.goodsBoard.sort.preHref) {
|
|
|
channelData.goodsBoard.sort.preHref += '#otspool';
|
|
|
// 如果后台没配分类,不显示商品列表
|
|
|
if (!channelData.goodsBoard || !channelData.goodsBoard.goodsMenu ||
|
|
|
(!channelData.goodsBoard.goodsMenu.msort && !channelData.goodsBoard.goodsMenu.msort)) {
|
|
|
log.info('no config ' + channel + 'channel sort');
|
|
|
return channelData;
|
|
|
}
|
|
|
|
|
|
// 获取底部商品数据
|
|
|
return api.all([
|
|
|
outletsApi.getOutletsGoodsList(Object.assign(
|
|
|
params,
|
|
|
{limit: params.limit || '100', channel: channel, method: 'app.search.category',
|
|
|
msort: channelData.goodsBoard.goodsMenu.msort.join(),
|
|
|
misort: channelData.goodsBoard.goodsMenu.misort.join()
|
|
|
}
|
|
|
))
|
|
|
]).then(data => {
|
|
|
if (data[0].code === 200) {
|
|
|
if (!channelData.goodsBoard) {
|
|
|
channelData.goodsBoard = {};
|
|
|
}
|
|
|
if (channelData.goodsBoard.sort.nextHref) {
|
|
|
channelData.goodsBoard.sort.nextHref += '#otspool';
|
|
|
channelData.goodsBoard.sort = publicHandler.handleSaleOptsData(params, data[0].data.total);
|
|
|
channelData.goodsBoard.sort.newPage = true;
|
|
|
channelData.goodsBoard.list = productProcess.processProductList(data[0].data.product_list);
|
|
|
channelData.goodsBoard.pager = publicHandler.handleSalePagerData(data[0].data.total, params);
|
|
|
|
|
|
// 添加锚点
|
|
|
if (channelData.goodsBoard.sort.sortType) {
|
|
|
_.forEach(channelData.goodsBoard.sort.sortType, (value, key) => {
|
|
|
channelData.goodsBoard.sort.sortType[key].href += '#otspool';
|
|
|
});
|
|
|
if (channelData.goodsBoard.sort.preHref) {
|
|
|
channelData.goodsBoard.sort.preHref += '#otspool';
|
|
|
}
|
|
|
if (channelData.goodsBoard.sort.nextHref) {
|
|
|
channelData.goodsBoard.sort.nextHref += '#otspool';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return channelData;
|
|
|
return channelData;
|
|
|
});
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
|