From 55cd6cb9a605860717ba5f73423e911d0fa151ed Mon Sep 17 00:00:00 2001
From: hf <fei.hong@yoho.cn>
Date: Fri, 4 Dec 2015 10:16:19 +0800
Subject: [PATCH] fixes bug to detail page show cuxiao info

---
 library/LibModels/Wap/Product/NewsaleData.php                             | 51 +++++++++++++++++++++++++--------------------------
 yohobuy/m.yohobuy.com/application/models/Product/Detail.php               |  4 ++--
 yohobuy/m.yohobuy.com/application/models/Product/Newsale.php              | 37 ++++++++++++++++++-------------------
 yohobuy/m.yohobuy.com/application/modules/Product/controllers/Newsale.php | 60 ++++++++++++++++++++++++++++++------------------------------
 4 files changed, 75 insertions(+), 77 deletions(-)

diff --git a/library/LibModels/Wap/Product/NewsaleData.php b/library/LibModels/Wap/Product/NewsaleData.php
index f51ce1a..8471f4c 100644
--- a/library/LibModels/Wap/Product/NewsaleData.php
+++ b/library/LibModels/Wap/Product/NewsaleData.php
@@ -95,9 +95,9 @@ class NewsaleData
         });
 
         $param = Yohobuy::param();
-        if(!is_null($dayLimit)) {
+        if (!is_null($dayLimit)) {
             $param['method'] = 'app.search.newProduct';
-        }else {
+        } else {
             $param['method'] = 'app.search.sales';
         }
         $param['page'] = $page;
@@ -178,30 +178,29 @@ class NewsaleData
         return Yohobuy::get(Yohobuy::API_URL, $param);
     }
 
+    /**
+     * 获取热销排行榜商品数据
+     *
+     * @param  string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
+     * @param  string|null $sort 品类ID查询参数
+     * @param  integer|null $tab_id Tab的ID
+     * @param  integer $limit 查询返回的最大限制数, 默认为50
+     * @param  integer $page 分页第几页, 默认第1页
+     * @return array                新品到着商品数据
+     */
+    public static function getTopProducts($gender, $sort = null, $tab_id = null, $limit = 50, $page = 1)
+    {
+        $param = Yohobuy::param();
+        $param['method'] = 'app.search.top';
+        $param['gender'] = $gender;
+        !empty($sort) && $param['sort'] = $sort;
+        !empty($tab_id) && $param['tab_id'] = $tab_id;
+        $param['page'] = $page;
+        $param['limit'] = $limit;
+
+        $param['client_secret'] = Sign::getSign($param);
 
-	/**
-	 * 获取热销排行榜商品数据
-	 *
-	 * @param  string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
-	 * @param  string|null $sort 品类ID查询参数
-	 * @param  integer|null $tab_id Tab的ID
-	 * @param  integer $limit 查询返回的最大限制数, 默认为50
-	 * @param  integer $page 分页第几页, 默认第1页
-	 * @return array                新品到着商品数据
-	 */
-	public static function getTopProducts($gender, $sort = null, $tab_id = null, $limit = 50, $page = 1)
-	{
-		$param = Yohobuy::param();
-		$param['method'] = 'app.search.top';
-		$param['gender'] = $gender;
-		!empty($sort) && $param['sort'] = $sort;
-		!empty($tab_id) && $param['tab_id'] = $tab_id;
-		$param['page'] = $page;
-		$param['limit'] = $limit;
-
-		$param['client_secret'] = Sign::getSign($param);
-
-		return Yohobuy::get(Yohobuy::API_URL, $param);
-	}
+        return Yohobuy::get(Yohobuy::API_URL, $param);
+    }
 
 }
