Showing
5 changed files
with
40 additions
and
74 deletions
@@ -56,25 +56,10 @@ class NewsaleData | @@ -56,25 +56,10 @@ class NewsaleData | ||
56 | $param['limit'] = $limit; | 56 | $param['limit'] = $limit; |
57 | $param['yh_channel'] = $channel; | 57 | $param['yh_channel'] = $channel; |
58 | 58 | ||
59 | - $build = $param; | ||
60 | - $build['dayLimit'] = 1; | ||
61 | - $build['client_secret'] = Sign::getSign($build); | ||
62 | - $urlList['new'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $build); | ||
63 | - | ||
64 | - $build = $param; | ||
65 | - $build['dayLimit'] = 2; | ||
66 | - $build['client_secret'] = Sign::getSign($build); | ||
67 | - $urlList['week'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $build); | ||
68 | - | ||
69 | - $build = $param; | ||
70 | - $build['dayLimit'] = 3; | ||
71 | - $build['client_secret'] = Sign::getSign($build); | ||
72 | - $urlList['sale'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $build); | ||
73 | - | ||
74 | - $build = array(); | ||
75 | - $param = array(); | 59 | + $param['dayLimit'] = 1; |
60 | + $param['client_secret'] = Sign::getSign($param); | ||
76 | 61 | ||
77 | - return Yohobuy::getMulti($urlList); | 62 | + return Yohobuy::get(Yohobuy::API_URL, $param); |
78 | } | 63 | } |
79 | 64 | ||
80 | /** | 65 | /** |
@@ -147,13 +132,10 @@ class NewsaleData | @@ -147,13 +132,10 @@ class NewsaleData | ||
147 | $param['limit'] = $limit; | 132 | $param['limit'] = $limit; |
148 | $param['yh_channel'] = $channel; | 133 | $param['yh_channel'] = $channel; |
149 | 134 | ||
150 | - // 构建url地址列表 | ||
151 | - $urlList = array(); | ||
152 | $param['p_d'] = '0.1,0.9'; | 135 | $param['p_d'] = '0.1,0.9'; |
153 | $param['client_secret'] = Sign::getSign($param); | 136 | $param['client_secret'] = Sign::getSign($param); |
154 | - $urlList['ALL'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param); | ||
155 | 137 | ||
156 | - return Yohobuy::getMulti($urlList); | 138 | + return Yohobuy::get(Yohobuy::API_URL, $param); |
157 | } | 139 | } |
158 | 140 | ||
159 | /** | 141 | /** |
@@ -198,7 +198,7 @@ class ListProcess | @@ -198,7 +198,7 @@ class ListProcess | ||
198 | $result = array( | 198 | $result = array( |
199 | 'title' => '品类', | 199 | 'title' => '品类', |
200 | 'name' => '所有品类', | 200 | 'name' => '所有品类', |
201 | - 'dataType' => 'msort', | 201 | + 'dataType' => 'sort', |
202 | 'subs' => array( | 202 | 'subs' => array( |
203 | array( | 203 | array( |
204 | 'chosed' => true, | 204 | 'chosed' => true, |
@@ -20,50 +20,32 @@ class NewSaleProcess | @@ -20,50 +20,32 @@ class NewSaleProcess | ||
20 | public static function newSaleData($products) | 20 | public static function newSaleData($products) |
21 | { | 21 | { |
22 | $result = array(); | 22 | $result = array(); |
23 | - $noTab = true; | ||
24 | - $productsLi = array(); | ||
25 | - $tabItem = array(); | ||
26 | 23 | ||
27 | - foreach ($products as $single) { | ||
28 | - if (empty($single)) { | ||
29 | - continue; | ||
30 | - } | ||
31 | - | ||
32 | - // 处理Filter | ||
33 | - if(isset($single['filter'])) { | ||
34 | - $result['filter'] = ListProcess::getFilterData($single['filter']); | ||
35 | - } | ||
36 | - | ||
37 | - // 处理Tabs | ||
38 | - $noTab = true; | ||
39 | - if (isset($single['tabs']) && $noTab) { | ||
40 | - $result['tabs'] = array(); | ||
41 | - foreach ($single['tabs'] as $key => $one) { | ||
42 | - $tabItem = array(); | ||
43 | - $tabItem['title'] = $one; | ||
44 | - $tabItem['dataId'] = $key; | ||
45 | - if ($key === 1) { | ||
46 | - $tabItem['focus'] = true; | ||
47 | - } | ||
48 | - $result['tabs'][] = $tabItem; | 24 | + // 处理Tabs |
25 | + if (isset($products['tabs'])) { | ||
26 | + $result['tabs'] = array(); | ||
27 | + foreach ($products['tabs'] as $key => $one) { | ||
28 | + $tabItem = array(); | ||
29 | + $tabItem['title'] = $one; | ||
30 | + $tabItem['dataId'] = $key; | ||
31 | + if ($key === 1) { | ||
32 | + $tabItem['focus'] = true; | ||
49 | } | 33 | } |
50 | - $noTab = false; | 34 | + $result['tabs'][] = $tabItem; |
51 | } | 35 | } |
36 | + } | ||
52 | 37 | ||
53 | - // 处理商品 | ||
54 | - $productsLi = array(); | ||
55 | - if (isset($single['product_list'])) { | ||
56 | - foreach ($single['product_list'] as $value) { | ||
57 | - $productsLi['goods'][] = Helpers::formatProduct($value, true, false, false); | ||
58 | - } | ||
59 | - } | 38 | + // 处理Filter |
39 | + if(isset($products['filter'])) { | ||
40 | + $result['filter'] = ListProcess::getFilterData($products['filter']); | ||
41 | + } | ||
60 | 42 | ||
61 | - // 对于第一个productsLi添加show字段 | ||
62 | - if (!isset($result['goodsContainer'][0])) { | ||
63 | - $productsLi['show'] = true; | ||
64 | - } | 43 | + // 处理商品 |
44 | + if (isset($products['product_list'])) { | ||
45 | + foreach ($products['product_list'] as $single) { | ||
65 | 46 | ||
66 | - $result['goodsContainer'][] = $productsLi; | 47 | + $result['goods'][] = Helpers::formatProduct($single, true, false, false); |
48 | + } | ||
67 | } | 49 | } |
68 | 50 | ||
69 | return $result; | 51 | return $result; |
@@ -117,8 +117,8 @@ class NewsaleModel | @@ -117,8 +117,8 @@ class NewsaleModel | ||
117 | } | 117 | } |
118 | 118 | ||
119 | /* 格式化商品数据 */ | 119 | /* 格式化商品数据 */ |
120 | - if (!empty($products)) { | ||
121 | - $result = NewSaleProcess::newSaleData($products); | 120 | + if (isset($products['code']) && $products['code'] == 200) { |
121 | + $result = NewSaleProcess::newSaleData($products['data']); | ||
122 | } | 122 | } |
123 | 123 | ||
124 | return $result; | 124 | return $result; |
@@ -154,8 +154,8 @@ class NewsaleModel | @@ -154,8 +154,8 @@ class NewsaleModel | ||
154 | } | 154 | } |
155 | 155 | ||
156 | /* 格式化商品数据 */ | 156 | /* 格式化商品数据 */ |
157 | - if (!empty($products)) { | ||
158 | - $result = NewSaleProcess::newSaleData($products); | 157 | + if (isset($products['code']) && $products['code'] == 200) { |
158 | + $result = NewSaleProcess::newSaleData($products['data']); | ||
159 | } | 159 | } |
160 | 160 | ||
161 | return $result; | 161 | return $result; |
@@ -170,6 +170,8 @@ class NewsaleModel | @@ -170,6 +170,8 @@ class NewsaleModel | ||
170 | */ | 170 | */ |
171 | private static function cacheControl($cacheKey, $codeKey) | 171 | private static function cacheControl($cacheKey, $codeKey) |
172 | { | 172 | { |
173 | + $result = array(); | ||
174 | + | ||
173 | if (USE_CACHE) { | 175 | if (USE_CACHE) { |
174 | // 先尝试获取一级缓存(master), 有数据则直接返回. | 176 | // 先尝试获取一级缓存(master), 有数据则直接返回. |
175 | $result = Cache::get($cacheKey, 'master'); | 177 | $result = Cache::get($cacheKey, 'master'); |
@@ -32,11 +32,11 @@ class NewsaleController extends AbstractAction | @@ -32,11 +32,11 @@ class NewsaleController extends AbstractAction | ||
32 | } | 32 | } |
33 | // 设置一些筛选的默认参数 | 33 | // 设置一些筛选的默认参数 |
34 | $data += array( | 34 | $data += array( |
35 | - 'brand' => 0, | ||
36 | - 'msort' => 0, | 35 | + 'brand' => '0', |
36 | + 'sort' => '0', | ||
37 | 'gender' => Helpers::getGenderByCookie(), | 37 | 'gender' => Helpers::getGenderByCookie(), |
38 | - 'price' => 0, | ||
39 | - 'size' => 0, | 38 | + 'price' => '0', |
39 | + 'size' => '0', | ||
40 | 'dayLimit' => 1, | 40 | 'dayLimit' => 1, |
41 | 'discount' => '' | 41 | 'discount' => '' |
42 | ); | 42 | ); |
@@ -65,11 +65,11 @@ class NewsaleController extends AbstractAction | @@ -65,11 +65,11 @@ class NewsaleController extends AbstractAction | ||
65 | } | 65 | } |
66 | // 设置一些筛选的默认参数 | 66 | // 设置一些筛选的默认参数 |
67 | $data += array( | 67 | $data += array( |
68 | - 'brand' => 0, | ||
69 | - 'msort' => 0, | 68 | + 'brand' => '0', |
69 | + 'sort' => '0', | ||
70 | 'gender' => Helpers::getGenderByCookie(), | 70 | 'gender' => Helpers::getGenderByCookie(), |
71 | - 'price' => 0, | ||
72 | - 'size' => 0, | 71 | + 'price' => '0', |
72 | + 'size' => '0', | ||
73 | 'discount' => '0.1,0.9' | 73 | 'discount' => '0.1,0.9' |
74 | ); | 74 | ); |
75 | //var_dump($data);exit; | 75 | //var_dump($data);exit; |
@@ -86,7 +86,7 @@ class NewsaleController extends AbstractAction | @@ -86,7 +86,7 @@ class NewsaleController extends AbstractAction | ||
86 | if ($this->isAjax()) { | 86 | if ($this->isAjax()) { |
87 | $gender = $this->get('gender', 'boys'); | 87 | $gender = $this->get('gender', 'boys'); |
88 | $brand = $this->get('brand', null); | 88 | $brand = $this->get('brand', null); |
89 | - $sort = $this->get('msort', null); | 89 | + $sort = $this->get('sort', null); |
90 | $color = $this->get('color', null); | 90 | $color = $this->get('color', null); |
91 | $size = $this->get('size', null); | 91 | $size = $this->get('size', null); |
92 | $price = $this->get('price', null); | 92 | $price = $this->get('price', null); |
-
Please register or login to post a comment