...
|
...
|
@@ -1138,11 +1138,15 @@ const getNewArrival = (channel, isJKChannel, poolId)=> { |
|
|
* @param {String} type 传入频道页类型,值可以是: boys, girls, kids, lifestyle
|
|
|
* @return {Object}
|
|
|
*/
|
|
|
const getContent = (type) => {
|
|
|
const getContent = (type, isJKChannel, poolId) => {
|
|
|
|
|
|
let params = {new_device: 'Y'};
|
|
|
|
|
|
return Promise.all([headerModel.requestHeaderData(type), _requestContent(type, params)]).then(res => {
|
|
|
return Promise.all([
|
|
|
headerModel.requestHeaderData(type),
|
|
|
_requestContent(type, params),
|
|
|
getNewArrival(type, isJKChannel, poolId)
|
|
|
]).then(res => {
|
|
|
|
|
|
let headerData = res[0].data || res[0],
|
|
|
contentData = res[1].data ? res[1].data.list : res[1];
|
...
|
...
|
@@ -1156,8 +1160,14 @@ const getContent = (type) => { |
|
|
data.page = 'channel';
|
|
|
data.pageType = type;
|
|
|
data.footerTop = true;
|
|
|
data.channel = processResult.floors;
|
|
|
data.channel = processResult.floors.map(function(elem) {
|
|
|
|
|
|
if (elem.newArrivls) {
|
|
|
elem.newArrivls.goods = res[2];
|
|
|
}
|
|
|
|
|
|
return elem;
|
|
|
});
|
|
|
|
|
|
return {
|
|
|
rawData: contentData,
|
...
|
...
|
@@ -1188,9 +1198,9 @@ const getContent = (type) => { |
|
|
|
|
|
return result.floorData;
|
|
|
});
|
|
|
} else {
|
|
|
return result.floorData || result;
|
|
|
}
|
|
|
|
|
|
return result.floorData || result;
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
@@ -1200,61 +1210,70 @@ const getContent = (type) => { |
|
|
* @return {Object}
|
|
|
*/
|
|
|
const getJKContent = (req) => {
|
|
|
let channel = req.query.channel,
|
|
|
let channel = req.query.channel || req.yoho.channel || 'boys',
|
|
|
contentCode = req.query.content_code;
|
|
|
|
|
|
return Promise.all([headerModel.requestHeaderData(channel),
|
|
|
_requestContent(channel, {}, contentCode)]).then(res => {
|
|
|
return Promise.all([
|
|
|
headerModel.requestHeaderData(channel),
|
|
|
_requestContent(channel, {}, contentCode),
|
|
|
getNewArrival(channel, true, req.query.template_id)
|
|
|
]).then(res => {
|
|
|
|
|
|
let headerData = res[0].data || res[0],
|
|
|
contentData = res[1].data ? res[1].data.list : res[1];
|
|
|
let headerData = res[0].data || res[0],
|
|
|
contentData = res[1].data ? res[1].data.list : res[1];
|
|
|
|
|
|
let data = {};
|
|
|
let data = {};
|
|
|
|
|
|
const processResult = _processJKFloorData(contentData);
|
|
|
const processResult = _processJKFloorData(contentData);
|
|
|
|
|
|
data = headerData;
|
|
|
data.module = 'channel';
|
|
|
data.page = 'channel';
|
|
|
data.pageType = channel;
|
|
|
data.mchannel = 'japanKorean';// 子频道,如日韩馆
|
|
|
data.footerTop = true;
|
|
|
data.channel = processResult.floors;
|
|
|
data = headerData;
|
|
|
data.module = 'channel';
|
|
|
data.page = 'channel';
|
|
|
data.pageType = channel;
|
|
|
data.mchannel = 'japanKorean';// 子频道,如日韩馆
|
|
|
data.footerTop = true;
|
|
|
data.channel = processResult.floors.map(function(elem) {
|
|
|
|
|
|
if (elem.newArrivls) {
|
|
|
elem.newArrivls.goods = res[2];
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
rawData: contentData,
|
|
|
floorData: data,
|
|
|
searchPromise: processResult.promise,
|
|
|
singlehotFloorIndex: processResult.singlehotFloorIndex,
|
|
|
singlehotFloorTitle: processResult.singlehotFloorTitle,
|
|
|
queryParams: processResult.queryParams,
|
|
|
channelType: channel
|
|
|
};
|
|
|
return elem;
|
|
|
});
|
|
|
|
|
|
return {
|
|
|
rawData: contentData,
|
|
|
floorData: data,
|
|
|
searchPromise: processResult.promise,
|
|
|
singlehotFloorIndex: processResult.singlehotFloorIndex,
|
|
|
singlehotFloorTitle: processResult.singlehotFloorTitle,
|
|
|
queryParams: processResult.queryParams,
|
|
|
channelType: channel
|
|
|
};
|
|
|
|
|
|
}).then(result => {
|
|
|
}).then(result => {
|
|
|
|
|
|
// 如果有promise则做相应处理
|
|
|
if (result.searchPromise.length) {
|
|
|
return Promise.all(result.searchPromise).then(res => {
|
|
|
_.forEach(res, (data, index) => {
|
|
|
result.floorData.channel
|
|
|
.splice(result.singlehotFloorIndex[index], 0,
|
|
|
_processFloorDataWithQueryReusult(
|
|
|
result.rawData,
|
|
|
result.queryParams[index],
|
|
|
data,
|
|
|
result.singlehotFloorTitle[index],
|
|
|
result.channelType
|
|
|
));
|
|
|
});
|
|
|
if (result.searchPromise.length) {
|
|
|
return Promise.all(result.searchPromise).then(res => {
|
|
|
_.forEach(res, (data, index) => {
|
|
|
result.floorData.channel
|
|
|
.splice(result.singlehotFloorIndex[index], 0,
|
|
|
_processFloorDataWithQueryReusult(
|
|
|
result.rawData,
|
|
|
result.queryParams[index],
|
|
|
data,
|
|
|
result.singlehotFloorTitle[index],
|
|
|
result.channelType
|
|
|
));
|
|
|
});
|
|
|
|
|
|
return result.floorData;
|
|
|
});
|
|
|
} else {
|
|
|
return result.floorData || result;
|
|
|
}
|
|
|
return result.floorData;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return result.floorData || result;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const getResourceData = (formatData) => {
|
...
|
...
|
|