Authored by zhangxiaoru

品牌店铺首页

@@ -17,23 +17,51 @@ class ShopData @@ -17,23 +17,51 @@ class ShopData
17 /** 17 /**
18 * 调取店铺简介数据 18 * 调取店铺简介数据
19 * 19 *
20 - * @param $shopId 20 + * @param int $shops_id
21 * @return mixed 21 * @return mixed
  22 + * @internal param int|店铺ID $shopId 店铺ID
22 */ 23 */
23 - public static function getShopIntro($shopId = 0) 24 + public static function getShopIntro($shops_id = 0)
24 { 25 {
25 $param = Yohobuy::param(); 26 $param = Yohobuy::param();
26 $param['method'] = 'app.shops.getIntro'; 27 $param['method'] = 'app.shops.getIntro';
27 - $param['shops_id'] = $shopId; 28 + $param['shops_id'] = $shops_id;
28 $param['client_secret'] = Sign::getSign($param); 29 $param['client_secret'] = Sign::getSign($param);
29 return Yohobuy::get(Yohobuy::API_URL, $param); 30 return Yohobuy::get(Yohobuy::API_URL, $param);
30 } 31 }
31 32
32 - public static function getShopCategory($shopId = 0) 33 + /**
  34 + * 获取店铺下的所有品类
  35 + *
  36 + * @param $shops_id
  37 + * @param $yhChannel 频道
  38 + * @param $gender 性别
  39 + * @return mixed
  40 + * @internal param int $shopId 店铺ID
  41 + */
  42 + public static function getShopCategory($shops_id, $yhChannel, $gender)
33 { 43 {
34 $param = Yohobuy::param(); 44 $param = Yohobuy::param();
35 $param['method'] = 'app.shop.getSortInfo'; 45 $param['method'] = 'app.shop.getSortInfo';
36 - $param['shops_id'] = $shopId; 46 + $param['shops_id'] = $shops_id;
  47 + $param['yh_channel'] = $yhChannel;
  48 + $param['gender'] = $gender;
  49 + $param['client_secret'] = Sign::getSign($param);
  50 + return Yohobuy::get(Yohobuy::API_URL, $param);
  51 + }
  52 +
  53 + /**
  54 + * 获取店铺下的所有品牌
  55 + *
  56 + * @param int $shops_id
  57 + * @return mixed
  58 + * @internal param int $shopId 店铺ID
  59 + */
  60 + public static function getShopBrands($shops_id = 0)
  61 + {
  62 + $param = Yohobuy::param();
  63 + $param['method'] = 'app.shops.getShopsBrands';
  64 + $param['shops_id'] = $shops_id;
37 $param['client_secret'] = Sign::getSign($param); 65 $param['client_secret'] = Sign::getSign($param);
38 return Yohobuy::get(Yohobuy::API_URL, $param); 66 return Yohobuy::get(Yohobuy::API_URL, $param);
39 } 67 }
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 9
10 use Action\AbstractAction; 10 use Action\AbstractAction;
11 use LibModels\Wap\Shop\ShopData; 11 use LibModels\Wap\Shop\ShopData;
  12 +use Plugin\Helpers;