diff --git a/yohobuy/m.yohobuy.com/application/models/Product/Detail.php b/yohobuy/m.yohobuy.com/application/models/Product/Detail.php
index 5c168ed..721522c 100644
--- a/yohobuy/m.yohobuy.com/application/models/Product/Detail.php
+++ b/yohobuy/m.yohobuy.com/application/models/Product/Detail.php
@@ -96,8 +96,8 @@ class DetailModel
             if (isset($baseInfo['promotionBoList'])) {
                 $build = array();
                 foreach ($baseInfo['promotionBoList'] as $value) {
-                    $build['title'] = $value['promotionTitle'];
-                    $build['type'] = $value['promotionType'];
+                    $build['text'] = $value['promotionTitle'];
+                    //$build['type'] = $value['promotionType'];
                     $result['goodsDiscount']['list'][] = $build;
                 }
             }
diff --git a/yohobuy/m.yohobuy.com/application/models/Product/Newsale.php b/yohobuy/m.yohobuy.com/application/models/Product/Newsale.php
index b7a2f23..b19a795 100644
--- a/yohobuy/m.yohobuy.com/application/models/Product/Newsale.php
+++ b/yohobuy/m.yohobuy.com/application/models/Product/Newsale.php
@@ -21,6 +21,7 @@ use Plugin\Cache;
 class NewsaleModel
 {
     /* 男生频道取新品到着及折扣专区数据的位置码 */
+
     const CODE_TOP_NEW_BOYS = '3cf2c1be5217fbab6009ce83959e1e12';
     const CODE_TOP_SALE_BOYS = '153180b9a88c0b565848850c523bb637';
     /* 女生频道取新品到着及折扣专区数据的位置码 */
@@ -125,7 +126,6 @@ class NewsaleModel
         return $result;
     }
 
-
     /**
      * 获取折扣专区的商品列表
      * 
@@ -162,7 +162,6 @@ class NewsaleModel
         return $result;
     }
 
-
     /**
      * 顶部焦点图缓存控制
      * @param  const $cacheKey  缓存常量值
@@ -185,7 +184,7 @@ class NewsaleModel
 
         // 调用接口获取数据并封装
         if (isset($newsale['code']) && isset($newsale['data']['list'])) {
-            if(count($newsale['data']['list']) === 1) {
+            if (count($newsale['data']['list']) === 1) {
                 $result = Helpers::formatBanner($newsale['data']['list'][0]['data'][0], 640, 240);
             } else {
                 foreach ($newsale['data']['list'] as $one) {
@@ -217,41 +216,40 @@ class NewsaleModel
     public static function selectData($data)
     {
         $result = array();
-        
+
         if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) {
             foreach ($data['data']['product_list'] as $val) {
-                $result['goods'][] = Helpers::formatProduct($val, true, false, false, 299,388);
+                $result['goods'][] = Helpers::formatProduct($val, true, false, false, 299, 388);
             }
         }
 
         return $result;
     }
 
-	/**
-	 * 筛选出来的热销排行榜商品数据处理
-	 *
-	 * @param  string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
-	 * @param  string|null $sort 品类ID查询参数
-	 * @param  integer|null $tab_id Tab的ID
-	 * @param  boolean $notab 时候返回顶部tab的数据,默认返回
-	 * @param  integer $limit 查询返回的最大限制数
-	 * @param  integer $page 分页第几页
-	 * @return array       处理之后的数据
-	 */
+    /**
+     * 筛选出来的热销排行榜商品数据处理
+     *
+     * @param  string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
+     * @param  string|null $sort 品类ID查询参数
+     * @param  integer|null $tab_id Tab的ID
+     * @param  boolean $notab 时候返回顶部tab的数据,默认返回
+     * @param  integer $limit 查询返回的最大限制数
+     * @param  integer $page 分页第几页
+     * @return array       处理之后的数据
+     */
     public static function selectTopData($gender, $sort, $tab_id, $notab, $limit, $page)
     {
         $result = array();
 
-	    $data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page);
+        $data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page);
 
         if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) {
-	        $result = NewSaleProcess::topData($data['data'], $notab, $limit, $page);
+            $result = NewSaleProcess::topData($data['data'], $notab, $limit, $page);
         }
 
         return $result;
     }
 
