Authored by Rock Zhang

修复频道首页底部banner报错的bug

Code Review By Rock Zhang
@@ -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 && $banner['data']['total'] > 0) { 145 + if (isset($banner['code']) && $banner['code'] == 200 && !empty($banner['data'])) {
146 $result = array(); 146 $result = array();
147 // 处理数据 147 // 处理数据
148 - foreach ($banner['data']['list'] as $val) { 148 + foreach ($banner['data'] 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);