ShopData.php
3.8 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
namespace LibModels\Web\Product;
use Api\Yohobuy;
use Api\Sign;
/**
* 品牌店铺的接口
* @info http://git.dev.yoho.cn/yoho-documents/api-interfaces/blob/master/%E5%95%86%E5%93%81%E5%88%97%E8%A1%A8/brandShops.md
* @copyright yoho.inc
* @author xiaoxiao.hao <xiaoxiao.hao@yoho.cn>
*/
class ShopData
{
/**
* 获取店铺装修的所有资源接口
* @param type int $shopId 店铺id
* @return type []
*/
public static function shopsDecoratorList($shopId)
{
$param = Yohobuy::param();
$param['method'] = 'app.shopsdecorator.getList';
$param['shop_id'] = intval($shopId);
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 查询店铺介绍接口
* @param type int $shopId 店铺id
* @return type []
*/
public static function getIntro($shopId, $uid = '')
{
$param = Yohobuy::param();
$param['method'] = 'app.shops.getIntro';
$param['shop_id'] = intval($shopId);
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 查询店铺下面的所有品牌
* @param type int $shopId 店铺id
* @return type []
*/
public static function getShopsBrands($shopId)
{
$param = Yohobuy::param();
$param['method'] = 'app.shops.getShopsBrands';
$param['shop_id'] = intval($shopId);
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 搜索店铺内商品 || 查询该店铺下全部商品
* @param type int $shopId 店铺id
* @return type []
*/
public static function getSearch($shopId)
{
$param = Yohobuy::param();
$param['method'] = 'app.search.li';
$param['shop'] = intval($shopId);
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 查询该店铺下所有二级品类
* @param type int $shopId 店铺id
* @param type string $yhChannel 频道
* @param type string $gender 性别
* @return type []
*/
public static function getSortInfo($shopId, $yhChannel = '', $gender = '')
{
$param = Yohobuy::param();
$param['method'] = 'app.shop.getSortInfo';
$param['shop_id'] = intval($shopId);
$param['yh_channel'] = $yhChannel;
$param['gender'] = $gender;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 收藏|取消 店铺接口
* @param type int $shopId 店铺id
* @param type Boolean $isfavorite true:收藏,false:取消
* @param type string $type 收藏的类型,brand、product、shop
* @return type []
*/
public static function setFavorite($shopId, $isfavorite, $uid, $type = 'shop')
{
$param = Yohobuy::param();
$param['method'] = $isfavorite ? 'app.favorite.add' : 'app.favorite.cancel';
$param['id'] = intval($shopId);
$param['fav_id'] = intval($shopId);
$param['uid'] = $uid;
$param['type'] = $type;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 根据domain查找shop_id
* @param type string $domain 品牌域名
* @return type []
*/
public static function byDomain($domain)
{
$param = Yohobuy::param();
$param['method'] = 'web.brand.byDomain';
$param['domain'] = $domain;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}