-
     /**
      * 获取筛选数据
      * @param  array $data 接口返回的数据
@@ -269,4 +267,5 @@ class NewsaleModel
 
         return $result;
     }
+
 }
diff --git a/yohobuy/m.yohobuy.com/application/modules/Product/controllers/Newsale.php b/yohobuy/m.yohobuy.com/application/modules/Product/controllers/Newsale.php
index 7b58729..c03421b 100644
--- a/yohobuy/m.yohobuy.com/application/modules/Product/controllers/Newsale.php
+++ b/yohobuy/m.yohobuy.com/application/modules/Product/controllers/Newsale.php
@@ -79,11 +79,11 @@ class NewsaleController extends AbstractAction
         $this->setTitle('热销排行榜');
         $this->setNavHeader('热销排行榜');
 
-	    $channel = Helpers::getChannelByCookie();
+        $channel = Helpers::getChannelByCookie();
         // 设置一些默认参数
         $data = array(
             'hotrankPage' => true,
-	        'headerBanner' => \Product\NewsaleModel::getNewFocus($channel),
+            'headerBanner' => \Product\NewsaleModel::getNewFocus($channel),
             'showDownloadApp' => true,
             'pageFooter' => true,
             'cartUrl' => Helpers::url('/product/newsale/selectHotrank', null),
@@ -92,32 +92,32 @@ class NewsaleController extends AbstractAction
         $this->_view->display('hotrank', $data);
     }
 
-	/**
-	 * Ajax方式获取热销排行榜商品
-	 *
-	 * @return array 根据指定条件筛选之后的商品
-	 */
-	public function selectHotrankAction()
-	{
-		$result = array();
-
-		if ($this->isAjax()) {
-			$sort = $this->get('sort', null);
-			$tab_id = $this->get('tab_id', null);
-			$limit = $this->get('limit', 50);
-			$page = $this->get('page', 1);
-			$notab = (boolean)$this->get('notab', false);
-
-			// 获取性别
-			$gender = Helpers::getGenderByCookie();
-			$result = \Product\NewsaleModel::selectTopData($gender, $sort, $tab_id, $notab, $limit, $page);
-		}
-		if (empty($result)) {
-			echo ' ';
-		} else {
-			$this->_view->display('hotlist', $result);
-		}
-	}
+    /**
+     * Ajax方式获取热销排行榜商品
+     *
+     * @return array 根据指定条件筛选之后的商品
+     */
+    public function selectHotrankAction()
+    {
+        $result = array();
+
+        if ($this->isAjax()) {
+            $sort = $this->get('sort', null);
+            $tab_id = $this->get('tab_id', null);
+            $limit = $this->get('limit', 50);
+            $page = $this->get('page', 1);
+            $notab = (boolean) $this->get('notab', false);
+
+            // 获取性别
+            $gender = Helpers::getGenderByCookie();
+            $result = \Product\NewsaleModel::selectTopData($gender, $sort, $tab_id, $notab, $limit, $page);
+        }
+        if (empty($result)) {
+            echo ' ';
+        } else {
+            $this->_view->display('hotlist', $result);
+        }
+    }
 
     /**
      * Ajax方式筛选新品到着、折扣专区商品
@@ -127,7 +127,7 @@ class NewsaleController extends AbstractAction
     public function selectNewSaleAction()
     {
         $result = array();
-        
+
         if ($this->isAjax()) {
             $gender = $this->get('gender', null);
             $brand = $this->get('brand', null);
@@ -149,7 +149,7 @@ class NewsaleController extends AbstractAction
             $channel = Helpers::getChannelByCookie();
 
             $data = NewsaleData::selectNewSaleProducts(
-                $gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order
+                            $gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order
             );
             $result = \Product\NewsaleModel::selectData($data);
         }
--
libgit2 0.24.0