...
|
...
|
@@ -9,7 +9,7 @@ use Plugin\Helpers; |
|
|
* 新品到着,折扣专区接口操作类
|
|
|
*
|
|
|
* @name NewsaleData
|
|
|
* @package Library/LibModels/Channel
|
|
|
* @package Library/LibModels/wap/Product
|
|
|
* @copyright yoho.inc
|
|
|
* @version 1.0 (2015-10-8)
|
|
|
* @author gtskk <rocky.zhang@yoho.cn>
|
...
|
...
|
@@ -50,15 +50,17 @@ class NewsaleData |
|
|
$param['page'] = $page;
|
|
|
$param['limit'] = $limit;
|
|
|
$param['yh_channel'] = $channel;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
// 构建url地址列表
|
|
|
$urlList = array();
|
|
|
$param['dayLimit'] = 1;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
$urlList['new'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);
|
|
|
$param['dayLimit'] = 2;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
$urlList['week'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);
|
|
|
$param['dayLimit'] = 3;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
$urlList['sale'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);
|
|
|
//var_dump($urlList);exit;
|
|
|
|
...
|
...
|
@@ -66,34 +68,34 @@ class NewsaleData |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 筛选新品到着商品
|
|
|
* 筛选新品到着、折扣专区商品
|
|
|
*
|
|
|
* @param
|
|
|
* @param array $selectParams 筛选条件参数,可传递的条件参数有:
|
|
|
* string gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
|
|
|
* integer brand 品牌Id
|
|
|
* integer sort 品类Id
|
|
|
* integer color 颜色Id
|
|
|
* integer size 尺码Id
|
|
|
* string price 价格
|
|
|
* string p_d 折扣
|
|
|
* @param string $channel 1表示男, 2表示女
|
|
|
* @param integer $dayLimit 限制读取多少天,默认为1天
|
|
|
* @param integer $limit 查询返回的最大限制数, 默认为50
|
|
|
* @param integer $page 分页第几页, 默认第1页
|
|
|
* @return array 筛选出来的新品到着商品
|
|
|
* @param string gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
|
|
|
* @param integer $brand 品牌Id
|
|
|
* @param integer $sort 品类Id
|
|
|
* @param integer $color 颜色Id
|
|
|
* @param integer $size 尺码Id
|
|
|
* @param string $price 价格
|
|
|
* @param string $p_d 折扣
|
|
|
* @param string $channel 1表示男, 2表示女
|
|
|
* @param integer $dayLimit 限制读取多少天,默认为1天
|
|
|
* @param integer $limit 查询返回的最大限制数, 默认为50
|
|
|
* @param integer $page 分页第几页, 默认第1页
|
|
|
* @return array 根据指定条件筛选出来的商品
|
|
|
*/
|
|
|
public static function selectNewProducts(array $selectParams, $channel, $dayLimit = 1, $limit = 50, $page = 1)
|
|
|
public static function selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit = null, $limit = 50, $page = 1)
|
|
|
{
|
|
|
$selectItems = array(
|
|
|
'gender',
|
|
|
'brand',
|
|
|
'sort',
|
|
|
'color',
|
|
|
'size',
|
|
|
'price',
|
|
|
'p_d'
|
|
|
'gender' => $gender,
|
|
|
'brand' => $brand,
|
|
|
'sort' => $sort,
|
|
|
'color' => $color,
|
|
|
'size' => $size,
|
|
|
'price' => $price,
|
|
|
'p_d' => $p_d
|
|
|
);
|
|
|
// 拉取筛选参数
|
|
|
$queriedParams = array_filter($selectItems, function($v) {return $v !== null;});
|
|
|
|
|
|
$param = Yohobuy::param();
|
|
|
$param['method'] = 'app.search.newProduct';
|
...
|
...
|
@@ -101,10 +103,8 @@ class NewsaleData |
|
|
$param['page'] = $page;
|
|
|
$param['limit'] = $limit;
|
|
|
$param['yh_channel'] = $channel;
|
|
|
|
|
|
// 拉取筛选参数
|
|
|
$queriedParams = Helpers::array_get($selectParams, $selectItems);
|
|
|
$param = array_merge($param, $queriedParams);
|
|
|
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
...
|
...
|
@@ -128,19 +128,21 @@ class NewsaleData |
|
|
$param['page'] = $page;
|
|
|
$param['limit'] = $limit;
|
|
|
$param['yh_channel'] = $channel;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
// 构建url地址列表
|
|
|
$urlList = array();
|
|
|
$param['p_d'] = '0.1,0.3';
|
|
|
$urlList['new'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
$urlList['oneThree'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);
|
|
|
$param['p_d'] = '0.4,0.6';
|
|
|
$urlList['week'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
$urlList['fourSix'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);
|
|
|
$param['p_d'] = '0.7,0.9';
|
|
|
$urlList['sale'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
$urlList['SevenNine'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);
|
|
|
$param['p_d'] = '0.1,0.9';
|
|
|
$urlList['sale'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);
|
|
|
// var_dump($urlList);exit;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
$urlList['OneNine'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);
|
|
|
|
|
|
return Yohobuy::getMulti($urlList);
|
|
|
}
|
...
|
...
|
@@ -148,41 +150,39 @@ class NewsaleData |
|
|
/**
|
|
|
* 筛选折扣专区商品
|
|
|
*
|
|
|
* @param
|
|
|
* @param array $selectParams 筛选条件参数,可传递的条件参数有:
|
|
|
* string gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
|
|
|
* integer brand 品牌Id
|
|
|
* integer sort 品类Id
|
|
|
* integer color 颜色Id
|
|
|
* integer size 尺码Id
|
|
|
* string price 价格
|
|
|
* @param string $channel 1表示男, 2表示女
|
|
|
* @param integer $discount 折扣
|
|
|
* @param integer $limit 查询返回的最大限制数, 默认为50
|
|
|
* @param integer $page 分页第几页, 默认第1页
|
|
|
* @return array 筛选出来的折扣专区商品
|
|
|
* @param string gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
|
|
|
* @param integer brand 品牌Id
|
|
|
* @param integer sort 品类Id
|
|
|
* @param integer color 颜色Id
|
|
|
* @param integer size 尺码Id
|
|
|
* @param string price 价格
|
|
|
* @param string $channel 1表示男, 2表示女
|
|
|
* @param integer $p_d 折扣
|
|
|
* @param integer $limit 查询返回的最大限制数, 默认为50
|
|
|
* @param integer $page 分页第几页, 默认第1页
|
|
|
* @return array 筛选出来的折扣专区商品
|
|
|
*/
|
|
|
public static function selectSaleProducts(array $selectParams, $channel, $discount, $limit = 50, $page = 1)
|
|
|
public static function selectSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $limit = 50, $page = 1)
|
|
|
{
|
|
|
$selectItems = array(
|
|
|
'gender',
|
|
|
'brand',
|
|
|
'sort',
|
|
|
'color',
|
|
|
'size',
|
|
|
'price'
|
|
|
'gender' => $gender,
|
|
|
'brand' => $brand,
|
|
|
'sort' => $sort,
|
|
|
'color' => $color,
|
|
|
'size' => $size,
|
|
|
'price' => $price
|
|
|
);
|
|
|
// 拉取筛选参数
|
|
|
$queriedParams = array_filter($selectItems, function($v) {return $v !== null;});
|
|
|
|
|
|
$param = Yohobuy::param();
|
|
|
$param['method'] = 'app.search.sales';
|
|
|
$param['yh_channel'] = $channel;
|
|
|
$param['p_d'] = $discount;
|
|
|
$param['p_d'] = $p_d;
|
|
|
$param['page'] = $page;
|
|
|
$param['limit'] = $limit;
|
|
|
|
|
|
// 拉取筛选参数
|
|
|
$queriedParams = Helpers::array_get($selectParams, $selectItems);
|
|
|
$param = array_merge($param, $queriedParams);
|
|
|
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
...
|
...
|
|