BrandData.php
2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
namespace LibModels\Web\Product;
use Api\Yohobuy;
use Api\Sign;
/**
* 品牌数据接口操作类
*
* @name BrandData
* @package Library/LibModels/wap/Category
* @copyright yoho.inc
* @version 1.0 (2015-10-10)
* @author gtskk <rocky.zhang@yoho.cn>
*/
class BrandData
{
const URI_BRAND_TOPPOS = 'operations/api/v5/resource/get';
const URL_BRAND_LOGO = '/shops/service/v1/brand';
/**
* 获取品牌介绍
*
* @param integer $brandId 品牌ID
* @param int 用户ID
* @return array 品牌介绍信息
*/
public static function getBrandIntro($brandId, $uid)
{
// 构建必传参数
$param = Yohobuy::param();
$param['brand_id'] = $brandId;
$param['uid'] = '10267443';
$param['method'] = 'app.brand.getBrandIntro';
$param['client_secret'] = Sign::getSign($param);
$cache = empty($uid) ? 3600 : false;
return Yohobuy::get(Yohobuy::API_URL, $param, $cache); // 有缓存1小时
}
/**
* 获取品牌banner数据
* @param integer $brandId 品牌ID
* @return array banner数据
*/
public static function getBrandBanner($brandId)
{
// 构建必传参数
$param = Yohobuy::param();
$param['brand_id'] = $brandId;
$param['method'] = 'app.brand.banner';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param, 3600); // 有缓存1小时
}
/**
* 获取品牌介绍信息
*
* @param int $id 品牌id
* @return array
*/
public static function getBrandLogo($id)
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByids', array($id ));
}
/**
* 通过域名获取品牌LOGO信息
*
* @param int $domain 品牌domain
* @return array
*/
public static function getBrandLogoByDomain($domain)
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByDomain', array($domain ));
}
}