Authored by 周少峰

add search shopinfo by brand id

... ... @@ -77,15 +77,17 @@ class ListData
/**
* 获取店铺信息
* @param int $shopId 店铺id
* @param int $uid 用户id 判断用户是否收藏店铺
* @param int $cache 接口缓存
* @author sefon 2016-4-26 21:32:57
* @return array
*/
public static function getShopInfo($shopId, $cache = 600)
public static function getShopInfo($shopId, $uid = 0, $cache = 600)
{
$param = Yohobuy::param();
$param['method'] = 'app.shops.getIntro';
$param['shop_id'] = $shopId;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
//TODO
// return Yohobuy::get(Yohobuy::API_URL, $param);
... ... @@ -128,5 +130,21 @@ class ListData
return Yohobuy::get('http://192.168.102.218:8080/gateway/', $param, $cache);
}
/**
* 根据brandid获取相关店铺
* @param int $brandId
* @author sefon 2016-4-28 13:41:09
* @return array
*/
public static function getShopByBrandId($brandId, $cache = 600)
{
$param = Yohobuy::param();
$param['method'] = 'app.shop.queryShopByBrandId';
$param['brand_id'] = $brandId;
$param['client_secret'] = Sign::getSign($param);
//TODO
// return Yohobuy::get(Yohobuy::API_URL, $param);
return Yohobuy::get('http://192.168.102.218:8080/gateway/', $param, $cache);
}
}
... ...
... ... @@ -26,7 +26,6 @@ class ShopProcess
}
self::$key($val);
}
// exit;
return self::$shopData;
}
... ... @@ -59,6 +58,8 @@ class ShopProcess
{
self::$shopData['logoImg'] = Images::getImageUrl($data['data']['shop_logo'], 500, 500, 'shopLogo');
self::$shopData['storeName'] = $data['data']['shop_name'];
//用户是否收藏店铺
self::$shopData['favorite'] = $data['data']['is_favorite'] == 'Y' ? true : false;
}
/**
... ... @@ -101,14 +102,17 @@ class ShopProcess
*/
private static function brandBrowse($data)
{
// print_r($data); exit;
foreach ($data as $val) {
self::$shopData['multiList'][] = array(
self::$shopData['brandList']['list'] = array(
'url' => Helpers::url('', '', $val['brandDomain']),
'img' => Images::getImageUrl($val['brandIco'], 640, 400),
'brandName' => $val['brandName']
);
}
if (count($data) > 5) {
//TODO
self::$shopData['brandList']['url'] = Helpers::url('brandList');
}
}
/**
... ... @@ -149,10 +153,9 @@ class ShopProcess
*/
private static function hotProducts($data)
{
// print_r($data);
foreach ($data as $val) {
self::$shopData['hotList'][] = array(
'url' => $val['url'],
'url' => Helpers::getUrlBySkc($val['product_id'], $val['goods_id'], $val['cn_alphabet']),
'img' => Helpers::getImageUrl($val['src'], 235, 314),
'productName' => $val['productName'],
'salesPrice' => '¥'.$val['salesPrice'],
... ...
... ... @@ -36,12 +36,12 @@
<div id="home-page" class="main">
<div id="nav-main" >
{{#unless brands}}
{{#if brandList}}
<div class="multi-brands">
<p>品牌一览</p>
<div class="multi-browse">
<ul class="swiper-wrapper">
{{#each multiList}}
{{#each list}}
<li class="swiper-slide brand-img">
<a href="{{url}}">
<img src="{{img}}">
... ...
... ... @@ -410,19 +410,27 @@ class ListModel
}
//店铺信息
$data['shopInfo'] = ListData::getShopInfo($shopId);
$data['shopInfo'] = ListData::getShopInfo($shopId, $uid);
//店铺分类
$data['shopCategory'] = ListData::getShopCategory($shopId);
//店铺装修资源数据
$data['decorator'] = ListData::getShopDecorator($shopId);
// print_r($data); exit;
//品牌一览
//$data['shopBrands'] = ListData::getShopBrands($shopId);
//商品列表
$data['products'] = array();
// print_r($data);
//组织楼层数据
$result = ShopProcess::formShopData($data);
return $result;
}
/**
* 根据brandId 获取相关店铺列表
* @param int $brandId
* @author sefon 2016-4-28 13:38:23
* @return array
*/
public static function brandShop($brandId)
{
$brandShop = ListData::getShopByBrandId($brandId);
print_r($brandShop); exit;
}
}
... ...
... ... @@ -453,10 +453,13 @@ class IndexController extends AbstractAction
{
$title = '';
$domain = 'vans';
$domain = 'SIP';
//TODO
$brandLogo = Product\ListModel::getBrandLogoByDomain($domain, $title);
$brandLogo = ListModel::getBrandLogoByDomain($domain, $title);
$brandId = $brandLogo['id'];
$shop = ListModel::brandShop($brandId);
$shopId = 0;
$shopId = 672;
$shopId = 682;
$uid = $this->getUid(true);
$data = ListModel::shopData($shopId, $uid);
$this->setTitle($title);
... ...