Authored by hf

fixes bug to detail page show cuxiao info

@@ -95,9 +95,9 @@ class NewsaleData @@ -95,9 +95,9 @@ class NewsaleData
95 }); 95 });
96 96
97 $param = Yohobuy::param(); 97 $param = Yohobuy::param();
98 - if(!is_null($dayLimit)) { 98 + if (!is_null($dayLimit)) {
99 $param['method'] = 'app.search.newProduct'; 99 $param['method'] = 'app.search.newProduct';
100 - }else { 100 + } else {
101 $param['method'] = 'app.search.sales'; 101 $param['method'] = 'app.search.sales';
102 } 102 }
103 $param['page'] = $page; 103 $param['page'] = $page;
@@ -178,30 +178,29 @@ class NewsaleData @@ -178,30 +178,29 @@ class NewsaleData
178 return Yohobuy::get(Yohobuy::API_URL, $param); 178 return Yohobuy::get(Yohobuy::API_URL, $param);
179 } 179 }
180 180
  181 + /**
  182 + * 获取热销排行榜商品数据
  183 + *
  184 + * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
  185 + * @param string|null $sort 品类ID查询参数
  186 + * @param integer|null $tab_id Tab的ID
  187 + * @param integer $limit 查询返回的最大限制数, 默认为50
  188 + * @param integer $page 分页第几页, 默认第1页
  189 + * @return array 新品到着商品数据
  190 + */
  191 + public static function getTopProducts($gender, $sort = null, $tab_id = null, $limit = 50, $page = 1)
  192 + {
  193 + $param = Yohobuy::param();
  194 + $param['method'] = 'app.search.top';
  195 + $param['gender'] = $gender;
  196 + !empty($sort) && $param['sort'] = $sort;
  197 + !empty($tab_id) && $param['tab_id'] = $tab_id;
  198 + $param['page'] = $page;
  199 + $param['limit'] = $limit;
  200 +
  201 + $param['client_secret'] = Sign::getSign($param);
181 202
182 - /**  
183 - * 获取热销排行榜商品数据  
184 - *  
185 - * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部  
186 - * @param string|null $sort 品类ID查询参数  
187 - * @param integer|null $tab_id Tab的ID  
188 - * @param integer $limit 查询返回的最大限制数, 默认为50  
189 - * @param integer $page 分页第几页, 默认第1页  
190 - * @return array 新品到着商品数据  
191 - */  
192 - public static function getTopProducts($gender, $sort = null, $tab_id = null, $limit = 50, $page = 1)  
193 - {  
194 - $param = Yohobuy::param();  
195 - $param['method'] = 'app.search.top';  
196 - $param['gender'] = $gender;  
197 - !empty($sort) && $param['sort'] = $sort;  
198 - !empty($tab_id) && $param['tab_id'] = $tab_id;  
199 - $param['page'] = $page;  
200 - $param['limit'] = $limit;  
201 -  
202 - $param['client_secret'] = Sign::getSign($param);  
203 -  
204 - return Yohobuy::get(Yohobuy::API_URL, $param);  
205 - } 203 + return Yohobuy::get(Yohobuy::API_URL, $param);
  204 + }
