Authored by htoooth

健状性增强

@@ -83,28 +83,28 @@ const _getCacheDataByName = (resourceName) => { @@ -83,28 +83,28 @@ const _getCacheDataByName = (resourceName) => {
83 */ 83 */
84 const _getProductFavoriteDataAsync = (uid, pid, bid) => { 84 const _getProductFavoriteDataAsync = (uid, pid, bid) => {
85 return co(function*() { 85 return co(function*() {
86 -  
87 let result = { 86 let result = {
88 product: false, 87 product: false,
89 brand: false 88 brand: false
90 }; 89 };
91 90
92 - if (uid) {  
93 - if (pid) {  
94 - let productData = yield favoriteProductService.isFavoriteAsync(uid, pid); 91 + if (!uid) {
  92 + return result;
  93 + }
95 94
96 - result.product = productData.code === 200 && productData.data ? true : false;  
97 - } 95 + if (pid) {
  96 + let productData = yield favoriteProductService.isFavoriteAsync(uid, pid);
98 97
99 - if (bid) {  
100 - let brandData = yield favoriteBrandService.isFavoriteAsync(uid, bid); 98 + result.product = productData.code === 200 && productData.data ? true : false;
  99 + }
101 100
102 - result.brand = brandData.code && brandData.code === 200 ? true : false;  
103 - } 101 + if (bid) {
  102 + let brandData = yield favoriteBrandService.isFavoriteAsync(uid, bid);
  103 +
  104 + result.brand = brandData.code && brandData.code === 200 ? true : false;
104 } 105 }
105 106
106 return result; 107 return result;
107 -  
108 })(); 108 })();
109 }; 109 };
110 110