Authored by cailing

热销排行获取频道资源

... ... @@ -9,7 +9,7 @@ use Api\Yohobuy;
*/
class HotrankData extends \LibModels\Wap\Product\SearchData
{
const URI_HOTRANK_TAG = 'http://test.service.api.yohobuy.com/operations/service/v1/hotranktag';
const URI_HOTRANK_TAG = 'operations/service/v1/hotranktag';
/**
* 获取标签
... ... @@ -19,7 +19,7 @@ class HotrankData extends \LibModels\Wap\Product\SearchData
public static function getHotranktag($client_type = 'web',$channel = 0,$is_concurrent = true)
{
$params = array('client_type'=>$client_type,'channel'=>$channel,'is_concurrent' => $is_concurrent);
return Yohobuy::yarClient(self::URI_HOTRANK_TAG, 'getTag',$params);
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_HOTRANK_TAG, 'getTag',$params);
}
/**
... ... @@ -29,6 +29,6 @@ class HotrankData extends \LibModels\Wap\Product\SearchData
public static function getTagById($id,$is_concurrent = true)
{
$params['id'] = $id;
return Yohobuy::yarClient(self::URI_HOTRANK_TAG, 'getOneTag',$params);
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_HOTRANK_TAG, 'getOneTag',$params);
}
}
\ No newline at end of file
... ...
... ... @@ -9,6 +9,32 @@ use \LibModels\Web\Product\SearchData;
class HotrankModel {
/**
* 获取热销排行频道资源
*
* @param string $channel
* @return array
*/
static public function getChannelResource()
{
$channel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys';
switch ($channel)
{
case 'boys' :
$resource = array('channel' => 'boys', 'gender' => '1,3','road' => 1,'code' => '80d772d8dff25300a2a2e4c97165330c');
return $resource;
case 'girls' :
$resource = array('channel' => 'girls','gender' => '2,3','road' => 2,'code' => '8df64e505e94edb9881fd1e7efb702e9');
return $resource;
case 'lifestyle' :
$resource = array('channel' => 'lifestyle','gender' => '','road' => 4,'code' => 'd131aba83a84a6977eee3a7403a713de');
return $resource;
case 'kids' :
$resource = array('channel' => 'kids','gender' => '','road' => 3,'code' => 'bd6a06a08f8ca9b0db762f78e0bc5b68');
return $resource;
}
}
/**
* 人气单品 一周热卖
*/
static public function getSearchData($param,$page,$ajax)
... ...
... ... @@ -8,10 +8,6 @@ use LibModels\Web\Home\IndexData;
class IndexController extends WebAction
{
public $channel;
public $gender;
public $road;//频道
public $code;
/**
* 品牌首页
*/
... ... @@ -62,40 +58,15 @@ class IndexController extends WebAction
public function hotrankAction()
{
//获取频道
$cookie = $this->getCookie('_Channel');
$this->channel = isset($cookie) ? $cookie : 'boys';
switch ($this->channel)
{
case 'boys' :
$this->gender = '1,3';
$this->road = 1;
$this->code = '80d772d8dff25300a2a2e4c97165330c';
break;
case 'girls' :
$this->gender = '2,3';
$this->road = 2;
$this->code = '8df64e505e94edb9881fd1e7efb702e9';
break;
case 'lifestyle' :
$this->gender = '';
$this->road = 4;
$this->code = 'd131aba83a84a6977eee3a7403a713de';
break;
case 'kids' :
$this->gender = '';
$this->road = 3;
$this->code = 'bd6a06a08f8ca9b0db762f78e0bc5b68';
break;
}
$this->setWebNavHeader(\Index\HomeModel::$this->channel);
$channel = \product\HotrankModel::getChannelResource();
$this->setWebNavHeader($channel['channel']);
$data = array( 'hotrankPage' => true,
'footerTop'=> true,
'hotrank' => array()
);
//焦点图 热门品牌
$focus = \Index\HomeModel::getChannelResource($this->channel, $this->code);
$focus = \Index\HomeModel::getChannelResource($channel['channel'], $channel['code']);
$data['hotrank']['slide'] = $focus[0]['slide'];
$data['hotrank']['hotBrands'] = $focus[1]['hotBrands'];
... ... @@ -103,15 +74,15 @@ class IndexController extends WebAction
$page = $this->get('page',1);
$sort_id = $this->get('sid',0);
$viewNum = 60;
$param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'stocknumber'=>1,'status'=>1,'gender'=>$this->gender,'attribute_not'=>2);
$param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'stocknumber'=>1,'status'=>1,'gender'=>$channel['gender'],'attribute_not'=>2);
if($sort_id != 0)
{
$param['sort'] = $sort_id;
}
if($this->road == 3)
if($channel['road'] == 3)
{
$param['msort'] = 365;
}elseif($this->road == 4){
}elseif($channel['road'] == 4){
$param['msort'] = 10;
}else{
$param['not_maxSortId'] = '10,365';
... ... @@ -119,9 +90,9 @@ class IndexController extends WebAction
$publiclist = \product\HotrankModel::getSearchData($param,$page,0);
$data['hotrank']['popular'] = $publiclist['popular'];
$data['hotrank']['hotWeek'] = $publiclist['hotWeek'];
//分类标签
$nav = \product\HotrankModel::getHotranktag('web',$this->road,true);
$nav = \product\HotrankModel::getHotranktag('web',$channel['road'],true);
$data['hotrank']['hotWeek']['nav'] = $nav;
$this->_view->display('hotrank', $data);
}
... ... @@ -131,6 +102,7 @@ class IndexController extends WebAction
*/
public function getdataAction()
{
$page = $this->get('page',1);
//加载到100个以后停止
if($page > 2)
... ... @@ -150,15 +122,17 @@ class IndexController extends WebAction
$sort = $info['data']['category_id'];
}
}
$viewNum = 60;
$viewNum = 60;
//获取频道资源
$channel = \product\HotrankModel::getChannelResource();
$param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'sort'=>$sort,'stocknumber'=>1,'status'=>1,
'gender'=>$this->gender,'attribute_not'=>2);
'gender'=>$channel['gender'],'attribute_not'=>2,);
if(empty($param['sort']))
{
if($this->road == 3)
if($channel['road'] == 3)
{
$param['msort'] = 365;
}elseif($this->road == 4){
}elseif($channel['road'] == 4){
$param['msort'] = 10;
}else{
$param['not_maxSortId'] = '10,365';
... ...