206 205
207 } 206 }
@@ -96,8 +96,8 @@ class DetailModel @@ -96,8 +96,8 @@ class DetailModel
96 if (isset($baseInfo['promotionBoList'])) { 96 if (isset($baseInfo['promotionBoList'])) {
97 $build = array(); 97 $build = array();
98 foreach ($baseInfo['promotionBoList'] as $value) { 98 foreach ($baseInfo['promotionBoList'] as $value) {
99 - $build['title'] = $value['promotionTitle'];  
100 - $build['type'] = $value['promotionType']; 99 + $build['text'] = $value['promotionTitle'];
  100 + //$build['type'] = $value['promotionType'];
101 $result['goodsDiscount']['list'][] = $build; 101 $result['goodsDiscount']['list'][] = $build;
102 } 102 }
103 } 103 }
@@ -21,6 +21,7 @@ use Plugin\Cache; @@ -21,6 +21,7 @@ use Plugin\Cache;
21 class NewsaleModel 21 class NewsaleModel
22 { 22 {
23 /* 男生频道取新品到着及折扣专区数据的位置码 */ 23 /* 男生频道取新品到着及折扣专区数据的位置码 */
  24 +
24 const CODE_TOP_NEW_BOYS = '3cf2c1be5217fbab6009ce83959e1e12'; 25 const CODE_TOP_NEW_BOYS = '3cf2c1be5217fbab6009ce83959e1e12';
25 const CODE_TOP_SALE_BOYS = '153180b9a88c0b565848850c523bb637'; 26 const CODE_TOP_SALE_BOYS = '153180b9a88c0b565848850c523bb637';
26 /* 女生频道取新品到着及折扣专区数据的位置码 */ 27 /* 女生频道取新品到着及折扣专区数据的位置码 */
@@ -125,7 +126,6 @@ class NewsaleModel @@ -125,7 +126,6 @@ class NewsaleModel
125 return $result; 126 return $result;
126 } 127 }
127 128
128 -  
129 /** 129 /**
130 * 获取折扣专区的商品列表 130 * 获取折扣专区的商品列表
131 * 131 *
@@ -162,7 +162,6 @@ class NewsaleModel @@ -162,7 +162,6 @@ class NewsaleModel
162 return $result; 162 return $result;
163 } 163 }
164 164
165 -  
166 /** 165 /**
167 * 顶部焦点图缓存控制 166 * 顶部焦点图缓存控制
168 * @param const $cacheKey 缓存常量值 167 * @param const $cacheKey 缓存常量值
@@ -185,7 +184,7 @@ class NewsaleModel @@ -185,7 +184,7 @@ class NewsaleModel
185 184
186 // 调用接口获取数据并封装 185 // 调用接口获取数据并封装
187 if (isset($newsale['code']) && isset($newsale['data']['list'])) { 186 if (isset($newsale['code']) && isset($newsale['data']['list'])) {
188 - if(count($newsale['data']['list']) === 1) { 187 + if (count($newsale['data']['list']) === 1) {
189 $result = Helpers::formatBanner($newsale['data']['list'][0]['data'][0], 640, 240); 188 $result = Helpers::formatBanner($newsale['data']['list'][0]['data'][0], 640, 240);
190 } else { 189 } else {
191 foreach ($newsale['data']['list'] as $one) { 190 foreach ($newsale['data']['list'] as $one) {
@@ -217,41 +216,40 @@ class NewsaleModel @@ -217,41 +216,40 @@ class NewsaleModel
217 public static function selectData($data) 216 public static function selectData($data)
218 { 217 {
219 $result = array(); 218 $result = array();
220 - 219 +
221 if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) { 220 if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) {
222 foreach ($data['data']['product_list'] as $val) { 221 foreach ($data['data']['product_list'] as $val) {
223 - $result['goods'][] = Helpers::formatProduct($val, true, false, false, 299,388); 222 + $result['goods'][] = Helpers::formatProduct($val, true, false, false, 299, 388);
224 } 223 }
225 } 224 }
226 225
227 return $result; 226 return $result;
228 } 227 }
229 228
230 - /**  
231 - * 筛选出来的热销排行榜商品数据处理  
232 - *  
233 - * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部  
234 - * @param string|null $sort 品类ID查询参数  
235 - * @param integer|null $tab_id Tab的ID  
236 - * @param boolean $notab 时候返回顶部tab的数据,默认返回  
237 - * @param integer $limit 查询返回的最大限制数  
238 - * @param integer $page 分页第几页  
239 - * @return array 处理之后的数据  
240 - */ 229 + /**
  230 + * 筛选出来的热销排行榜商品数据处理
  231 + *
  232 + * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
  233 + * @param string|null $sort 品类ID查询参数
  234 + * @param integer|null $tab_id Tab的ID
  235 + * @param boolean $notab 时候返回顶部tab的数据,默认返回
  236 + * @param integer $limit 查询返回的最大限制数
  237 + * @param integer $page 分页第几页
  238 + * @return array 处理之后的数据
  239 + */
