修复各频道首页底部banner的banner报错的bug
Showing
1 changed file
with
2 additions
and
2 deletions
@@ -142,10 +142,10 @@ class HomeModel | @@ -142,10 +142,10 @@ class HomeModel | ||
142 | 142 | ||
143 | // 调用接口获取数据 | 143 | // 调用接口获取数据 |
144 | $banner = IndexData::getBannerStart($resource); | 144 | $banner = IndexData::getBannerStart($resource); |
145 | - if (isset($banner['code']) && $banner['code'] == 200) { | 145 | + if (isset($banner['code']) && $banner['code'] == 200 && $banner['data']['total'] > 0) { |
146 | $result = array(); | 146 | $result = array(); |
147 | // 处理数据 | 147 | // 处理数据 |
148 | - foreach ($banner['data'] as $val) { | 148 | + foreach ($banner['data']['list'] as $val) { |
149 | foreach ($val['data'] as $single) { | 149 | foreach ($val['data'] as $single) { |
150 | $result['url'] = ($channel === 2) ? Helpers::url('/boys') : Helpers::url('/girls'); | 150 | $result['url'] = ($channel === 2) ? Helpers::url('/boys') : Helpers::url('/girls'); |
151 | $result['img'] = Helpers::getImageUrl($single['src'], 640, 200); | 151 | $result['img'] = Helpers::getImageUrl($single['src'], 640, 200); |
-
Please register or login to post a comment