add search shopinfo by brand id
Showing
5 changed files
with
48 additions
and
16 deletions
@@ -77,15 +77,17 @@ class ListData | @@ -77,15 +77,17 @@ class ListData | ||
77 | /** | 77 | /** |
78 | * 获取店铺信息 | 78 | * 获取店铺信息 |
79 | * @param int $shopId 店铺id | 79 | * @param int $shopId 店铺id |
80 | + * @param int $uid 用户id 判断用户是否收藏店铺 | ||
80 | * @param int $cache 接口缓存 | 81 | * @param int $cache 接口缓存 |
81 | * @author sefon 2016-4-26 21:32:57 | 82 | * @author sefon 2016-4-26 21:32:57 |
82 | * @return array | 83 | * @return array |
83 | */ | 84 | */ |
84 | - public static function getShopInfo($shopId, $cache = 600) | 85 | + public static function getShopInfo($shopId, $uid = 0, $cache = 600) |
85 | { | 86 | { |
86 | $param = Yohobuy::param(); | 87 | $param = Yohobuy::param(); |
87 | $param['method'] = 'app.shops.getIntro'; | 88 | $param['method'] = 'app.shops.getIntro'; |
88 | $param['shop_id'] = $shopId; | 89 | $param['shop_id'] = $shopId; |
90 | + $param['uid'] = $uid; | ||
89 | $param['client_secret'] = Sign::getSign($param); | 91 | $param['client_secret'] = Sign::getSign($param); |
90 | //TODO | 92 | //TODO |
91 | // return Yohobuy::get(Yohobuy::API_URL, $param); | 93 | // return Yohobuy::get(Yohobuy::API_URL, $param); |
@@ -128,5 +130,21 @@ class ListData | @@ -128,5 +130,21 @@ class ListData | ||
128 | return Yohobuy::get('http://192.168.102.218:8080/gateway/', $param, $cache); | 130 | return Yohobuy::get('http://192.168.102.218:8080/gateway/', $param, $cache); |
129 | } | 131 | } |
130 | 132 | ||
133 | + /** | ||
134 | + * 根据brandid获取相关店铺 | ||
135 | + * @param int $brandId | ||
136 | + * @author sefon 2016-4-28 13:41:09 | ||
137 | + * @return array | ||
138 | + */ | ||
139 | + public static function getShopByBrandId($brandId, $cache = 600) | ||
140 | + { | ||
141 | + $param = Yohobuy::param(); | ||
142 | + $param['method'] = 'app.shop.queryShopByBrandId'; | ||
143 | + $param['brand_id'] = $brandId; | ||
144 | + $param['client_secret'] = Sign::getSign($param); | ||
145 | + //TODO | ||
146 | +// return Yohobuy::get(Yohobuy::API_URL, $param); | ||
147 | + return Yohobuy::get('http://192.168.102.218:8080/gateway/', $param, $cache); | ||
148 | + } | ||
131 | 149 | ||
132 | } | 150 | } |
@@ -26,7 +26,6 @@ class ShopProcess | @@ -26,7 +26,6 @@ class ShopProcess | ||
26 | } | 26 | } |
27 | self::$key($val); | 27 | self::$key($val); |
28 | } | 28 | } |
29 | -// exit; | ||
30 | return self::$shopData; | 29 | return self::$shopData; |
31 | } | 30 | } |
32 | 31 | ||
@@ -59,6 +58,8 @@ class ShopProcess | @@ -59,6 +58,8 @@ class ShopProcess | ||
59 | { | 58 | { |
60 | self::$shopData['logoImg'] = Images::getImageUrl($data['data']['shop_logo'], 500, 500, 'shopLogo'); | 59 | self::$shopData['logoImg'] = Images::getImageUrl($data['data']['shop_logo'], 500, 500, 'shopLogo'); |
61 | self::$shopData['storeName'] = $data['data']['shop_name']; | 60 | self::$shopData['storeName'] = $data['data']['shop_name']; |
61 | + //用户是否收藏店铺 | ||
62 | + self::$shopData['favorite'] = $data['data']['is_favorite'] == 'Y' ? true : false; | ||
62 | } | 63 | } |
63 | 64 | ||
64 | /** | 65 | /** |
@@ -101,14 +102,17 @@ class ShopProcess | @@ -101,14 +102,17 @@ class ShopProcess | ||
101 | */ | 102 | */ |
102 | private static function brandBrowse($data) | 103 | private static function brandBrowse($data) |
103 | { | 104 | { |
104 | -// print_r($data); exit; | ||
105 | foreach ($data as $val) { | 105 | foreach ($data as $val) { |
106 | - self::$shopData['multiList'][] = array( | 106 | + self::$shopData['brandList']['list'] = array( |
107 | 'url' => Helpers::url('', '', $val['brandDomain']), | 107 | 'url' => Helpers::url('', '', $val['brandDomain']), |
108 | 'img' => Images::getImageUrl($val['brandIco'], 640, 400), | 108 | 'img' => Images::getImageUrl($val['brandIco'], 640, 400), |
109 | 'brandName' => $val['brandName'] | 109 | 'brandName' => $val['brandName'] |
110 | ); | 110 | ); |
111 | } | 111 | } |
112 | + if (count($data) > 5) { | ||
113 | + //TODO | ||
114 | + self::$shopData['brandList']['url'] = Helpers::url('brandList'); | ||
115 | + } | ||
112 | } | 116 | } |
113 | 117 | ||
114 | /** | 118 | /** |
@@ -149,10 +153,9 @@ class ShopProcess | @@ -149,10 +153,9 @@ class ShopProcess | ||
149 | */ | 153 | */ |
150 | private static function hotProducts($data) | 154 | private static function hotProducts($data) |
151 | { | 155 | { |
152 | -// print_r($data); | ||
153 | foreach ($data as $val) { | 156 | foreach ($data as $val) { |
154 | self::$shopData['hotList'][] = array( | 157 | self::$shopData['hotList'][] = array( |
155 | - 'url' => $val['url'], | 158 | + 'url' => Helpers::getUrlBySkc($val['product_id'], $val['goods_id'], $val['cn_alphabet']), |
156 | 'img' => Helpers::getImageUrl($val['src'], 235, 314), | 159 | 'img' => Helpers::getImageUrl($val['src'], 235, 314), |
157 | 'productName' => $val['productName'], | 160 | 'productName' => $val['productName'], |
158 | 'salesPrice' => '¥'.$val['salesPrice'], | 161 | 'salesPrice' => '¥'.$val['salesPrice'], |
@@ -36,12 +36,12 @@ | @@ -36,12 +36,12 @@ | ||
36 | 36 | ||
37 | <div id="home-page" class="main"> | 37 | <div id="home-page" class="main"> |
38 | <div id="nav-main" > | 38 | <div id="nav-main" > |
39 | - {{#unless brands}} | 39 | + {{#if brandList}} |
40 | <div class="multi-brands"> | 40 | <div class="multi-brands"> |
41 | <p>品牌一览</p> | 41 | <p>品牌一览</p> |
42 | <div class="multi-browse"> | 42 | <div class="multi-browse"> |
43 | <ul class="swiper-wrapper"> | 43 | <ul class="swiper-wrapper"> |
44 | - {{#each multiList}} | 44 | + {{#each list}} |
45 | <li class="swiper-slide brand-img"> | 45 | <li class="swiper-slide brand-img"> |
46 | <a href="{{url}}"> | 46 | <a href="{{url}}"> |
47 | <img src="{{img}}"> | 47 | <img src="{{img}}"> |
@@ -410,19 +410,27 @@ class ListModel | @@ -410,19 +410,27 @@ class ListModel | ||
410 | 410 | ||
411 | } | 411 | } |
412 | //店铺信息 | 412 | //店铺信息 |
413 | - $data['shopInfo'] = ListData::getShopInfo($shopId); | 413 | + $data['shopInfo'] = ListData::getShopInfo($shopId, $uid); |
414 | //店铺分类 | 414 | //店铺分类 |
415 | $data['shopCategory'] = ListData::getShopCategory($shopId); | 415 | $data['shopCategory'] = ListData::getShopCategory($shopId); |
416 | //店铺装修资源数据 | 416 | //店铺装修资源数据 |
417 | $data['decorator'] = ListData::getShopDecorator($shopId); | 417 | $data['decorator'] = ListData::getShopDecorator($shopId); |
418 | -// print_r($data); exit; | ||
419 | - //品牌一览 | ||
420 | - //$data['shopBrands'] = ListData::getShopBrands($shopId); | ||
421 | - //商品列表 | ||
422 | - $data['products'] = array(); | 418 | +// print_r($data); |
423 | //组织楼层数据 | 419 | //组织楼层数据 |
424 | $result = ShopProcess::formShopData($data); | 420 | $result = ShopProcess::formShopData($data); |
425 | return $result; | 421 | return $result; |
426 | } | 422 | } |
427 | 423 | ||
424 | + /** | ||
425 | + * 根据brandId 获取相关店铺列表 | ||
426 | + * @param int $brandId | ||
427 | + * @author sefon 2016-4-28 13:38:23 | ||
428 | + * @return array | ||
429 | + */ | ||
430 | + public static function brandShop($brandId) | ||
431 | + { | ||
432 | + $brandShop = ListData::getShopByBrandId($brandId); | ||
433 | + print_r($brandShop); exit; | ||
434 | + } | ||
435 | + | ||
428 | } | 436 | } |
@@ -453,10 +453,13 @@ class IndexController extends AbstractAction | @@ -453,10 +453,13 @@ class IndexController extends AbstractAction | ||
453 | { | 453 | { |
454 | $title = ''; | 454 | $title = ''; |
455 | $domain = 'vans'; | 455 | $domain = 'vans'; |
456 | + $domain = 'SIP'; | ||
456 | //TODO | 457 | //TODO |
457 | - $brandLogo = Product\ListModel::getBrandLogoByDomain($domain, $title); | 458 | + $brandLogo = ListModel::getBrandLogoByDomain($domain, $title); |
459 | + $brandId = $brandLogo['id']; | ||
460 | + $shop = ListModel::brandShop($brandId); | ||
458 | $shopId = 0; | 461 | $shopId = 0; |
459 | - $shopId = 672; | 462 | + $shopId = 682; |
460 | $uid = $this->getUid(true); | 463 | $uid = $this->getUid(true); |
461 | $data = ListModel::shopData($shopId, $uid); | 464 | $data = ListModel::shopData($shopId, $uid); |
462 | $this->setTitle($title); | 465 | $this->setTitle($title); |
-
Please register or login to post a comment