TaobaokeItemsRelateGetRequest.php
5.72 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<?php
/**
* TOP API: taobao.taobaoke.items.relate.get request
*
* @author auto create
* @since 1.0, 2012-12-13 16:33:03
*/
class TaobaokeItemsRelateGetRequest
{
/**
* 分类id.推荐类型为5时cid不能为空。仅支持叶子类目ID,即通过taobao.itemcats.get获取到is_parent=false的cid。
**/
private $cid;
/**
* 需返回的字段列表.可选值:num_iid,title,nick,pic_url,price,click_url,commission,ommission_rate,commission_num,commission_volume,shop_click_url,seller_credit_score,item_location,volume;字段之间用","分隔
**/
private $fields;
/**
* 标识一个应用是否来在无线或者手机应用,如果是true则会使用其他规则加密点击串.如果不传值,则默认是false
**/
private $isMobile;
/**
* 指定返回结果的最大条数.实际返回结果个数根据算法来确定,所以该值会小于或者等于该值
**/
private $maxCount;
/**
* 推广者的淘宝会员昵称.注:指的是淘宝的会员登录名
**/
private $nick;
/**
* 淘宝客商品数字id.推荐类型为1,2,3时num_iid不能为空
**/
private $numIid;
/**
* 自定义输入串.格式:英文和数字组成;长度不能大于12个字符,区分不同的推广渠道,如:bbs,表示bbs为推广渠道;blog,表示blog为推广渠道
**/
private $outerCode;
/**
* 用户的pid,必须是mm_xxxx_0_0这种格式中间的"xxxx". 注意nick和pid至少需要传递一个,如果2个都传了,将以pid为准,且pid的最大长度是20。第一次调用接口的用户,推荐该入参不要填写,使用nick=(淘宝账号)的方式去获取,以免出错。
**/
private $pid;
/**
* <p>推荐类型.</p>
<p>1:同类商品推荐;此时必须得输入num_iid</p>
<p>2:异类商品推荐;此时必须得输入num_iid</p>
<p>3:同店商品推荐;此时必须得输入num_iid</p>
<p>4:店铺热门推荐;此时必须得输入seller_id,这里的seller_id得通过<a href="http://api.taobao.com/apidoc/api.htm?path=cid:38-apiId:10449">taobao.taobaoke.shops.get</a>
跟<a href="http://api.taobao.com/apidoc/api.htm?path=cid:38-apiId:134">taobao.taobaoke.shops.convert</a>这两个接口去获取user_id字段</p>
<p>5:类目热门推荐;此时必须得输入cid</p>
**/
private $relateType;
/**
* 卖家的用户id,这里的seller_id得通过<a href="http://api.taobao.com/apidoc/api.htm?path=cid:38-apiId:10449">taobao.taobaoke.shops.get</a>
跟<a href="http://api.taobao.com/apidoc/api.htm?path=cid:38-apiId:134">taobao.taobaoke.shops.convert</a>这两个接口去获取user_id字段。
注:推荐类型为4时seller_id不能为空
**/
private $sellerId;
/**
* 店铺类型.默认all,商城:b,集市:c
**/
private $shopType;
/**
* default(默认排序,关联推荐相关度),price_desc(价格从高到低), price_asc(价格从低到高),commissionRate_desc(佣金比率从高到低), commissionRate_asc(佣金比率从低到高), commissionNum_desc(成交量成高到低), commissionNum_asc(成交量从低到高)
**/
private $sort;
/**
* 商品数字ID(带有跟踪效果)
**/
private $trackIid;
private $apiParas = array();
public function setCid($cid)
{
$this->cid = $cid;
$this->apiParas["cid"] = $cid;
}
public function getCid()
{
return $this->cid;
}
public function setFields($fields)
{
$this->fields = $fields;
$this->apiParas["fields"] = $fields;
}
public function getFields()
{
return $this->fields;
}
public function setIsMobile($isMobile)
{
$this->isMobile = $isMobile;
$this->apiParas["is_mobile"] = $isMobile;
}
public function getIsMobile()
{
return $this->isMobile;
}
public function setMaxCount($maxCount)
{
$this->maxCount = $maxCount;
$this->apiParas["max_count"] = $maxCount;
}
public function getMaxCount()
{
return $this->maxCount;
}
public function setNick($nick)
{
$this->nick = $nick;
$this->apiParas["nick"] = $nick;
}
public function getNick()
{
return $this->nick;
}
public function setNumIid($numIid)
{
$this->numIid = $numIid;
$this->apiParas["num_iid"] = $numIid;
}
public function getNumIid()
{
return $this->numIid;
}
public function setOuterCode($outerCode)
{
$this->outerCode = $outerCode;
$this->apiParas["outer_code"] = $outerCode;
}
public function getOuterCode()
{
return $this->outerCode;
}
public function setPid($pid)
{
$this->pid = $pid;
$this->apiParas["pid"] = $pid;
}
public function getPid()
{
return $this->pid;
}
public function setRelateType($relateType)
{
$this->relateType = $relateType;
$this->apiParas["relate_type"] = $relateType;
}
public function getRelateType()
{
return $this->relateType;
}
public function setSellerId($sellerId)
{
$this->sellerId = $sellerId;
$this->apiParas["seller_id"] = $sellerId;
}
public function getSellerId()
{
return $this->sellerId;
}
public function setShopType($shopType)
{
$this->shopType = $shopType;
$this->apiParas["shop_type"] = $shopType;
}
public function getShopType()
{
return $this->shopType;
}
public function setSort($sort)
{
$this->sort = $sort;
$this->apiParas["sort"] = $sort;
}
public function getSort()
{
return $this->sort;
}
public function setTrackIid($trackIid)
{
$this->trackIid = $trackIid;
$this->apiParas["track_iid"] = $trackIid;
}
public function getTrackIid()
{
return $this->trackIid;
}
public function getApiMethodName()
{
return "taobao.taobaoke.items.relate.get";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->fields,"fields");
RequestCheckUtil::checkNotNull($this->relateType,"relateType");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}