...
|
...
|
@@ -2,10 +2,9 @@ |
|
|
namespace product;
|
|
|
|
|
|
use Plugin\Images;
|
|
|
use Plugin\Helpers;
|
|
|
use Plugin\Cache;
|
|
|
use Configs\CacheConfig;
|
|
|
use LibModels\Web\Home\IndexData;
|
|
|
use Api\Yohobuy;
|
|
|
//use Plugin\Helpers;
|
|
|
//use LibModels\Web\Home\IndexData;
|
|
|
use \LibModels\Web\Product\HotrankData;
|
|
|
use \LibModels\Web\Product\SearchData;
|
|
|
|
...
|
...
|
@@ -14,14 +13,14 @@ class HotrankModel { |
|
|
/**
|
|
|
* 人气单品 一周热卖
|
|
|
*/
|
|
|
static public function getSearchData($condition, $options)
|
|
|
static public function getSearchData($param,$page,$ajax)
|
|
|
{
|
|
|
// 调用接口查询商品数据
|
|
|
$result = SearchData::searchElasticByCondition($condition);
|
|
|
$result = SearchData::searchElasticByCondition($param);
|
|
|
//print_r($result);
|
|
|
|
|
|
if(!empty($result)){
|
|
|
$res = self::getProductList($result);
|
|
|
$res = self::getProductList($result,$page,$ajax);
|
|
|
if(!empty($res['popular'])){
|
|
|
$data['popular'] = $res['popular'];
|
|
|
}
|
...
|
...
|
@@ -37,18 +36,16 @@ class HotrankModel { |
|
|
/**
|
|
|
* 获取分类标签
|
|
|
*/
|
|
|
static public function getHotranktag($classes)
|
|
|
static public function getHotranktag($client_type,$channel,$is_concurrent)
|
|
|
{
|
|
|
$list = SearchData::getClassesData($classes);
|
|
|
//print_r($list);
|
|
|
$list = \LibModels\Web\Product\HotrankData::getHotranktag($client_type,$channel,$is_concurrent);
|
|
|
$nav = array();
|
|
|
if(!empty($list['data']['sort'])){
|
|
|
foreach($list['data']['sort'] as $li=>$lt){
|
|
|
$nav[$li]['sid'] = $lt['sort_id'];
|
|
|
$nav[$li]['textCn'] = $lt['sort_name'];
|
|
|
if(!empty($list['data']['list'])){
|
|
|
foreach($list['data']['list'] as $li=>$lt){
|
|
|
$nav[$li]['sid'] = $lt['id'];
|
|
|
$nav[$li]['textCn'] = $lt['tag_name'];
|
|
|
}
|
|
|
}
|
|
|
//print_r($nav);
|
|
|
return $nav;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -56,8 +53,10 @@ class HotrankModel { |
|
|
/**
|
|
|
* 人气单品 一周热卖 数据处理
|
|
|
*/
|
|
|
static public function getProductList($result)
|
|
|
static public function getProductList($result,$page,$ajax=0)
|
|
|
{
|
|
|
// 调用发起请求
|
|
|
Yohobuy::yarConcurrentLoop();
|
|
|
/*----product start---------*/
|
|
|
if(empty($result) || empty($result['data']) || empty($result['data']['product_list'])){
|
|
|
return;
|
...
|
...
|
@@ -83,26 +82,35 @@ class HotrankModel { |
|
|
$product_id = empty($val['product_id']) ? '' : $val['product_id'];
|
|
|
$re['url'] = 'http://item.yohobuy.com/product/pro_'.$product_id.'_'.$defaultGoodsId.'.html';
|
|
|
|
|
|
$re['marketPrice'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : '¥'.$val['market_price'];
|
|
|
$re['salePrice'] = empty($val['sales_price']) ? '' : '¥'.$val['sales_price'];
|
|
|
$re['name'] = $val['product_name'];
|
|
|
if($key <= 9){
|
|
|
$re['rank'] = $key + 1;
|
|
|
if($key <= 5){
|
|
|
$re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 378, 504, 2);
|
|
|
$popular['list'][] = $re;
|
|
|
}else{
|
|
|
$re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
|
|
|
$popular['list'][] = $re;
|
|
|
}
|
|
|
}else{
|
|
|
$re['rank'] = '';
|
|
|
$re['thumb'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
|
|
|
$hot[] = $re;
|
|
|
}
|
|
|
$re['name'] = $val['product_name'];
|
|
|
if($key <= 9 && $page == 1 && $ajax == 0){
|
|
|
$re['rank'] = $key + 1;
|
|
|
if($key <= 5){
|
|
|
$re['price'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : '¥'.$val['market_price'];
|
|
|
$re['sPrice'] = empty($val['sales_price']) ? '' : '¥'.$val['sales_price'];
|
|
|
$re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 378, 504, 2);
|
|
|
$popular['list'][] = $re;
|
|
|
}else{
|
|
|
$re['price'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : '¥'.$val['market_price'];
|
|
|
$re['sPrice'] = empty($val['sales_price']) ? '' : '¥'.$val['sales_price'];
|
|
|
$re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
|
|
|
$popular['list'][] = $re;
|
|
|
}
|
|
|
}else if ($ajax == 1){
|
|
|
$re['marketPrice'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : '¥'.$val['market_price'];
|
|
|
$re['salePrice'] = empty($val['sales_price']) ? '' : '¥'.$val['sales_price'];
|
|
|
$re['rank'] = '';
|
|
|
$re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
|
|
|
$hot[] = $re;
|
|
|
}else{
|
|
|
$re['marketPrice'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : '¥'.$val['market_price'];
|
|
|
$re['salePrice'] = empty($val['sales_price']) ? '' : '¥'.$val['sales_price'];
|
|
|
$re['rank'] = '';
|
|
|
$re['thumb'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
|
|
|
$hot[] = $re;
|
|
|
}
|
|
|
}
|
|
|
$popular['name'] = '人气单品';
|
|
|
|
|
|
$hotWeek = array(
|
|
|
'name'=>'一周热卖',
|
|
|
'list'=>$hot,
|
...
|
...
|
|