brand-api-data-struct-change
Showing
1 changed file
with
8 additions
and
7 deletions
@@ -185,13 +185,14 @@ module.exports = class extends global.yoho.BaseModel { | @@ -185,13 +185,14 @@ module.exports = class extends global.yoho.BaseModel { | ||
185 | }; | 185 | }; |
186 | 186 | ||
187 | allList[key].forEach(row => { | 187 | allList[key].forEach(row => { |
188 | - | 188 | + if (row) { |
189 | obj.list.push({ | 189 | obj.list.push({ |
190 | - name: row.brand_name, | ||
191 | - isHot: row.is_hot === 'Y' ? true : false, | ||
192 | - isNew: row.is_show_new === 'Y' ? true : false, | 190 | + name: _.get(row, 'brand_name', ''), |
191 | + isHot: _.get(row, 'is_hot') === 'Y' ? true : false, | ||
192 | + isNew: _.get(row, 'is_show_new') === 'Y' ? true : false, | ||
193 | url: this._urlJump(parseInt(row.type, 10), row) | 193 | url: this._urlJump(parseInt(row.type, 10), row) |
194 | }); | 194 | }); |
195 | + } | ||
195 | }); | 196 | }); |
196 | resu.brandList.push(obj); | 197 | resu.brandList.push(obj); |
197 | } | 198 | } |
@@ -207,9 +208,9 @@ module.exports = class extends global.yoho.BaseModel { | @@ -207,9 +208,9 @@ module.exports = class extends global.yoho.BaseModel { | ||
207 | }; | 208 | }; |
208 | 209 | ||
209 | obj.list.push({ | 210 | obj.list.push({ |
210 | - brandName: newList[key].brand_name, | ||
211 | - url: this._urlJump(parseInt(newList[key].type, 10), newList[key]), | ||
212 | - img: helpers.image(newList[key].brand_ico, 186, 115), | 211 | + brandName: _.get(newList, `${key}.brand_name`, ''), |
212 | + url: this._urlJump(parseInt(_.get(newList, `${key}.type`), 10), _.get(newList, `${key}`)), | ||
213 | + img: helpers.image(_.get(newList, `${key}.brand_ico`), 186, 115), | ||
213 | }); | 214 | }); |
214 | resu.newBrandWall.push(obj); | 215 | resu.newBrandWall.push(obj); |
215 | } | 216 | } |
-
Please register or login to post a comment