Authored by xiaowei

品牌一览

... ... @@ -67,7 +67,7 @@ class BrandData
*/
public static function getBrandLogo($brandId)
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByids', array($brandId ));
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByids', array($brandId));
}
/**
... ... @@ -78,7 +78,7 @@ class BrandData
*/
public static function getBrandLogoByDomain($domain)
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByDomain', array($domain ));
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByDomain', array($domain));
}
/**
... ... @@ -88,9 +88,9 @@ class BrandData
* @param int $status 状态
* @return array
*/
public static function getFolderByBrand($brand_id,$status = 1)
public static function getFolderByBrand($brand_id, $status = 1)
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_FOLDER, 'getFolderByBrand', array($brand_id,$status ));
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_FOLDER, 'getFolderByBrand', array($brand_id, $status));
}
/**
... ... @@ -99,8 +99,38 @@ class BrandData
* @param string $mode
* @return mixed
*/
public static function getByNodeContent($node, $mode='release')
public static function getByNodeContent($node, $mode = 'release')
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_NODECONTENT, 'getByNodeContent', array($node, $mode));
}
/*
* 品牌一览资源位banner
* @param string $contentCode 获取广告资源需要的位置码
* @param int $channel 频道标识 1:男,2:女,3:潮童,4:创意生活
* @return array(
* "brandTop": "顶部的轮翻广告及热门品牌数据",
* "brandList": "按字母'A-Z'分组的品牌列表数据"
* )
*/
public static function getTopBanner($contentCode,$channel)
{
/* 顶部的轮翻广告及热门品牌数据 */
$param = Yohobuy::param();
$param['content_code'] = $contentCode;
$param['client_secret'] = Sign::getSign($param);
$urlList['brandTop'] = Yohobuy::httpBuildQuery(Yohobuy::SERVICE_URL . self::URI_BRAND_TOPPOS, $param);
/* 按字母"A-Z"分组的品牌列表数据 */
$param = Yohobuy::param();
$param['method'] = 'app.brand.brandlist';
$param['yh_channel'] = $channel;
$param['client_secret'] = Sign::getSign($param);
$urlList['brandList'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
return Yohobuy::getMulti($urlList, array(), 3600); // 有缓存1小时
}
}
... ...
<?php
use Action\AbstractAction;
use Action\WebAction;
use Product\BrandsModel;
/**
* 品牌首页
*/
class BrandsController extends AbstractAction
class BrandsController extends WebAction
{
public function brandsAction()
{
$headerdata = array(
'gobytype' => 'gobuyboys',
'searchcate' => 'searchcateboys',
'navbars' => array(
array(
'name_cn' => '男生',
'name_en' => 'BOYS',
'link' => '',
'classname' => 'boys',
'index_main' => 0,
'subnav' => array(
array(
'name' => '男首1',
'link' => '',
'index_sub' => 0,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '男首2',
'link' => '',
'index_sub' => 1,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '男首3',
'link' => '',
'index_sub' => 2,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
)
)
),
array(
'name_cn' => '女生',
'name_en' => 'GIRLS',
'link' => 'http=>//www.baidu.com',
'classname' => '',
'index_main' => 0,
'subnav' => array(
array(
'name' => '女生1',
'link' => '',
'index_sub' => 0,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '女生2',
'link' => '',
'index_sub' => 1,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '女生3',
'link' => '',
'index_sub' => 2,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
)
)
)
),
'myyoho' => array(
'email' => 'hhh@126.com',
'viptype' => '普通会员',
'currentscore' => 495,
'totalscore' => 600,
'cardtype' => '银卡',
'infolist' => array(
array(
'name' => '待处理的订单',
'link' => '',
'num' => '0'
),
array(
'name' => '我的收藏',
'link' => '',
'num' => '1'
),
array(
'name' => '我的优惠券',
'link' => '',
'num' => '2'
),
array(
'name' => '我的YOHO币',
'link' => '',
'num' => '1'
),
array(
'name' => '我的退货换货',
'link' => '',
'num' => '1'
)
),
'updlink' => ''
),
'gobuy' => array(
'gobuynum' => 3
),
'breadcrumbnav' => array(
array(
'notend' => array(
'link' => 'http=>//www.baidu.com',
'name' => 'BOYS首页'
)
),
array(
'notend' => array(
'link' => 'http=>//www.baidu.com',
'name' => '上衣'
)
),
array(
'isend' => array(
'link' => 'http=>//www.baidu.com',
'name' => '衬衫'
)
)
)
);
$imgsrc = 'http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg';
$item = array(
'name' => 'cc',
'key' => '1000011'
);
$item0 = array(
'name' => 'cc',
'hot' => 'hot',
'key' => '1000012'
);
//品牌一览头部
$channel = $this->getCookie("_Channel") ? $this->getCookie("_Channel") : 'boys';
$this->setWebNavHeader($channel);
$item1 = array(
'name' => '所有品牌',
'src' => $imgsrc,
'url' => ''
);
$item2 = array(
'name' => '所有品牌',
'src' => $imgsrc,
'url' => '',
'items' => array(
$item1,
$item1,
$item1,
$item1,
$item1,
$item1,
$item1,
$item1,
$item1,
$item1
)
);
//banner-list
$res = BrandsModel::getBrandView($channel);
//数据整合
$data = array(
'brandsHomePage' => true,
'headerdata' => $headerdata,
'brands' => array(
'category' => array(
'A' => array(
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item
),
'B' => array(
$item,
$item,
$item0,
$item,
$item,
$item,
$item,
$item,
$item
),
'C' => array(
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item
),
'D' => array(
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item0,
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item
),
'E' => array(
$item,
$item,
$item0,
$item,
$item,
$item,
$item,
$item,
$item
),
'F' => array(
$item0,
$item,
$item,
$item0,
$item0,
$item,
$item0,
$item,
$item
),
'G' => array(
$item,
$item,
$item,
$item,
$item,
$item0,
$item,
$item,
$item
),
'H' => array(
$item,
$item,
$item,
$item,
$item,
$item,
$item0,
$item,
$item
),
'I' => array(
$item,
$item,
$item0,
$item0,
$item0,
$item0,
$item,
$item,
$item
),
'J' => array(
$item,
$item,
$item,
$item,
$item0,
$item,
$item,
$item,
$item
),
'K' => array(
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item,
$item
),
'L' => array(
$item,
$item0,
$item,
$item,
$item,
$item,
$item,
$item,
$item
),
'M' => array(
$item,
$item0,
$item,
$item,
$item,
$item,
$item,
$item,
$item
),
'N' => array(
$item,
$item0,
$item0,
$item0,
$item,
$item,
$item,
$item,
$item
)
),
'tabs' => array(
$item2,
$item2,
$item2,
$item2,
$item2
)
'category' => $res['brandList'],
'tabs' => $res['brandTop']
)
);
$this->_view->display('brands', $data);
}
... ... @@ -449,35 +42,22 @@ class BrandsController extends AbstractAction
do {
/* 判断是不是AJAX请求 */
if (! $this->isAjax()) {
if (!$this->isAjax()) {
break;
}
$brandId = $this->get('brandId',0);
$uid=$this->getUid(false);
$brandId=144;
BrandsModel::getBrandInfo($brandId, $uid);
$imgsrc = 'http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg';
$data = array(
'key' => '1000011',
'icon' => $imgsrc,
'title' => '优显led触控台灯',
'content' => '优显led触控台灯优显led触控台灯优显led触控台灯优显led触控台灯',
'subtitle' => 'AAAAAA',
'imgs' => array(
array(
'src' => $imgsrc
),
array(
'src' => $imgsrc
),
array(
'src' => $imgsrc
)
)
) // 提示
;
$result = array(
'code' => 200,
'brand' => $data
);
} while (false);
}
while (false);
$this->echoJson($result);
}
... ... @@ -516,7 +96,6 @@ class BrandsController extends AbstractAction
)
)
)
)
),
array(
... ... @@ -982,7 +561,6 @@ class BrandsController extends AbstractAction
)
)
)
)
),
array(
... ... @@ -1196,4 +774,5 @@ class BrandsController extends AbstractAction
);
$this->_view->display('list', $data);
}
}
... ...
... ... @@ -5,6 +5,7 @@ namespace Product;
use Api\Yohobuy;
use Plugin\HelperSearch;
use LibModels\Web\Product\BrandData;
use Index\HomeModel;
use Product\SearchModel;
/**
... ... @@ -14,6 +15,13 @@ use Product\SearchModel;
*/
class BrandsModel
{
//品牌一览资源位CODE码
const BOYS_BRAND_CODE = '8b16b7baf9a66fbe553a6caa97d2ce2a';
const GIRLS_BRAND_CODE = 'c95ae9e40f0add10549b819f821ad626';
const KIDS_BRAND_CODE = '84b7926282fdef92f1039bdcf77c18ba';
const LIFESTYLE_BRAND_CODE = 'c575c6bfdfa4125fae7d24bbec7119c8';
/**
* 搜索品牌数据
* @param $condition array 搜索数据的条件
... ... @@ -30,7 +38,7 @@ class BrandsModel
$data['leftContent'][] = array('picLink' => $adNav);
//获取静态内容(eg:20141219-100447)
if($options['node']){
if ($options['node']) {
$nodeContent = HelperSearch::formatNodeContent($options['node']);
$data['leftContent'][]['picLink']['list'] = $nodeContent;
}
... ... @@ -38,7 +46,6 @@ class BrandsModel
return $data;
}
//获取品牌系列数据
public static function getAdNav($brandId, $status = 1)
{
... ... @@ -83,7 +90,6 @@ class BrandsModel
//组合用户浏览记录url
//$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);
//批量调接口
$result = Yohobuy::getMulti($urlList, array(), true);
... ... @@ -93,4 +99,124 @@ class BrandsModel
return $data;
}
/*
* 获取品牌一览页面,品牌top & 列表
*/
public static function getBrandView($channel)
{
$switchParams = self::switchBrandParams($channel);
$brandTop = array();
/*
* $item1 = array(
'name' => '所有品牌',
'src' => $imgsrc,
'url' => ''
);
*/
$brandAds = array();
$brandList = array();
$res = BrandData::getTopBanner($switchParams['brandCode'], $switchParams['channelType']);
if (isset($res['brandTop'][0]['data']) && $res['brandTop'][0]['data']) {
foreach ($res['brandTop'][0]['data'] as $tk => $tv) {
$imgUrl = explode("?", $tv['src']);
$topTmp = array(
'name' => $tv['title'],
'src' => $imgUrl[0],
'url' => $tv['url'],
'items' => array()
);
$brandTop[$tk] = $topTmp;
}
}
if (isset($res['brandList']['brands']) && $res['brandList']['brands']) {
foreach ($res['brandList']['brands'] as $lk => $lv) {
if (isset($lv) && $lv) {
$listTmp = array();
foreach ($lv as $ltk => $ltv) {
$listTmp[$ltk] = array(
'name' => $ltv['brand_name'],
'key' => $ltv['id']
);
if ($ltv['is_hot'] == 'Y') {
$listTmp[$ltk] += array('hot' => 'hot');
}
}
}
$brandList[$lk] = $listTmp;
}
}
return array(
'brandTop' => $brandTop,
'brandList' => $brandList
);
}
/*
* 获取单个广告浮窗内容
*/
public static function getBrandInfo($brandId, $uid)
{
$imgsrc = 'http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg';
$data = array(
'key' => '1000011',
'icon' => $imgsrc,
'title' => '优显led触控台灯',
'content' => '优显led触控台灯优显led触控台灯优显led触控台灯优显led触控台灯',
'subtitle' => 'AAAAAA',
'imgs' => array(
array(
'src' => $imgsrc
),
array(
'src' => $imgsrc
),
array(
'src' => $imgsrc
)
)
);
$res = BrandData::getBrandIntro($brandId, $uid);
//if(isset($res['data']) && $res['data']){
// $data['key']=$brandId;
// $data['icon']=
//}
var_dump($res);
die();
}
/*
* 获取品牌一览资源位&channelType
*/
public static function switchBrandParams($channelStr = 'boys')
{
$res = array('channelType' => 1, 'brandCode' => self::BOYS_BRAND_CODE);
switch ($channelStr) {
case HomeModel::COOKIE_NAME_BOYS:
$res['channelType'] = 1;
$res['brandCode'] = self::BOYS_BRAND_CODE;
break;
case HomeModel::COOKIE_NAME_GIRLS:
$res['channelType'] = 2;
$res['brandCode'] = self::GIRLS_BRAND_CODE;
break;
case HomeModel::COOKIE_NAME_KIDS:
$res['channelType'] = 3;
$res['brandCode'] = self::KIDS_BRAND_CODE;
break;
case HomeModel::COOKIE_NAME_LIFESTYLE:
$res['channelType'] = 4;
$res['brandCode'] = self::LIFESTYLE_BRAND_CODE;
break;
default:
$res['channelType'] = 1;
$res['brandCode'] = self::BOYS_BRAND_CODE;
break;
}
return $res;
}
}
... ...
<?php
use Action\AbstractAction;
use Action\WebAction;
use LibModels\Web\Passport\LoginData;
use Plugin\Helpers;
use Plugin\Partner\Factory;
class AutosignController extends AbstractAction
class AutosignController extends WebAction
{
/**
... ...
<?php
use Action\AbstractAction;
use Action\WebAction;
use LibModels\Web\Passport\RegData;
use LibModels\Wap\Passport\BindData;
use Passport\PassportModel as PassportModel;
use Plugin\Helpers;
class AutouserinfoController extends AbstractAction
class AutouserinfoController extends WebAction
{
/**
... ...