Authored by zhangxiaoru

品牌店铺首页

... ... @@ -17,23 +17,51 @@ class ShopData
/**
* 调取店铺简介数据
*
* @param $shopId
* @param int $shops_id
* @return mixed
* @internal param int|店铺ID $shopId 店铺ID
*/
public static function getShopIntro($shopId = 0)
public static function getShopIntro($shops_id = 0)
{
$param = Yohobuy::param();
$param['method'] = 'app.shops.getIntro';
$param['shops_id'] = $shopId;
$param['shops_id'] = $shops_id;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
public static function getShopCategory($shopId = 0)
/**
* 获取店铺下的所有品类
*
* @param $shops_id
* @param $yhChannel 频道
* @param $gender 性别
* @return mixed
* @internal param int $shopId 店铺ID
*/
public static function getShopCategory($shops_id, $yhChannel, $gender)
{
$param = Yohobuy::param();
$param['method'] = 'app.shop.getSortInfo';
$param['shops_id'] = $shopId;
$param['shops_id'] = $shops_id;
$param['yh_channel'] = $yhChannel;
$param['gender'] = $gender;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 获取店铺下的所有品牌
*
* @param int $shops_id
* @return mixed
* @internal param int $shopId 店铺ID
*/
public static function getShopBrands($shops_id = 0)
{
$param = Yohobuy::param();
$param['method'] = 'app.shops.getShopsBrands';
$param['shops_id'] = $shops_id;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
... ...
... ... @@ -9,6 +9,7 @@
use Action\AbstractAction;
use LibModels\Wap\Shop\ShopData;
use Plugin\Helpers;
class IndexController extends AbstractAction
{
... ... @@ -36,11 +37,66 @@ class IndexController extends AbstractAction
*/
public function categoryAction()
{
//$result = array();
$requestData = filter_input_array(INPUT_GET, array(
'shops_id' => FILTER_DEFAULT,
));
if (empty($requestData['shops_id'])) {
$this->go(SITE_MAIN);
}
$result = array();
$resource = array();
$resource['category'] = ShopData::getShopCategory($requestData['shops_id'], Helpers::getChannelByCookie(), Helpers::getGenderByCookie());
$resource['brands'] = ShopData::getShopBrands($requestData['shops_id']);
if ($resource['category']['code'] === 200) {
$result['category'] = $resource['category']['data'];
}
if ($resource['brands']['code'] === 200) {
$result['brands'] = $resource['brands']['data'];
}
$result = array();
// 假数据
// $result = $this->getCategoryContent();
$result = $this->getCategoryContent();
// ShopData::debugOut($result);
//$result2 = IntroData::getShopIntro(356);
$result = array(
return $this->_view->display('category', array(
'productCategoryPage' => true,
'content' => $result,
));
}
/**
* 店铺简介页面
*
* @return mixed
*/
public function introAction()
{
$requestData = filter_input_array(INPUT_GET, array(
'shops_id' => FILTER_DEFAULT,
));
if (empty($requestData['shops_id'])) {
$this->go(SITE_MAIN);
}
$result = array();
$resource = ShopData::getShopIntro($requestData['shops_id']);
if ($resource['code'] === 200) {
$result = $resource['data'];
}
return $this->_view->display('intro', array(
'content' => $result,
));
}
/**
* 店铺分类品类页数据模拟
*
* @return array
*/
public function getCategoryContent()
{
return array(// 数据模拟
'class' => array(
array(
'name' => '上衣',
... ... @@ -124,47 +180,6 @@ class IndexController extends AbstractAction
)
);
return $this->_view->display('category', array(
'productCategoryPage' => true,
'content' => $result,
));
}
/**
* 店铺简介页面
*
* @return mixed
*/
public function introAction()
{
$requestData = filter_input_array(INPUT_GET, array(
'shopId' => FILTER_DEFAULT,
));
if (empty($requestData['shopId'])) {
$this->go(SITE_MAIN);
}
$result = array();
$resource = ShopData::getShopIntro($requestData['shopId']);
if($resource['code'] === 200){
$result = $resource['data'];
}
return $this->_view->display('intro', array(
'content' => $result,
));
}
/**
* 店铺分类品类页数据模拟
*
* @return array
*/
public function getCategoryContent()
{
return array(
// 数据模拟
);
}
/**
... ... @@ -174,8 +189,7 @@ class IndexController extends AbstractAction
*/
public function getIntroContent()
{
return array(
// 数据模拟
return array(// 数据模拟
);
}
... ...