...
|
...
|
@@ -5,7 +5,6 @@ |
|
|
*/
|
|
|
'use strict';
|
|
|
const serviceAPI = global.yoho.ServiceAPI;
|
|
|
|
|
|
const api = global.yoho.API;
|
|
|
const camelCase = global.yoho.camelCase;
|
|
|
const _ = require('lodash');
|
...
|
...
|
@@ -56,14 +55,16 @@ const _processListData = (list) => { |
|
|
listData = _.assign(listData, {
|
|
|
total: list.total
|
|
|
});
|
|
|
// console.log(list)
|
|
|
|
|
|
_.forEach(list.list.artList, (data, index) => {
|
|
|
if (index === 0) {
|
|
|
|
|
|
if (data.author) {
|
|
|
listData = _.assign(listData, {
|
|
|
authorName: data.author.name
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
data.publishTime = data.publishTime.replace(/年|月/g, '/');
|
|
|
data.publishTime = data.publishTime.replace(/日/g, '');
|
|
|
|
...
|
...
|
@@ -258,10 +259,11 @@ const _processHeadData = (list) => { |
|
|
|
|
|
|
|
|
// 推荐商品
|
|
|
const _getRelatedData = () => {
|
|
|
const _getRelatedData = (sknList) => {
|
|
|
// console.log(id);
|
|
|
return api.get('', {
|
|
|
query: '51152761,51178582,51146105,51149561,51149414,51082157,51079256',
|
|
|
//query: '51152761,51178582,51146105,51149561,51149414,51082157,51079256,',
|
|
|
qurey: sknList,
|
|
|
method: 'app.search.li'
|
|
|
}).then((result) => {
|
|
|
let productList = [];
|
...
|
...
|
@@ -317,6 +319,7 @@ const _processContentData = (list) => { |
|
|
contentData.contents = list;
|
|
|
|
|
|
// let idList = '';
|
|
|
let sknList = '';
|
|
|
let formatData = [];
|
|
|
|
|
|
_.forEach(contentData.contents, function(value) {
|
...
|
...
|
@@ -330,46 +333,37 @@ const _processContentData = (list) => { |
|
|
formatData.push(data);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// console.log(formatData)
|
|
|
if (value.goodsGroup) {
|
|
|
|
|
|
_.forEach(value.goodsGroup.data, function(data) {
|
|
|
// console.log(data)
|
|
|
_.forEach(data.list, function(value) {
|
|
|
sknList += value.id + ',';
|
|
|
|
|
|
formatData.push(value);
|
|
|
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
_getRelatedData().then((result) => {
|
|
|
// formatData.push(result);
|
|
|
// console.log(formatData);
|
|
|
_getRelatedData(sknList).then((result) => {
|
|
|
|
|
|
_.forEach(formatData, function(data, index) {
|
|
|
//console.log(formatData)
|
|
|
|
|
|
data[index] = _.assign(result[index]);
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
// console.log(formatData);
|
|
|
//console.log(formatData)
|
|
|
return formatData;
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
// if (value.goodsGroup) {
|
|
|
// _.forEach(value.goodsGroup.data, function(data) {
|
|
|
// // console.log(data)
|
|
|
// _.forEach(data.list, function(value) {
|
|
|
// // console.log(value)
|
|
|
// _getRelatedData(51152761).then((result) => {
|
|
|
// // console.log(result)
|
|
|
// value = _.assign(value, result);
|
|
|
// value = _.assign(value, {
|
|
|
// link: `${config.siteUrl}/product/pro_${result.id}_${value.productSkc}/${result.cnAlphabet}`
|
|
|
// });
|
|
|
|
|
|
// // console.log(value)
|
|
|
// });
|
|
|
// });
|
|
|
// });
|
|
|
// }
|
|
|
|
|
|
return contentData;
|
|
|
return contentData;
|
|
|
};
|
|
|
|
|
|
/**
|
...
|
...
|
|