Authored by zzzzzzz

优化代码

... ... @@ -573,7 +573,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
dest.goodsName = origin.productName;
// 是否是虚拟商品
dest.virtualGoods = origin.attribute * 1 === 3 ? true : false;
dest.virtualGoods = ((origin.attribute * 1 === 3) ? true : false);
// 用户未登录时
if (!uid) {
... ... @@ -610,28 +610,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
let productTags = {};
_.forEach(origin.tags, function(value) {
switch (value) {
case 'is_soon_sold_out':
productTags.is_soon_sold_out = true;
break;
case 'is_new':
productTags.is_new = true;
break;
case 'is_discount':
productTags.is_discount = true;
break;
case 'is_limited':
productTags.is_limited = true;
break;
case 'is_yohood':
productTags.is_yohood = true;
break;
case 'is_advance':
productTags.is_advance = true;
break;
default:
break;
}
productTags[value] = true;
});
dest.tags = productTags;
... ... @@ -764,10 +743,8 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
storage: size.storageNumber
};
allSizeList[sizeName] = (allSizeList[sizeName] === null ||
typeof allSizeList[sizeName] === 'undefined') ? build :
allSizeList[sizeName];
allSizeList[sizeName] = (allSizeList[sizeName] === null ||
typeof allSizeList[sizeName] === 'undefined') ? build : allSizeList[sizeName];
colorStorageNum += parseInt(size.storageNumber, 10);
colorStorageGroup[value.productSkc][sizeName] = parseInt(size.storageNumber, 10);
});
... ... @@ -1078,4 +1055,4 @@ let getProductData = (data) => {
module.exports = {
getProductData
};
};
\ No newline at end of file
... ...