Authored by hf

fixes bug to kids page show floor

1 <?php 1 <?php
2 2
3 namespace Plugin\DataProcess; 3 namespace Plugin\DataProcess;
  4 +
4 use Plugin\Helpers; 5 use Plugin\Helpers;
5 6
6 /** 7 /**
@@ -17,19 +18,20 @@ class FloorProcess @@ -17,19 +18,20 @@ class FloorProcess
17 public static function getContent($data, $type = 1) 18 public static function getContent($data, $type = 1)
18 { 19 {
19 $result = array(); 20 $result = array();
20 - if(empty($data['list'])){  
21 - return $result;  
22 - }  
23 - foreach ($data['list'] as $v){  
24 - $fun = $v['template_name'];  
25 - $data = self::$fun($v['data'],$type);  
26 - if(empty($data)){  
27 - continue; 21 + if (!empty($data['list'])) {
  22 + foreach ($data['list'] as $v) {
  23 + $fun = $v['template_name'];
  24 + if (!is_callable("self::$fun")) {
  25 + continue;
  26 + }
  27 + $data = self::$fun($v['data'], $type);
  28 + if (empty($data)) {
  29 + continue;
  30 + }
  31 + $result[] = $data;
28 } 32 }
29 - $result[] = $data;  
30 } 33 }
31 return $result; 34 return $result;
32 -  
33 } 35 }
34 36
35 /** 37 /**
@@ -43,12 +45,12 @@ class FloorProcess @@ -43,12 +45,12 @@ class FloorProcess
43 $result = array(); 45 $result = array();
44 46
45 foreach ($data as &$one) { 47 foreach ($data as &$one) {
46 - $one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);  
47 - unset($one['src']); 48 + $one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);
  49 + unset($one['src']);
48 } 50 }
49 $result['list'] = $data; 51 $result['list'] = $data;
50 52
51 - return array('bannerTop'=>$result); 53 + return array('bannerTop' => $result);
52 } 54 }
53 55
54 /** 56 /**
@@ -62,12 +64,12 @@ class FloorProcess @@ -62,12 +64,12 @@ class FloorProcess
62 $result = array(); 64 $result = array();
63 65
64 foreach ($data as &$one) { 66 foreach ($data as &$one) {
65 - $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);  
66 - unset($one['src']); 67 + $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
  68 + unset($one['src']);
67 } 69 }
68 $result['list'] = $data; 70 $result['list'] = $data;
69 71
70 - return array('iconsEnter'=>$result); 72 + return array('iconsEnter' => $result);
71 } 73 }
72 74
73 /** 75 /**
@@ -78,7 +80,7 @@ class FloorProcess @@ -78,7 +80,7 @@ class FloorProcess
78 */ 80 */
79 private static function single_image($data, $type) 81 private static function single_image($data, $type)
80 { 82 {
81 - if(empty($data)){ 83 + if (empty($data)) {
82 return array(); 84 return array();
83 } 85 }
84 foreach ($data as &$one) { 86 foreach ($data as &$one) {
@@ -86,7 +88,7 @@ class FloorProcess @@ -86,7 +88,7 @@ class FloorProcess
86 unset($one['src']); 88 unset($one['src']);
87 } 89 }
88 90
89 - return array('banner'=>$data); 91 + return array('banner' => $data);
90 } 92 }
91 93
92 /** 94 /**
@@ -108,7 +110,7 @@ class FloorProcess @@ -108,7 +110,7 @@ class FloorProcess
108 unset($data['title']); 110 unset($data['title']);
109 $result = $data; 111 $result = $data;
110 112
111 - return array('hotCategory'=>$result); 113 + return array('hotCategory' => $result);
112 } 114 }
113 115
114 /** 116 /**
@@ -130,7 +132,7 @@ class FloorProcess @@ -130,7 +132,7 @@ class FloorProcess
130 } 132 }
131 $result = $data; 133 $result = $data;
132 134
133 - return array('hotBrands'=>$result); 135 + return array('hotBrands' => $result);
134 } 136 }
135 137
136 /** 138 /**
@@ -153,7 +155,7 @@ class FloorProcess @@ -153,7 +155,7 @@ class FloorProcess
153 } 155 }
154 $result = $data; 156 $result = $data;
155 157
156 - return array('trendColloaction'=>$result); 158 + return array('trendColloaction' => $result);
157 } 159 }
158 160
159 /** 161 /**
@@ -172,7 +174,7 @@ class FloorProcess @@ -172,7 +174,7 @@ class FloorProcess
172 } 174 }
173 $result = $data; 175 $result = $data;
174 176
175 - return array('trendTopics'=>$result); 177 + return array('trendTopics' => $result);
176 } 178 }
177 179
178 /** 180 /**
@@ -198,7 +200,7 @@ class FloorProcess @@ -198,7 +200,7 @@ class FloorProcess
198 } 200 }
199 $result = $data; 201 $result = $data;
200 202
201 - return array('goodsCategory'=>$result); 203 + return array('goodsCategory' => $result);
202 } 204 }
203 205
204 /** 206 /**
@@ -225,7 +227,7 @@ class FloorProcess @@ -225,7 +227,7 @@ class FloorProcess
225 } 227 }
226 $result = $data; 228 $result = $data;
227 229
228 - return array('creativeLife'=>$result); 230 + return array('creativeLife' => $result);
229 } 231 }
230 232
231 /** 233 /**
@@ -244,7 +246,7 @@ class FloorProcess @@ -244,7 +246,7 @@ class FloorProcess
244 } 246 }
245 $result = $data; 247 $result = $data;
246 248
247 - return array('small_pic'=>$result); 249 + return array('small_pic' => $result);
248 } 250 }
249 251
250 /** 252 /**
@@ -253,15 +255,17 @@ class FloorProcess @@ -253,15 +255,17 @@ class FloorProcess
253 * @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle 255 * @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
254 * @return array 处理之后的单名字图片数据 256 * @return array 处理之后的单名字图片数据
255 */ 257 */
256 - private static function single_name_image($data,$type){  
257 -  
258 - if(empty($data)){ 258 + private static function single_name_image($data, $type)
  259 + {
  260 +
  261 + if (empty($data)) {
259 return array(); 262 return array();
260 } 263 }
261 264
262 $data['name'] = $data['title']; 265 $data['name'] = $data['title'];
263 $data['img'] = Helpers::getImageUrl($data['src'], 640, 198, 2); 266 $data['img'] = Helpers::getImageUrl($data['src'], 640, 198, 2);
264 -  
265 - return array('plusStar'=>$data); 267 +
  268 + return array('plusStar' => $data);
266 } 269 }
  270 +
267 } 271 }