Authored by 毕凯

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

... ... @@ -11,3 +11,19 @@
{{/ resetSuccess}}
</div>
{{> layout/footer}}
<script type="text/javascript">
(function() {
var count = 5,
countDown = document.getElementById('count-down');
var timer = setInterval(function(){
if (count > 1) {
count--;
countDown.innerHTML = count;
} else {
location.href = '/';
}
}, 1000);
})();
</script>
\ No newline at end of file
... ...
... ... @@ -5,18 +5,19 @@ use WebPlugin\Images;
use Api\Yohobuy;
use LibModels\Web\Product\HotrankData;
use LibModels\Web\Product\SearchData;
use LibModels\Web\Home\IndexData;
use WebPlugin\DataProcess\WebChannel\Channel as ChannelProcess;
class HotrankModel {
/**
* 获取热销排行频道资源
*
* @param string $channel
*
* @return array
*/
static public function getChannelResource()
{
$channel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys';
$channel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys';
switch ($channel)
{
case 'boys' :
... ... @@ -34,33 +35,75 @@ class HotrankModel {
}
}
/**
* 人气单品 一周热卖
* 获取焦点图,热门品牌资源
* @param string $channel
* @param string $content_code
* @return array
*/
static public function getSearchData($param,$page,$ajax)
static public function getFocusResource($channel, $content_code)
{
// 调用接口查询商品数据
$result = SearchData::searchElasticByCondition($param);
if(!empty($result))
$resource = IndexData::getResourceData($content_code);
// 格式化数据
$data = ChannelProcess::getFormat($channel, $resource['data']);
return $data;
}
/**
* 获取人气单品,一周热卖商品资源
* @param $config 过滤参数
* @param $page 当前页数
* @param $ajax 是否是ajax加载 默认0不是
*/
static public function getSearchData($config,$page,$ajax)
{
//配置查询商品参数
$viewNum = 60;
$param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'stocknumber'=>1,'status'=>1,
'sort'=>$config['sort'],'gender'=>$config['gender'],'attribute_not'=>2);
if($ajax == 0)
{
$res = self::getProductList($result,$page,$ajax);
if(!empty($res['popular']))
if($config['sort'] != 0)
{
$data['popular'] = $res['popular'];
$param['sort'] = $sort_id;
}else{
$param['sort'] = '';
}
if(!empty($res['hotWeek']))
if($config['road'] == 3)
{
$param['msort'] = 365;
}elseif($config['road'] == 4){
$param['msort'] = 10;
}else{
$param['not_maxSortId'] = '10,365';
}
}else{
if(empty($param['sort']))
{
$data['hotWeek'] = $res['hotWeek'];
}
if($config['road'] == 3)
{
$param['msort'] = 365;
}elseif($config['road'] == 4){
$param['msort'] = 10;
}else{
$param['not_maxSortId'] = '10,365';
}
}
}
//根据给定查询数据搜索数据列表
$result = SearchData::searchElasticByCondition($param);
$data = self::getProductList($result,$page,$ajax);
return $data;
}
/**
* 获取分类标签
* 获取标签资源
* @param $client_type 客户端类型
* @param $channel 频道类型
* @param $is_concurrent 是否异步,true异步,false同步,默认true
*/
static public function getHotranktag($client_type,$channel,$is_concurrent)
{
... ... @@ -76,10 +119,13 @@ class HotrankModel {
}
return $nav;
}
/**
* 人气单品 一周热卖 数据处理
/**
* 人气单品 一周热卖 数据处理
* @param $result 过滤参数
* @param $page 当前页数
* @param $ajax 是否是ajax加载 默认0不是
*/
static public function getProductList($result,$page,$ajax=0)
{
... ... @@ -144,7 +190,9 @@ class HotrankModel {
'name'=>'一周热卖',
'list'=>$hot,
);
return array('popular'=>$popular,'hotWeek'=>$hotWeek);
$data['popular'] = $popular;
$data['hotWeek'] = $hotWeek;
return $data;
}
}
\ No newline at end of file
... ...
... ... @@ -3,7 +3,7 @@ use Action\WebAction;
use LibModels\Web\Product\BrandData;
use LibModels\Web\Product\FavoriteData;
use \LibModels\Web\Product\HotrankData;
use LibModels\Web\Product\HotrankData;
use product\HotrankModel;
use LibModels\Web\Home\IndexData;
... ... @@ -144,28 +144,15 @@ class IndexController extends WebAction
);
//焦点图 热门品牌
$focus = \Index\HomeModel::getChannelResource($channel['channel'], $channel['code']);
$data['hotrank']['slide'] = $focus[0]['slide'];
$data['hotrank']['hotBrands'] = $focus[1]['hotBrands'];
$focus = \product\HotrankModel::getFocusResource($channel['channel'], $channel['code']);
$data['hotrank']['slide'] = $focus[0]['slide'];
$data['hotrank']['hotBrands'] = $focus[1]['hotBrands'];
//人气单品 一周热卖
$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'=>$channel['gender'],'attribute_not'=>2);
if($sort_id != 0)
{
$param['sort'] = $sort_id;
}
if($channel['road'] == 3)
{
$param['msort'] = 365;
}elseif($channel['road'] == 4){
$param['msort'] = 10;
}else{
$param['not_maxSortId'] = '10,365';
}
$publiclist = \product\HotrankModel::getSearchData($param,$page,0);
$page = $this->get('page',1);
$sort_id = $this->get('sid',0);
$config = array('sort' =>$sort_id,'gender' => $channel['gender'],'road' => $channel['road']);
$publiclist = \product\HotrankModel::getSearchData($config,$page,0);
$data['hotrank']['popular'] = $publiclist['popular'];
$data['hotrank']['hotWeek'] = $publiclist['hotWeek'];
... ... @@ -180,7 +167,6 @@ class IndexController extends WebAction
*/
public function getdataAction()
{
$page = $this->get('page',1);
//加载到100个以后停止
if($page > 2)
... ... @@ -200,24 +186,11 @@ class IndexController extends WebAction
$sort = $info['data']['category_id'];
}
}
$viewNum = 60;
//获取频道资源
$channel = \product\HotrankModel::getChannelResource();
$param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'sort'=>$sort,'stocknumber'=>1,'status'=>1,
'gender'=>$channel['gender'],'attribute_not'=>2,);
if(empty($param['sort']))
{
if($channel['road'] == 3)
{
$param['msort'] = 365;
}elseif($channel['road'] == 4){
$param['msort'] = 10;
}else{
$param['not_maxSortId'] = '10,365';
}
}
//一周热卖
$list = \product\HotrankModel::getSearchData($param, $page, 1);
$config = array('sort' =>$sort,'gender' => $channel['gender'],'road' => $channel['road']);
$list = \product\HotrankModel::getSearchData($config, $page, 1);
$lister = $list['hotWeek']['list'];
$lister = array_values($lister);
if($sid == 1 && $page == 1)
... ...