12 13
13 class IndexController extends AbstractAction 14 class IndexController extends AbstractAction
14 { 15 {
@@ -36,11 +37,66 @@ class IndexController extends AbstractAction @@ -36,11 +37,66 @@ class IndexController extends AbstractAction
36 */ 37 */
37 public function categoryAction() 38 public function categoryAction()
38 { 39 {
39 - //$result = array(); 40 + $requestData = filter_input_array(INPUT_GET, array(
  41 + 'shops_id' => FILTER_DEFAULT,
  42 + ));
  43 + if (empty($requestData['shops_id'])) {
  44 + $this->go(SITE_MAIN);
  45 + }
  46 + $result = array();
  47 + $resource = array();
  48 + $resource['category'] = ShopData::getShopCategory($requestData['shops_id'], Helpers::getChannelByCookie(), Helpers::getGenderByCookie());
  49 + $resource['brands'] = ShopData::getShopBrands($requestData['shops_id']);
  50 + if ($resource['category']['code'] === 200) {
  51 + $result['category'] = $resource['category']['data'];
  52 + }
  53 + if ($resource['brands']['code'] === 200) {
  54 + $result['brands'] = $resource['brands']['data'];
  55 + }
  56 + $result = array();
40 // 假数据 57 // 假数据
41 - // $result = $this->getCategoryContent(); 58 + $result = $this->getCategoryContent();
  59 +// ShopData::debugOut($result);
42 //$result2 = IntroData::getShopIntro(356); 60 //$result2 = IntroData::getShopIntro(356);
43 - $result = array( 61 + return $this->_view->display('category', array(
  62 + 'productCategoryPage' => true,
  63 + 'content' => $result,
  64 + ));
  65 + }
  66 +
  67 + /**
  68 + * 店铺简介页面
  69 + *
  70 + * @return mixed
  71 + */
  72 + public function introAction()
  73 + {
  74 + $requestData = filter_input_array(INPUT_GET, array(
  75 + 'shops_id' => FILTER_DEFAULT,
  76 + ));
  77 + if (empty($requestData['shops_id'])) {
  78 + $this->go(SITE_MAIN);
  79 + }
  80 + $result = array();
  81 + $resource = ShopData::getShopIntro($requestData['shops_id']);
  82 + if ($resource['code'] === 200) {
  83 + $result = $resource['data'];
  84 + }
  85 + return $this->_view->display('intro', array(
  86 + 'content' => $result,
  87 + ));
  88 +
  89 + }
  90 +
  91 +
  92 + /**
  93 + * 店铺分类品类页数据模拟
  94 + *
  95 + * @return array
  96 + */
  97 + public function getCategoryContent()
  98 + {
  99 + return array(// 数据模拟
44 'class' => array( 100 'class' => array(
45 array( 101 array(
46 'name' => '上衣', 102 'name' => '上衣',
@@ -124,47 +180,6 @@ class IndexController extends AbstractAction @@ -124,47 +180,6 @@ class IndexController extends AbstractAction
124 180
125 ) 181 )
126 ); 182 );
127 - return $this->_view->display('category', array(  
128 - 'productCategoryPage' => true,  
129 - 'content' => $result,  
130 - ));  
131 - }  
132 -  
133 - /**  
134 - * 店铺简介页面  
135 - *  
136 - * @return mixed  
137 - */  
138 - public function introAction()  
139 - {  
140 - $requestData = filter_input_array(INPUT_GET, array(  
141 - 'shopId' => FILTER_DEFAULT,  
142 - ));  
143 - if (empty($requestData['shopId'])) {  
144 - $this->go(SITE_MAIN);  
145 - }  
146 - $result = array();  
147 - $resource = ShopData::getShopIntro($requestData['shopId']);  
148 - if($resource['code'] === 200){  
149 - $result = $resource['data'];  
150 - }  
151 - return $this->_view->display('intro', array(  
152 - 'content' => $result,  
153 - ));  
154 -  
155 - }  
156 -  
157 -  
158 - /**  
159 - * 店铺分类品类页数据模拟  
160 - *  
161 - * @return array  
162 - */  
163 - public function getCategoryContent()  
164 - {  
165 - return array(  
166 - // 数据模拟  
167 - );  
168 } 183 }
169 184
170 /** 185 /**
@@ -174,8 +189,7 @@ class IndexController extends AbstractAction @@ -174,8 +189,7 @@ class IndexController extends AbstractAction
174 */ 189 */
175 public function getIntroContent() 190 public function getIntroContent()
176 { 191 {
177 - return array(  
178 - // 数据模拟 192 + return array(// 数据模拟
179 ); 193 );
180 } 194 }
181 195