Authored by 郭成尧

'data判断'

@@ -22,6 +22,8 @@ const getShopData = params => { @@ -22,6 +22,8 @@ const getShopData = params => {
22 22
23 return shopApi.getBrandInfoByDomain({domain: params.domain}).then(result => { 23 return shopApi.getBrandInfoByDomain({domain: params.domain}).then(result => {
24 24
  25 + if (result.data) {
  26 +
25 /* 品牌名称 */ 27 /* 品牌名称 */
26 Object.assign(finalResult, { 28 Object.assign(finalResult, {
27 brandName: result.data.brand_name 29 brandName: result.data.brand_name
@@ -43,6 +45,8 @@ const getShopData = params => { @@ -43,6 +45,8 @@ const getShopData = params => {
43 // uid: '8050882' 45 // uid: '8050882'
44 }).then(subResult => { 46 }).then(subResult => {
45 47
  48 + if (subResult.data) {
  49 +
46 /* 取店铺的基本信息 */ 50 /* 取店铺的基本信息 */
47 Object.assign(finalResult, { 51 Object.assign(finalResult, {
48 shopLogo: subResult.data.shop_logo, 52 shopLogo: subResult.data.shop_logo,
@@ -53,6 +57,7 @@ const getShopData = params => { @@ -53,6 +57,7 @@ const getShopData = params => {
53 57
54 /* 取资源位店铺背景图 */ 58 /* 取资源位店铺背景图 */
55 return shopApi.getShopsDecoratorList({shopId: result.data.shop_id}).then(thResult => { 59 return shopApi.getShopsDecoratorList({shopId: result.data.shop_id}).then(thResult => {
  60 + if (thResult.data) {
56 _.forEach(thResult.data.list, value => { 61 _.forEach(thResult.data.list, value => {
57 62
58 if (value.resource_name === 'shopTopBanner_app') { 63 if (value.resource_name === 'shopTopBanner_app') {
@@ -61,10 +66,16 @@ const getShopData = params => { @@ -61,10 +66,16 @@ const getShopData = params => {
61 }); 66 });
62 } 67 }
63 }); 68 });
  69 + } else {
  70 + logger.error('getShopsDecoratorList api no data');
  71 + }
64 72
65 return finalResult; 73 return finalResult;
66 }); 74 });
67 - 75 + } else {
  76 + logger.error('getShopInfoData api no data');
  77 + }
  78 + return finalResult;
68 }); 79 });
69 } else { 80 } else {
70 81
@@ -75,6 +86,10 @@ const getShopData = params => { @@ -75,6 +86,10 @@ const getShopData = params => {
75 86
76 logger.info('brand has no shop'); 87 logger.info('brand has no shop');
77 } 88 }
  89 + return finalResult;
  90 + } else {
  91 + logger.error('getBrandInfoByDomain api no data');
  92 + }
78 93
79 return finalResult; 94 return finalResult;
80 }); 95 });
@@ -88,7 +103,9 @@ const getShopData = params => { @@ -88,7 +103,9 @@ const getShopData = params => {
88 const getBrandShopGoodsData = params => { 103 const getBrandShopGoodsData = params => {
89 let finalResult = {}; 104 let finalResult = {};
90 105
91 - return shopApi.getBrandInfoByDomain({ domain: params.domain }).then(result => { 106 + return shopApi.getBrandInfoByDomain({domain: params.domain}).then(result => {
  107 +
  108 + if (result.data) {
92 return shopApi.getBrandShopGoodsOriginData(Object.assign(params, { 109 return shopApi.getBrandShopGoodsOriginData(Object.assign(params, {
93 brand: result.data.id, 110 brand: result.data.id,
94 shopId: result.data.shop_id 111 shopId: result.data.shop_id
@@ -107,9 +124,12 @@ const getBrandShopGoodsData = params => { @@ -107,9 +124,12 @@ const getBrandShopGoodsData = params => {
107 } else { 124 } else {
108 logger.error('getBrandShopGoodsOriginData api no data'); 125 logger.error('getBrandShopGoodsOriginData api no data');
109 } 126 }
110 -  
111 return camelCase(finalResult); 127 return camelCase(finalResult);
112 }); 128 });
  129 + } else {
  130 + logger.error('getBrandInfoByDomain api no data');
  131 + }
  132 + return camelCase(finalResult);
113 }); 133 });
114 }; 134 };
115 135