241 public static function selectTopData($gender, $sort, $tab_id, $notab, $limit, $page) 240 public static function selectTopData($gender, $sort, $tab_id, $notab, $limit, $page)
242 { 241 {
243 $result = array(); 242 $result = array();
244 243
245 - $data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page); 244 + $data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page);
246 245
247 if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) { 246 if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) {
248 - $result = NewSaleProcess::topData($data['data'], $notab, $limit, $page); 247 + $result = NewSaleProcess::topData($data['data'], $notab, $limit, $page);
249 } 248 }
250 249
251 return $result; 250 return $result;
252 } 251 }
253 252
254 -  
255 /** 253 /**
256 * 获取筛选数据 254 * 获取筛选数据
257 * @param array $data 接口返回的数据 255 * @param array $data 接口返回的数据
@@ -269,4 +267,5 @@ class NewsaleModel @@ -269,4 +267,5 @@ class NewsaleModel
269 267
270 return $result; 268 return $result;
271 } 269 }
  270 +
272 } 271 }
@@ -79,11 +79,11 @@ class NewsaleController extends AbstractAction @@ -79,11 +79,11 @@ class NewsaleController extends AbstractAction
79 $this->setTitle('热销排行榜'); 79 $this->setTitle('热销排行榜');
80 $this->setNavHeader('热销排行榜'); 80 $this->setNavHeader('热销排行榜');
81 81
82 - $channel = Helpers::getChannelByCookie(); 82 + $channel = Helpers::getChannelByCookie();
83 // 设置一些默认参数 83 // 设置一些默认参数
84 $data = array( 84 $data = array(
85 'hotrankPage' => true, 85 'hotrankPage' => true,
86 - 'headerBanner' => \Product\NewsaleModel::getNewFocus($channel), 86 + 'headerBanner' => \Product\NewsaleModel::getNewFocus($channel),
87 'showDownloadApp' => true, 87 'showDownloadApp' => true,
88 'pageFooter' => true, 88 'pageFooter' => true,
89 'cartUrl' => Helpers::url('/product/newsale/selectHotrank', null), 89 'cartUrl' => Helpers::url('/product/newsale/selectHotrank', null),
@@ -92,32 +92,32 @@ class NewsaleController extends AbstractAction @@ -92,32 +92,32 @@ class NewsaleController extends AbstractAction
92 $this->_view->display('hotrank', $data); 92 $this->_view->display('hotrank', $data);
93 } 93 }
94 94
95 - /**  
96 - * Ajax方式获取热销排行榜商品  
97 - *  
98 - * @return array 根据指定条件筛选之后的商品  
99 - */  
100 - public function selectHotrankAction()  
101 - {  
102 - $result = array();  
103 -  
104 - if ($this->isAjax()) {  
105 - $sort = $this->get('sort', null);  
106 - $tab_id = $this->get('tab_id', null);  
107 - $limit = $this->get('limit', 50);  
108 - $page = $this->get('page', 1);  
109 - $notab = (boolean)$this->get('notab', false);  
110 -  
111 - // 获取性别  
112 - $gender = Helpers::getGenderByCookie();  
113 - $result = \Product\NewsaleModel::selectTopData($gender, $sort, $tab_id, $notab, $limit, $page);  
114 - }  
115 - if (empty($result)) {  
116 - echo ' ';  
117 - } else {  
118 - $this->_view->display('hotlist', $result);  
119 - }  
120 - } 95 + /**
  96 + * Ajax方式获取热销排行榜商品
  97 + *
  98 + * @return array 根据指定条件筛选之后的商品
  99 + */
  100 + public function selectHotrankAction()
  101 + {
  102 + $result = array();
  103 +
  104 + if ($this->isAjax()) {
  105 + $sort = $this->get('sort', null);
  106 + $tab_id = $this->get('tab_id', null);
  107 + $limit = $this->get('limit', 50);
  108 + $page = $this->get('page', 1);
  109 + $notab = (boolean) $this->get('notab', false);
  110 +
  111 + // 获取性别
  112 + $gender = Helpers::getGenderByCookie();
  113 + $result = \Product\NewsaleModel::selectTopData($gender, $sort, $tab_id, $notab, $limit, $page);
  114 + }
  115 + if (empty($result)) {
  116 + echo ' ';
  117 + } else {
  118 + $this->_view->display('hotlist', $result);
  119 + }
  120 + }
121 121
122 /** 122 /**
123 * Ajax方式筛选新品到着、折扣专区商品 123 * Ajax方式筛选新品到着、折扣专区商品
@@ -127,7 +127,7 @@ class NewsaleController extends AbstractAction @@ -127,7 +127,7 @@ class NewsaleController extends AbstractAction
127 public function selectNewSaleAction() 127 public function selectNewSaleAction()
128 { 128 {
129 $result = array(); 129 $result = array();
130 - 130 +
131 if ($this->isAjax()) { 131 if ($this->isAjax()) {
132 $gender = $this->get('gender', null); 132 $gender = $this->get('gender', null);
133 $brand = $this->get('brand', null); 133 $brand = $this->get('brand', null);
@@ -149,7 +149,7 @@ class NewsaleController extends AbstractAction @@ -149,7 +149,7 @@ class NewsaleController extends AbstractAction
149 $channel = Helpers::getChannelByCookie(); 149 $channel = Helpers::getChannelByCookie();
150 150
151 $data = NewsaleData::selectNewSaleProducts( 151 $data = NewsaleData::selectNewSaleProducts(
152 - $gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order 152 + $gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order
153 ); 153 );
154 $result = \Product\NewsaleModel::selectData($data); 154 $result = \Product\NewsaleModel::selectData($data);
155 } 155 }