修复详情页接口返回至断未定义goodsImagesList报错的bug
Showing
1 changed file
with
24 additions
and
19 deletions
@@ -165,26 +165,31 @@ class DetailModel | @@ -165,26 +165,31 @@ class DetailModel | ||
165 | foreach ($baseInfo['goodsList'] as $value) { | 165 | foreach ($baseInfo['goodsList'] as $value) { |
166 | $colorId = intval($value['colorId']); | 166 | $colorId = intval($value['colorId']); |
167 | // 商品按颜色进行分类分组 | 167 | // 商品按颜色进行分类分组 |
168 | - foreach ($value['goodsImagesList'] as $goods) { | ||
169 | - $goodsList[$goods['goodsId']] = $colorId; | ||
170 | - $goodsGroup[$colorId][] = array( | ||
171 | - 'goodsId' => $goods['goodsId'], | ||
172 | - 'img' => $goods['imageUrl'], | ||
173 | - ); | ||
174 | - $colorGroup[$colorId] = array( | ||
175 | - 'colorId' => $colorId, | ||
176 | - 'colorName' => $value['colorName'], | ||
177 | - 'colorImage' => Helpers::getImageUrl($value['colorImage'], 60, 60), | ||
178 | - ); | ||
179 | - } | 168 | + if (isset($value['goodsImagesList'])) { |
169 | + foreach ($value['goodsImagesList'] as $goods) { | ||
170 | + $goodsList[$goods['goodsId']] = $colorId; | ||
171 | + $goodsGroup[$colorId][] = array( | ||
172 | + 'goodsId' => $goods['goodsId'], | ||
173 | + 'img' => $goods['imageUrl'], | ||
174 | + ); | ||
175 | + $colorGroup[$colorId] = array( | ||
176 | + 'colorId' => $colorId, | ||
177 | + 'colorName' => $value['colorName'], | ||
178 | + 'colorImage' => Helpers::getImageUrl($value['colorImage'], 60, 60), | ||
179 | + ); | ||
180 | + } | ||
181 | + } | ||
182 | + | ||
180 | // 商品的尺码列表 | 183 | // 商品的尺码列表 |
181 | - foreach ($value['goodsSizeBoList'] as $size) { | ||
182 | - $sizeGroup[$colorId] = array( | ||
183 | - 'sizeName' => $size['sizeName'], | ||
184 | - 'sizeSku' => $size['goodsSizeSkuId'], | ||
185 | - 'sizeStorage' => $size['goodsSizeStorageNum'], | ||
186 | - ); | ||
187 | - } | 184 | + if (isset($value['goodsSizeBoList'])) { |
185 | + foreach ($value['goodsSizeBoList'] as $size) { | ||
186 | + $sizeGroup[$colorId] = array( | ||
187 | + 'sizeName' => $size['sizeName'], | ||
188 | + 'sizeSku' => $size['goodsSizeSkuId'], | ||
189 | + 'sizeStorage' => $size['goodsSizeStorageNum'], | ||
190 | + ); | ||
191 | + } | ||
192 | + } | ||
188 | } | 193 | } |
189 | 194 | ||
190 | // 商品图 | 195 | // 商品图 |
-
Please register or login to post a comment