Authored by whb

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

... ... @@ -33,7 +33,7 @@ class HelperSearch
$options = self::$options;
$cookieChannel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys';
if (isset($options['brandName']) && !empty($options['brandName'])) {
$initNav = $options['brandName'];
$initNav = $options['brandNameEn'] . $options['brandNameCn'];
}else{
$initNav = '列表';
}
... ...
... ... @@ -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
... ...
... ... @@ -150,7 +150,7 @@ exports.init = function(num) {
$goodItemWrapper.mouseleave(function() {
removeHtmlFn();
// removeHtmlFn();
});
function removeHtmlFn() {
... ... @@ -171,15 +171,19 @@ $(document).on('hover', '.good-select-color li', function() {
});
$goodInfoMain.on('click', '.col-btn', function() {
var $this = $(this);
$.ajax({
type: 'POST',
url: '/product/list/changeFavorite',
data: {
skn: $(this).closest('.good-info').data('skn'),
isFavorite: !$(this).hasClass('coled')
skn: $this.closest('.good-info').data('skn'),
isFavorite: !$this.hasClass('coled')
}
}).then(function(res) {
console.log(res);
if (res.code === 200) {
$this.toggleClass('coled');
}
});
});
... ...
... ... @@ -123,7 +123,7 @@
display: block;
&:hover {
color: #f95b4f;
// color: #f95b4f;
cursor: pointer;
}
}
... ...
... ... @@ -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;
... ... @@ -28,6 +28,8 @@ class IndexController extends WebAction
$brandId = $brandInfo['data']['id'];
$node = isset($brandInfo['data']['static_content_code']) ? $brandInfo['data']['static_content_code'] : false;
$brandBanner = $brandInfo['data']['brand_banner'];
$brandNameEn = $brandInfo['data']['brand_name_en'];
$brandNameCn = $brandInfo['data']['brand_name_cn'];
} else {
$this->go(SITE_MAIN);
}
... ... @@ -47,6 +49,8 @@ class IndexController extends WebAction
$options['brandId'] = $brandId;
$options['node'] = $node;
$options['brandBanner'] = $brandBanner;
$options['brandNameEn'] = $brandNameEn;
$options['brandNameCn'] = $brandNameCn;
$options['reviewNum'] = 6;
//调用模型获得数据
... ... @@ -140,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'];
... ... @@ -176,7 +167,6 @@ class IndexController extends WebAction
*/
public function getdataAction()
{
$page = $this->get('page',1);
//加载到100个以后停止
if($page > 2)
... ... @@ -196,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)
... ...
... ... @@ -29,7 +29,8 @@ class ListController extends WebAction
/**
* list列表new(模板new-sale)
*/
public function newAction(){
public function newAction()
{
$condition = array(
'order' => 's_t_desc'
);
... ... @@ -113,7 +114,7 @@ class ListController extends WebAction
* @author
* @return json
*/
public static function changeFavoriteAction()
public function changeFavoriteAction()
{
if (!$this->isAjax()) {
return;
... ...
... ... @@ -46,6 +46,7 @@ class SaleController extends WebAction
);
$saleData = Product\SaleModel::getSaleSearchData($condition, $options, $specialInfo);
$data = array(
//初始化js
'productListPage' => true,
... ...