Authored by runner

最新上架 修改

... ... @@ -726,7 +726,7 @@ const getNewArrival = channel => {
sales: 'Y',
attribute_not: 2,
stocknumber: 3,
shelve_time: _getShelveTime(20)
shelve_time: _getShelveTime(2)
};
params.gender = channelMap[channel].gender;
... ... @@ -744,7 +744,6 @@ const getNewArrival = channel => {
_.forEach(sortList, (it, index) => {
if (res[index].data &&
res[index].data.product_list &&
res[index].data.product_list.length === sortList[index].viewNum) {
data = data.concat(res[index].data.product_list);
... ... @@ -754,7 +753,8 @@ const getNewArrival = channel => {
_.forEach(data, (item) => {
result.push(processProduct(item, {
width: 280,
height: 373
height: 373,
gender: params.gender
}));
});
... ...
... ... @@ -39,6 +39,31 @@ const handleGoodsListData = (origin) => {
};
/**
* 根据性别来决定 默认图片获取字段 如果是 2、3
*
* 2、3: cover2 --> images_url -> cover1
* 1,3 :cover1 --> images_url -> cover2
* 其他: cover1 --> cover2 --> images_url
*
* @param array $images
* @return string 商品图片
*/
const procProductImgs = (images, gender) => {
let imgUrl = images['images_url'] ? images['images_url'] : '',
cover1 = images['cover_1'] ? images['cover_1'] : '',
cover2 = images['cover_2'] ? images['cover_2'] : '';
if (gender === '2,3') {
return cover2 ? cover2 : (imgUrl ? imgUrl : cover1);
}
else if (gender == '1,3') {
return cover1 ? cover1 : (imgUrl ? imgUrl : cover2);
}
else {
return cover1 ? cover1 : (cover2 ? cover2 : imgUrl);
}
}
/**
* 商品搜索商品数据处理
*/
exports.processProductList = (list, options) => {
... ... @@ -297,12 +322,12 @@ exports.processProduct = (productData, options) => {
// 设置默认图片
_.forEach(productData.goods_list, item => {
if (item.is_default === 'Y') {
productData.default_images = item.images_url;
productData.default_images = procProductImgs(item, options.gender);
}
});
if (!productData.default_images) {
productData.default_images = productData.goods_list[0].images_url;
productData.default_images = procProductImgs(productData.goods_list[0], options.gender);
}
result.id = productData.product_skn;
... ...