Authored by hf

fixes bug to version 0.0.3

@@ -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,25 +20,11 @@ class NewSaleProcess @@ -20,25 +20,11 @@ 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 -  
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 23
37 // 处理Tabs 24 // 处理Tabs
38 - $noTab = true;  
39 - if (isset($single['tabs']) && $noTab) { 25 + if (isset($products['tabs'])) {
40 $result['tabs'] = array(); 26 $result['tabs'] = array();
41 - foreach ($single['tabs'] as $key => $one) { 27 + foreach ($products['tabs'] as $key => $one) {
42 $tabItem = array(); 28 $tabItem = array();
43 $tabItem['title'] = $one; 29 $tabItem['title'] = $one;
44 $tabItem['dataId'] = $key; 30 $tabItem['dataId'] = $key;
@@ -47,23 +33,19 @@ class NewSaleProcess @@ -47,23 +33,19 @@ class NewSaleProcess
47 } 33 }
48 $result['tabs'][] = $tabItem; 34 $result['tabs'][] = $tabItem;
49 } 35 }
50 - $noTab = false;  
51 } 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 - } 38 + // 处理Filter
  39 + if(isset($products['filter'])) {
  40 + $result['filter'] = ListProcess::getFilterData($products['filter']);
59 } 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;
@@ -22,9 +22,10 @@ @@ -22,9 +22,10 @@
22 color: #444; 22 color: #444;
23 .more-btn{ 23 .more-btn{
24 position: absolute; 24 position: absolute;
25 - right: 30rem / $pxConvertRem; 25 + right: 0.75rem;
26 top: 0; 26 top: 0;
27 bottom: 0; 27 bottom: 0;
28 color: #b0b0b0; 28 color: #b0b0b0;
  29 + font-size: 1.25rem;
29 } 30 }
30 } 31 }
@@ -40,11 +40,12 @@ @@ -40,11 +40,12 @@
40 .goods-category .category-list { 40 .goods-category .category-list {
41 background: #f5f7f6; 41 background: #f5f7f6;
42 height: 383rem / $pxConvertRem; 42 height: 383rem / $pxConvertRem;
  43 + border-bottom: 1px solid #e0e0e0;
  44 + overflow: hidden;
43 li { 45 li {
44 float: left; 46 float: left;
45 width: 191rem / $pxConvertRem; 47 width: 191rem / $pxConvertRem;
46 - height: 181rem / $pxConvertRem;  
47 - 48 + height: 191rem / $pxConvertRem;
48 border-left: 1px solid #e0e0e0; 49 border-left: 1px solid #e0e0e0;
49 50
50 .first-show { 51 .first-show {
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 } 41 }
42 .load-more-info { 42 .load-more-info {
43 width: 100%; 43 width: 100%;
44 - height: 570rem / $pxConvertRem; 44 + height: 70rem / $pxConvertRem;
45 line-height: 70rem / $pxConvertRem; 45 line-height: 70rem / $pxConvertRem;
46 text-align: center; 46 text-align: center;
47 font-size: 14px; 47 font-size: 14px;
@@ -28,18 +28,13 @@ @@ -28,18 +28,13 @@
28 </ul> 28 </ul>
29 29
30 <div id="goods-container" class="goods-container"> 30 <div id="goods-container" class="goods-container">
31 - {{# goodsContainer}}  
32 - <div class="new-goods container clearfix">  
33 - {{#if goods}} 31 + <div class="container clearfix">
34 {{# goods}} 32 {{# goods}}
35 {{> good}} 33 {{> good}}
36 {{/ goods}} 34 {{/ goods}}
37 - {{^}}  
38 - <p class="no-result">未找到相关搜索结果</p>  
39 - {{/if}}  
40 </div> 35 </div>
41 - {{/ goodsContainer}}  
42 - 36 + <div class="container hide clearfix"></div>
  37 + <div class="container hide clearfix"></div>
43 {{> filter}} 38 {{> filter}}
44 </div> 39 </div>
45 40
@@ -38,19 +38,13 @@ @@ -38,19 +38,13 @@
38 </ul> 38 </ul>
39 39
40 <div id="goods-container" class="goods-container"> 40 <div id="goods-container" class="goods-container">
41 - {{# goodsContainer}}  
42 <div class="new-goods container clearfix"> 41 <div class="new-goods container clearfix">
43 - {{#if goods}}  
44 {{# goods}} 42 {{# goods}}
45 {{> good}} 43 {{> good}}
46 {{/ goods}} 44 {{/ goods}}
47 - {{^}}  
48 - <p class="no-result">未找到相关搜索结果</p>  
49 - {{/if}}  
50 </div> 45 </div>
51 <div class="price-goods container hide clearfix"></div> 46 <div class="price-goods container hide clearfix"></div>
52 <div class="discount-goods container hide clearfix"></div> 47 <div class="discount-goods container hide clearfix"></div>
53 - {{/ goodsContainer}}  
54 48
55 {{> filter}} 49 {{> filter}}
56 </div> 50 </div>
1 {{# title}} 1 {{# title}}
2 <div class="floor-header-more"> 2 <div class="floor-header-more">
3 <h2>{{title}}</h2> 3 <h2>{{title}}</h2>
4 - <a class="more-btn iconfont" href="{{more_url}}">{{more_name}}</a> 4 + <a class="more-btn iconfont" href="{{more_url}}">&#xe618;</a>
5 </div> 5 </div>
6 {{/ title}} 6 {{/ title}}
@@ -118,8 +118,8 @@ class NewsaleModel @@ -118,8 +118,8 @@ class NewsaleModel
118 } 118 }
119 119
120 /* 格式化商品数据 */ 120 /* 格式化商品数据 */
121 - if (!empty($products)) {  
122 - $result = NewSaleProcess::newSaleData($products); 121 + if (isset($products['code']) && $products['code'] == 200) {
  122 + $result = NewSaleProcess::newSaleData($products['data']);
123 } 123 }
124 124
125 return $result; 125 return $result;
@@ -155,8 +155,8 @@ class NewsaleModel @@ -155,8 +155,8 @@ class NewsaleModel
155 } 155 }
156 156
157 /* 格式化商品数据 */ 157 /* 格式化商品数据 */
158 - if (!empty($products)) {  
159 - $result = NewSaleProcess::newSaleData($products); 158 + if (isset($products['code']) && $products['code'] == 200) {
  159 + $result = NewSaleProcess::newSaleData($products['data']);
160 } 160 }
161 161
162 return $result; 162 return $result;
@@ -171,6 +171,8 @@ class NewsaleModel @@ -171,6 +171,8 @@ class NewsaleModel
171 */ 171 */
172 private static function cacheControl($cacheKey, $codeKey) 172 private static function cacheControl($cacheKey, $codeKey)
173 { 173 {
  174 + $result = array();
  175 +
174 if (USE_CACHE) { 176 if (USE_CACHE) {
175 // 先尝试获取一级缓存(master), 有数据则直接返回. 177 // 先尝试获取一级缓存(master), 有数据则直接返回.
176 $result = Cache::get($cacheKey, 'master'); 178 $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 - 'sort' => 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 - 'sort' => 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 75