Authored by 周少峰

merge brand and shop

... ... @@ -101,4 +101,66 @@ class ShopData
exit;
}
}
/**
* 收藏店铺
* @param int $uid
* @param int $shopId
* @param string $gender
* @author sefon 2016-4-28 22:09:30
* @return mixed
*/
public static function shopFav($uid, $shopId, $gender = '')
{
$param = Yohobuy::param();
$param['method'] = 'app.favorite.add';
$param['uid'] = $uid;
$param['id'] = $shopId;
$param['fav_id'] = $shopId;
$param['type'] = 'shop';
if (!empty($gender)) {
$param['gender'] = $gender;
}
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 取消收藏店铺
* @param int $uid
* @param int $shopId
* @param string $gender
* @author sefon 2016-4-28 22:09:30
* @return mixed
*/
public static function cancelShopFav($uid, $shopId, $gender = '')
{
$param = Yohobuy::param();
$param['method'] = 'app.favorite.cancel';
$param['uid'] = $uid;
$param['id'] = $shopId;
$param['fav_id'] = $shopId;
$param['type'] = 'shop';
if ($gender) {
$param['gender'] = $gender;
}
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 取消收藏店铺
* @param string $domain
* @author sefon 2016-4-28 23:35:28
* @return mixed
*/
public static function getShopInfoByBrandDomain($domain)
{
$param = Yohobuy::param();
$param['method'] = 'web.brand.byDomain';
$param['domain'] = $domain;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get('http://192.168.102.218:8080/gateway/', $param);
}
}
\ No newline at end of file
... ...
... ... @@ -118,7 +118,7 @@ class SearchData
// return 'http://101.200.31.165/yohosearch/brand/list.json';
// return 'http://182.92.99.119:8080/yohosearch/brand/list.json';
}
return 'http://192.168.102.216:8087/yohosearch/search.json';//支持shop_id
return 'http://101.200.31.165/yohosearch/search.json';//支持shop_id
//return 'http://101.200.31.165/yohosearch/search.json';
// return 'http://182.92.99.119:8080/yohosearch/search.json';
}
... ...
... ... @@ -11,6 +11,8 @@ use Plugin\Images;
class ShopProcess
{
private static $shopData = array();
private static $shopId = 0;
/**
* 组织店铺页面数据
* @param array $data 接口返回的店铺页所需数据
... ...
... ... @@ -437,4 +437,14 @@ class ListModel
// print_r($brandShop); exit;
}
/**
* 根据brand domain查询店铺信息
* @param string $domain
* @author sefon 2016-4-28 23:39:04
* @return array
*/
public static function getShopInfo($domain)
{
return ShopData::getShopInfoByBrandDomain($domain);
}
}
... ...
... ... @@ -131,17 +131,23 @@ class IndexController extends AbstractAction
if (empty($domain)) {
$this->go(SITE_MAIN);
}
// 当前的登录用户UID
$uid = $this->getUid();
// 存标题信息
$title = '';
//TODO 通过品牌域名获取店铺shopId 先固定shopId = 672
$brandLogo = Product\ListModel::getBrandLogoByDomain($domain, $title);
$brandLogo['shopId'] = 672;
if (isset($brandLogo['shopId']) && !empty($brandLogo['shopId'])) {
$this->shopAction($brandLogo['shopId'], $uid);
exit;
}
$brandId = 0;
if ($brandLogo && isset($brandLogo['id'])) {
$brandId = $brandLogo['id'];
}
// 当前的登录用户UID
$uid = $this->getUid();
/* 搜索框相关 */
$from = $this->get('from');
... ... @@ -446,19 +452,14 @@ class IndexController extends AbstractAction
/**
* 店铺首页
* @param int $shopId
* @param int $uid
* @author sefon 2016-4-26 20:50:58
*/
public function shopAction()
public function shopAction($shopId, $uid = 0)
{
$title = '';
$domain = 'vans';
//TODO
$brandLogo = ListModel::getBrandLogoByDomain($domain, $title);
$brandId = $brandLogo['id'];
$shop = ListModel::brandShop($brandId);
$shopId = 0;
$shopId = 672;
$uid = $this->getUid(true);
$title = '';
$data = ListModel::shopData($shopId, $uid);
$this->setTitle($title);
$this->setNavHeader($title, true, SITE_MAIN);
... ... @@ -479,21 +480,45 @@ class IndexController extends AbstractAction
}
/**
* 店铺上新
* 店铺收藏
* @author sefon 2016-4-28 23:00:11
*/
public function shopNewPro()
public function shopFav()
{
$data = array();
$shopId = $this->get('shopId', 0);
$uid = $this->getUid();
do {
if (!IS_AJAX) {
break;
}
if (!empty($shopId) && !empty($uid)) {
$data = ShopData::shopFav($uid, $shopId);
}
} while(false);
$this->echoJson($data);
}
/**
* 店铺人气
* 取消店铺收藏
* @author sefon 2016-4-28 23:01:43
*/
public function shopTops()
public function cancelShopFav()
{
$data = array();
$shopId = $this->get('shopId', 0);
$uid = $this->getUid();
do {
if (!IS_AJAX) {
break;
}
if (!empty($shopId) && !empty($uid)) {
$data = ShopData::cancelShopFav($uid, $shopId);
}
} while(false);
$this->echoJson($data);
}
/**
/**
* 店铺品牌首页
*
* @return mixed
... ...