Authored by 郭成尧

'data判断'

... ... @@ -22,6 +22,8 @@ const getShopData = params => {
return shopApi.getBrandInfoByDomain({domain: params.domain}).then(result => {
if (result.data) {
/* 品牌名称 */
Object.assign(finalResult, {
brandName: result.data.brand_name
... ... @@ -43,6 +45,8 @@ const getShopData = params => {
// uid: '8050882'
}).then(subResult => {
if (subResult.data) {
/* 取店铺的基本信息 */
Object.assign(finalResult, {
shopLogo: subResult.data.shop_logo,
... ... @@ -53,6 +57,7 @@ const getShopData = params => {
/* 取资源位店铺背景图 */
return shopApi.getShopsDecoratorList({shopId: result.data.shop_id}).then(thResult => {
if (thResult.data) {
_.forEach(thResult.data.list, value => {
if (value.resource_name === 'shopTopBanner_app') {
... ... @@ -61,10 +66,16 @@ const getShopData = params => {
});
}
});
} else {
logger.error('getShopsDecoratorList api no data');
}
return finalResult;
});
} else {
logger.error('getShopInfoData api no data');
}
return finalResult;
});
} else {
... ... @@ -75,6 +86,10 @@ const getShopData = params => {
logger.info('brand has no shop');
}
return finalResult;
} else {
logger.error('getBrandInfoByDomain api no data');
}
return finalResult;
});
... ... @@ -88,7 +103,9 @@ const getShopData = params => {
const getBrandShopGoodsData = params => {
let finalResult = {};
return shopApi.getBrandInfoByDomain({ domain: params.domain }).then(result => {
return shopApi.getBrandInfoByDomain({domain: params.domain}).then(result => {
if (result.data) {
return shopApi.getBrandShopGoodsOriginData(Object.assign(params, {
brand: result.data.id,
shopId: result.data.shop_id
... ... @@ -107,9 +124,12 @@ const getBrandShopGoodsData = params => {
} else {
logger.error('getBrandShopGoodsOriginData api no data');
}
return camelCase(finalResult);
});
} else {
logger.error('getBrandInfoByDomain api no data');
}
return camelCase(finalResult);
});
};
... ...