From 08e2272324a312499fb42e6cdd3f6edca9736cbf Mon Sep 17 00:00:00 2001 From: hf <fei.hong@yoho.cn> Date: Tue, 20 Oct 2015 14:48:51 +0800 Subject: [PATCH] fixes bug to kids page show floor --- library/Plugin/DataProcess/FloorProcess.php | 64 ++++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/library/Plugin/DataProcess/FloorProcess.php b/library/Plugin/DataProcess/FloorProcess.php index 63eb1e0..17db708 100644 --- a/library/Plugin/DataProcess/FloorProcess.php +++ b/library/Plugin/DataProcess/FloorProcess.php @@ -1,6 +1,7 @@ <?php namespace Plugin\DataProcess; + use Plugin\Helpers; /** @@ -17,19 +18,20 @@ class FloorProcess public static function getContent($data, $type = 1) { $result = array(); - if(empty($data['list'])){ - return $result; - } - foreach ($data['list'] as $v){ - $fun = $v['template_name']; - $data = self::$fun($v['data'],$type); - if(empty($data)){ - continue; + if (!empty($data['list'])) { + foreach ($data['list'] as $v) { + $fun = $v['template_name']; + if (!is_callable("self::$fun")) { + continue; + } + $data = self::$fun($v['data'], $type); + if (empty($data)) { + continue; + } + $result[] = $data; } - $result[] = $data; } return $result; - } /** @@ -43,12 +45,12 @@ class FloorProcess $result = array(); foreach ($data as &$one) { - $one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1); - unset($one['src']); + $one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1); + unset($one['src']); } $result['list'] = $data; - return array('bannerTop'=>$result); + return array('bannerTop' => $result); } /** @@ -62,12 +64,12 @@ class FloorProcess $result = array(); foreach ($data as &$one) { - $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1); - unset($one['src']); + $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1); + unset($one['src']); } $result['list'] = $data; - return array('iconsEnter'=>$result); + return array('iconsEnter' => $result); } /** @@ -78,7 +80,7 @@ class FloorProcess */ private static function single_image($data, $type) { - if(empty($data)){ + if (empty($data)) { return array(); } foreach ($data as &$one) { @@ -86,7 +88,7 @@ class FloorProcess unset($one['src']); } - return array('banner'=>$data); + return array('banner' => $data); } /** @@ -108,7 +110,7 @@ class FloorProcess unset($data['title']); $result = $data; - return array('hotCategory'=>$result); + return array('hotCategory' => $result); } /** @@ -130,7 +132,7 @@ class FloorProcess } $result = $data; - return array('hotBrands'=>$result); + return array('hotBrands' => $result); } /** @@ -153,7 +155,7 @@ class FloorProcess } $result = $data; - return array('trendColloaction'=>$result); + return array('trendColloaction' => $result); } /** @@ -172,7 +174,7 @@ class FloorProcess } $result = $data; - return array('trendTopics'=>$result); + return array('trendTopics' => $result); } /** @@ -198,7 +200,7 @@ class FloorProcess } $result = $data; - return array('goodsCategory'=>$result); + return array('goodsCategory' => $result); } /** @@ -225,7 +227,7 @@ class FloorProcess } $result = $data; - return array('creativeLife'=>$result); + return array('creativeLife' => $result); } /** @@ -244,7 +246,7 @@ class FloorProcess } $result = $data; - return array('small_pic'=>$result); + return array('small_pic' => $result); } /** @@ -253,15 +255,17 @@ class FloorProcess * @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle * @return array 处理之后的单名字图片数据 */ - private static function single_name_image($data,$type){ - - if(empty($data)){ + private static function single_name_image($data, $type) + { + + if (empty($data)) { return array(); } $data['name'] = $data['title']; $data['img'] = Helpers::getImageUrl($data['src'], 640, 198, 2); - - return array('plusStar'=>$data); + + return array('plusStar' => $data); } + } -- libgit2 0.24.0