|
@@ -16,6 +16,7 @@ use Api\Sign; |
|
@@ -16,6 +16,7 @@ use Api\Sign; |
16
|
*/
|
16
|
*/
|
17
|
class BrandData
|
17
|
class BrandData
|
18
|
{
|
18
|
{
|
|
|
19
|
+
|
19
|
const URI_BRAND_TOPPOS = 'operations/api/v5/resource/get';
|
20
|
const URI_BRAND_TOPPOS = 'operations/api/v5/resource/get';
|
20
|
|
21
|
|
21
|
/**
|
22
|
/**
|
|
@@ -32,13 +33,13 @@ class BrandData |
|
@@ -32,13 +33,13 @@ class BrandData |
32
|
public static function package($contentCode, $channel)
|
33
|
public static function package($contentCode, $channel)
|
33
|
{
|
34
|
{
|
34
|
$urlList = array();
|
35
|
$urlList = array();
|
35
|
-
|
36
|
+
|
36
|
/* 顶部的轮翻广告及热门品牌数据 */
|
37
|
/* 顶部的轮翻广告及热门品牌数据 */
|
37
|
$param = Yohobuy::param();
|
38
|
$param = Yohobuy::param();
|
38
|
$param['content_code'] = $contentCode;
|
39
|
$param['content_code'] = $contentCode;
|
39
|
$param['client_secret'] = Sign::getSign($param);
|
40
|
$param['client_secret'] = Sign::getSign($param);
|
40
|
$urlList['brandTop'] = Yohobuy::httpBuildQuery(Yohobuy::SERVICE_URL . self::URI_BRAND_TOPPOS, $param);
|
41
|
$urlList['brandTop'] = Yohobuy::httpBuildQuery(Yohobuy::SERVICE_URL . self::URI_BRAND_TOPPOS, $param);
|
41
|
-
|
42
|
+
|
42
|
/* 按字母"A-Z"分组的品牌列表数据 */
|
43
|
/* 按字母"A-Z"分组的品牌列表数据 */
|
43
|
$param = Yohobuy::param();
|
44
|
$param = Yohobuy::param();
|
44
|
$param['method'] = 'app.brand.brandlist';
|
45
|
$param['method'] = 'app.brand.brandlist';
|
|
@@ -48,7 +49,7 @@ class BrandData |
|
@@ -48,7 +49,7 @@ class BrandData |
48
|
|
49
|
|
49
|
return Yohobuy::getMulti($urlList);
|
50
|
return Yohobuy::getMulti($urlList);
|
50
|
}
|
51
|
}
|
51
|
-
|
52
|
+
|
52
|
/**
|
53
|
/**
|
53
|
* 获取品牌数据
|
54
|
* 获取品牌数据
|
54
|
*
|
55
|
*
|
|
@@ -98,7 +99,7 @@ class BrandData |
|
@@ -98,7 +99,7 @@ class BrandData |
98
|
$param['uid'] = $uid;
|
99
|
$param['uid'] = $uid;
|
99
|
$param['method'] = 'app.brand.getBrandIntro';
|
100
|
$param['method'] = 'app.brand.getBrandIntro';
|
100
|
$param['client_secret'] = Sign::getSign($param);
|
101
|
$param['client_secret'] = Sign::getSign($param);
|
101
|
-
|
102
|
+
|
102
|
$cache = empty($uid) ? 3600 : false;
|
103
|
$cache = empty($uid) ? 3600 : false;
|
103
|
|
104
|
|
104
|
return Yohobuy::get(Yohobuy::API_URL, $param, $cache); // 有缓存1小时
|
105
|
return Yohobuy::get(Yohobuy::API_URL, $param, $cache); // 有缓存1小时
|
|
@@ -165,8 +166,8 @@ class BrandData |
|
@@ -165,8 +166,8 @@ class BrandData |
165
|
|
166
|
|
166
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
167
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
167
|
}
|
168
|
}
|
168
|
-
|
|
|
169
|
- /**
|
169
|
+
|
|
|
170
|
+ /**
|
170
|
* 查询商品数据
|
171
|
* 查询商品数据
|
171
|
*
|
172
|
*
|
172
|
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
|
173
|
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
|
|
@@ -182,15 +183,21 @@ class BrandData |
|
@@ -182,15 +183,21 @@ class BrandData |
182
|
* @param integer $channel 表示频道号,1位男生,2为女生
|
183
|
* @param integer $channel 表示频道号,1位男生,2为女生
|
183
|
* @return array 品类商品数据
|
184
|
* @return array 品类商品数据
|
184
|
*/
|
185
|
*/
|
185
|
- public static function filterBrandData($condition, $order = 's_t_desc', $limit = 60, $page = 1)
|
186
|
+ public static function filterBrandData($condition)
|
186
|
{
|
187
|
{
|
187
|
$param = Yohobuy::param();
|
188
|
$param = Yohobuy::param();
|
188
|
$param['method'] = 'app.search.brand';
|
189
|
$param['method'] = 'app.search.brand';
|
189
|
- $param['page'] = $page;
|
|
|
190
|
- $param['limit'] = $limit;
|
|
|
191
|
- $param['order'] = $order;
|
|
|
192
|
$param += $condition;
|
190
|
$param += $condition;
|
193
|
- $param['client_secret'] = Sign::getSign($param);
|
191
|
+ if (!isset($param['order'])) {
|
|
|
192
|
+ $param['order'] = 's_t_desc';
|
|
|
193
|
+ }
|
|
|
194
|
+ if (!isset($param['limit'])) {
|
|
|
195
|
+ $param['limit'] = 60;
|
|
|
196
|
+ }
|
|
|
197
|
+ if (!isset($param['page'])) {
|
|
|
198
|
+ $param['page'] = 1;
|
|
|
199
|
+ }
|
|
|
200
|
+ $param['client_secret'] = Sign::getSign($param);
|
194
|
|
201
|
|
195
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
202
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
196
|
}
|
203
|
}
|