修复频道选择页,男首,女首报错的bug
Code Review By Rock Zhang
Showing
2 changed files
with
6 additions
and
6 deletions
@@ -98,8 +98,8 @@ class HomeModel | @@ -98,8 +98,8 @@ class HomeModel | ||
98 | 98 | ||
99 | // 调用接口获取数据 | 99 | // 调用接口获取数据 |
100 | $banner = IndexData::getBannerStart(self::CODE_BG); | 100 | $banner = IndexData::getBannerStart(self::CODE_BG); |
101 | - if (isset($banner['code']) && $banner['code'] == 200 && $banner['data']['total'] > 0) { | ||
102 | - $result = Helpers::getImageUrl($banner['data']['list'][0]['data']['list'][0]['src'], 640, 800, 2); | 101 | + if (isset($banner['code']) && $banner['code'] == 200 && !empty($banner['data'])) { |
102 | + $result = Helpers::getImageUrl($banner['data'][0]['data']['list'][0]['src'], 640, 800, 2); | ||
103 | } | 103 | } |
104 | 104 | ||
105 | if (USE_CACHE) { | 105 | if (USE_CACHE) { |
@@ -183,11 +183,11 @@ class NewsaleModel | @@ -183,11 +183,11 @@ class NewsaleModel | ||
183 | $newsale = NewsaleData::getNewsaleFocus($codeKey); | 183 | $newsale = NewsaleData::getNewsaleFocus($codeKey); |
184 | 184 | ||
185 | // 调用接口获取数据并封装 | 185 | // 调用接口获取数据并封装 |
186 | - if (isset($newsale['code']) && !empty($newsale['data']['list'])) { | ||
187 | - if(count($newsale['data']['list'][0]['data']) === 1) { | ||
188 | - $result = Helpers::formatBanner($newsale['data']['list'][0]['data'][0], 640, 240); | 186 | + if (isset($newsale['code']) && !empty($newsale['data'])) { |
187 | + if(count($newsale['data'][0]['data']) === 1) { | ||
188 | + $result = Helpers::formatBanner($newsale['data'][0]['data'][0], 640, 240); | ||
189 | } else { | 189 | } else { |
190 | - foreach ($newsale['data']['list'][0]['data'] as $one) { | 190 | + foreach ($newsale['data'][0]['data'] as $one) { |
191 | $result['list'][] = Helpers::formatBanner($one, 640, 240); | 191 | $result['list'][] = Helpers::formatBanner($one, 640, 240); |
192 | } | 192 | } |
193 | } | 193 | } |
-
Please register or login to post a comment