Total Complexity | 78 |
Total Lines | 616 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Complex classes like TbkDgMaterialOptionalRequest often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use TbkDgMaterialOptionalRequest, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
8 | class TbkDgMaterialOptionalRequest |
||
9 | { |
||
10 | /** |
||
11 | * mm_xxx_xxx_12345678三段式的最后一段数字 |
||
12 | **/ |
||
13 | private $adzoneId; |
||
14 | |||
15 | /** |
||
16 | * 商品筛选-后台类目ID。用,分割,最大10个,该ID可以通过taobao.itemcats.get接口获取到 |
||
17 | **/ |
||
18 | private $cat; |
||
19 | |||
20 | /** |
||
21 | * 本地化业务入参-LBS信息-国标城市码,仅支持单个请求,请求饿了么卡券物料时,该字段必填。 (详细城市ID见:https://mo.m.taobao.com/page_2020010315120200508) |
||
22 | **/ |
||
23 | private $cityCode; |
||
24 | |||
25 | /** |
||
26 | * 智能匹配-设备号加密类型:MD5 |
||
27 | **/ |
||
28 | private $deviceEncrypt; |
||
29 | |||
30 | /** |
||
31 | * 智能匹配-设备号类型:IMEI,或者IDFA,或者UTDID(UTDID不支持MD5加密),或者OAID |
||
32 | **/ |
||
33 | private $deviceType; |
||
34 | |||
35 | /** |
||
36 | * 智能匹配-设备号加密后的值(MD5加密需32位小写) |
||
37 | **/ |
||
38 | private $deviceValue; |
||
39 | |||
40 | /** |
||
41 | * 商品筛选-KA媒体淘客佣金比率上限。如:1234表示12.34% |
||
42 | **/ |
||
43 | private $endKaTkRate; |
||
44 | |||
45 | /** |
||
46 | * 商品筛选-折扣价范围上限。单位:元 |
||
47 | **/ |
||
48 | private $endPrice; |
||
49 | |||
50 | /** |
||
51 | * 商品筛选-淘客佣金比率上限。如:1234表示12.34% |
||
52 | **/ |
||
53 | private $endTkRate; |
||
54 | |||
55 | /** |
||
56 | * 优惠券筛选-是否有优惠券。true表示该商品有优惠券,false或不设置表示不限 |
||
57 | **/ |
||
58 | private $hasCoupon; |
||
59 | |||
60 | /** |
||
61 | * 商品筛选-好评率是否高于行业均值。True表示大于等于,false或不设置表示不限 |
||
62 | **/ |
||
63 | private $includeGoodRate; |
||
64 | |||
65 | /** |
||
66 | * 商品筛选(特定媒体支持)-成交转化是否高于行业均值。True表示大于等于,false或不设置表示不限 |
||
67 | **/ |
||
68 | private $includePayRate30; |
||
69 | |||
70 | /** |
||
71 | * 商品筛选(特定媒体支持)-退款率是否低于行业均值。True表示大于等于,false或不设置表示不限 |
||
72 | **/ |
||
73 | private $includeRfdRate; |
||
74 | |||
75 | /** |
||
76 | * ip参数影响邮费获取,如果不传或者传入不准确,邮费无法精准提供 |
||
77 | **/ |
||
78 | private $ip; |
||
79 | |||
80 | /** |
||
81 | * 商品筛选-是否海外商品。true表示属于海外商品,false或不设置表示不限 |
||
82 | **/ |
||
83 | private $isOverseas; |
||
84 | |||
85 | /** |
||
86 | * 商品筛选-是否天猫商品。true表示属于天猫商品,false或不设置表示不限 |
||
87 | **/ |
||
88 | private $isTmall; |
||
89 | |||
90 | /** |
||
91 | * 商品筛选-所在地 |
||
92 | **/ |
||
93 | private $itemloc; |
||
94 | |||
95 | /** |
||
96 | * 本地化业务入参-LBS信息-纬度 |
||
97 | **/ |
||
98 | private $latitude; |
||
99 | |||
100 | /** |
||
101 | * 锁佣结束时间 |
||
102 | **/ |
||
103 | private $lockRateEndTime; |
||
104 | |||
105 | /** |
||
106 | * 锁佣开始时间 |
||
107 | **/ |
||
108 | private $lockRateStartTime; |
||
109 | |||
110 | /** |
||
111 | * 本地化业务入参-LBS信息-经度 |
||
112 | **/ |
||
113 | private $longitude; |
||
114 | |||
115 | /** |
||
116 | * 不传时默认物料id=2836;如果直接对消费者投放,可使用官方个性化算法优化的搜索物料id=17004 |
||
117 | **/ |
||
118 | private $materialId; |
||
119 | |||
120 | /** |
||
121 | * 商品筛选-是否包邮。true表示包邮,false或不设置表示不限 |
||
122 | **/ |
||
123 | private $needFreeShipment; |
||
124 | |||
125 | /** |
||
126 | * 商品筛选-是否加入消费者保障。true表示加入,false或不设置表示不限 |
||
127 | **/ |
||
128 | private $needPrepay; |
||
129 | |||
130 | /** |
||
131 | * 商品筛选-牛皮癣程度。取值:1不限,2无,3轻微 |
||
132 | **/ |
||
133 | private $npxLevel; |
||
134 | |||
135 | /** |
||
136 | * 第几页,默认:1 |
||
137 | **/ |
||
138 | private $pageNo; |
||
139 | |||
140 | /** |
||
141 | * 页大小,默认20,1~100 |
||
142 | **/ |
||
143 | private $pageSize; |
||
144 | |||
145 | /** |
||
146 | * 链接形式:1:PC,2:无线,默认:1 |
||
147 | **/ |
||
148 | private $platform; |
||
149 | |||
150 | /** |
||
151 | * 商品筛选-查询词 |
||
152 | **/ |
||
153 | private $q; |
||
154 | |||
155 | /** |
||
156 | * 渠道关系ID,仅适用于渠道推广场景 |
||
157 | **/ |
||
158 | private $relationId; |
||
159 | |||
160 | /** |
||
161 | * 商家id,仅支持饿了么卡券商家ID,支持批量请求1-100以内,多个商家ID使用英文逗号分隔 |
||
162 | **/ |
||
163 | private $sellerIds; |
||
164 | |||
165 | /** |
||
166 | * 排序_des(降序),排序_asc(升序),销量(total_sales),淘客佣金比率(tk_rate), 累计推广量(tk_total_sales),总支出佣金(tk_total_commi),价格(price) |
||
167 | **/ |
||
168 | private $sort; |
||
169 | |||
170 | /** |
||
171 | * 会员运营ID |
||
172 | **/ |
||
173 | private $specialId; |
||
174 | |||
175 | /** |
||
176 | * 商品筛选(特定媒体支持)-店铺dsr评分。筛选大于等于当前设置的店铺dsr评分的商品0-50000之间 |
||
177 | **/ |
||
178 | private $startDsr; |
||
179 | |||
180 | /** |
||
181 | * 商品筛选-KA媒体淘客佣金比率下限。如:1234表示12.34% |
||
182 | **/ |
||
183 | private $startKaTkRate; |
||
184 | |||
185 | /** |
||
186 | * 商品筛选-折扣价范围下限。单位:元 |
||
187 | **/ |
||
188 | private $startPrice; |
||
189 | |||
190 | /** |
||
191 | * 商品筛选-淘客佣金比率下限。如:1234表示12.34% |
||
192 | **/ |
||
193 | private $startTkRate; |
||
194 | |||
195 | private $apiParas = array(); |
||
196 | |||
197 | public function setAdzoneId($adzoneId) |
||
198 | { |
||
199 | $this->adzoneId = $adzoneId; |
||
200 | $this->apiParas["adzone_id"] = $adzoneId; |
||
201 | } |
||
202 | |||
203 | public function getAdzoneId() |
||
204 | { |
||
205 | return $this->adzoneId; |
||
206 | } |
||
207 | |||
208 | public function setCat($cat) |
||
209 | { |
||
210 | $this->cat = $cat; |
||
211 | $this->apiParas["cat"] = $cat; |
||
212 | } |
||
213 | |||
214 | public function getCat() |
||
215 | { |
||
216 | return $this->cat; |
||
217 | } |
||
218 | |||
219 | public function setCityCode($cityCode) |
||
220 | { |
||
221 | $this->cityCode = $cityCode; |
||
222 | $this->apiParas["city_code"] = $cityCode; |
||
223 | } |
||
224 | |||
225 | public function getCityCode() |
||
226 | { |
||
227 | return $this->cityCode; |
||
228 | } |
||
229 | |||
230 | public function setDeviceEncrypt($deviceEncrypt) |
||
231 | { |
||
232 | $this->deviceEncrypt = $deviceEncrypt; |
||
233 | $this->apiParas["device_encrypt"] = $deviceEncrypt; |
||
234 | } |
||
235 | |||
236 | public function getDeviceEncrypt() |
||
237 | { |
||
238 | return $this->deviceEncrypt; |
||
239 | } |
||
240 | |||
241 | public function setDeviceType($deviceType) |
||
242 | { |
||
243 | $this->deviceType = $deviceType; |
||
244 | $this->apiParas["device_type"] = $deviceType; |
||
245 | } |
||
246 | |||
247 | public function getDeviceType() |
||
248 | { |
||
249 | return $this->deviceType; |
||
250 | } |
||
251 | |||
252 | public function setDeviceValue($deviceValue) |
||
253 | { |
||
254 | $this->deviceValue = $deviceValue; |
||
255 | $this->apiParas["device_value"] = $deviceValue; |
||
256 | } |
||
257 | |||
258 | public function getDeviceValue() |
||
259 | { |
||
260 | return $this->deviceValue; |
||
261 | } |
||
262 | |||
263 | public function setEndKaTkRate($endKaTkRate) |
||
264 | { |
||
265 | $this->endKaTkRate = $endKaTkRate; |
||
266 | $this->apiParas["end_ka_tk_rate"] = $endKaTkRate; |
||
267 | } |
||
268 | |||
269 | public function getEndKaTkRate() |
||
270 | { |
||
271 | return $this->endKaTkRate; |
||
272 | } |
||
273 | |||
274 | public function setEndPrice($endPrice) |
||
275 | { |
||
276 | $this->endPrice = $endPrice; |
||
277 | $this->apiParas["end_price"] = $endPrice; |
||
278 | } |
||
279 | |||
280 | public function getEndPrice() |
||
281 | { |
||
282 | return $this->endPrice; |
||
283 | } |
||
284 | |||
285 | public function setEndTkRate($endTkRate) |
||
286 | { |
||
287 | $this->endTkRate = $endTkRate; |
||
288 | $this->apiParas["end_tk_rate"] = $endTkRate; |
||
289 | } |
||
290 | |||
291 | public function getEndTkRate() |
||
292 | { |
||
293 | return $this->endTkRate; |
||
294 | } |
||
295 | |||
296 | public function setHasCoupon($hasCoupon) |
||
297 | { |
||
298 | $this->hasCoupon = $hasCoupon; |
||
299 | $this->apiParas["has_coupon"] = $hasCoupon; |
||
300 | } |
||
301 | |||
302 | public function getHasCoupon() |
||
303 | { |
||
304 | return $this->hasCoupon; |
||
305 | } |
||
306 | |||
307 | public function setIncludeGoodRate($includeGoodRate) |
||
308 | { |
||
309 | $this->includeGoodRate = $includeGoodRate; |
||
310 | $this->apiParas["include_good_rate"] = $includeGoodRate; |
||
311 | } |
||
312 | |||
313 | public function getIncludeGoodRate() |
||
314 | { |
||
315 | return $this->includeGoodRate; |
||
316 | } |
||
317 | |||
318 | public function setIncludePayRate30($includePayRate30) |
||
319 | { |
||
320 | $this->includePayRate30 = $includePayRate30; |
||
321 | $this->apiParas["include_pay_rate_30"] = $includePayRate30; |
||
322 | } |
||
323 | |||
324 | public function getIncludePayRate30() |
||
325 | { |
||
326 | return $this->includePayRate30; |
||
327 | } |
||
328 | |||
329 | public function setIncludeRfdRate($includeRfdRate) |
||
330 | { |
||
331 | $this->includeRfdRate = $includeRfdRate; |
||
332 | $this->apiParas["include_rfd_rate"] = $includeRfdRate; |
||
333 | } |
||
334 | |||
335 | public function getIncludeRfdRate() |
||
336 | { |
||
337 | return $this->includeRfdRate; |
||
338 | } |
||
339 | |||
340 | public function setIp($ip) |
||
341 | { |
||
342 | $this->ip = $ip; |
||
343 | $this->apiParas["ip"] = $ip; |
||
344 | } |
||
345 | |||
346 | public function getIp() |
||
347 | { |
||
348 | return $this->ip; |
||
349 | } |
||
350 | |||
351 | public function setIsOverseas($isOverseas) |
||
352 | { |
||
353 | $this->isOverseas = $isOverseas; |
||
354 | $this->apiParas["is_overseas"] = $isOverseas; |
||
355 | } |
||
356 | |||
357 | public function getIsOverseas() |
||
358 | { |
||
359 | return $this->isOverseas; |
||
360 | } |
||
361 | |||
362 | public function setIsTmall($isTmall) |
||
363 | { |
||
364 | $this->isTmall = $isTmall; |
||
365 | $this->apiParas["is_tmall"] = $isTmall; |
||
366 | } |
||
367 | |||
368 | public function getIsTmall() |
||
369 | { |
||
370 | return $this->isTmall; |
||
371 | } |
||
372 | |||
373 | public function setItemloc($itemloc) |
||
374 | { |
||
375 | $this->itemloc = $itemloc; |
||
376 | $this->apiParas["itemloc"] = $itemloc; |
||
377 | } |
||
378 | |||
379 | public function getItemloc() |
||
380 | { |
||
381 | return $this->itemloc; |
||
382 | } |
||
383 | |||
384 | public function setLatitude($latitude) |
||
385 | { |
||
386 | $this->latitude = $latitude; |
||
387 | $this->apiParas["latitude"] = $latitude; |
||
388 | } |
||
389 | |||
390 | public function getLatitude() |
||
391 | { |
||
392 | return $this->latitude; |
||
393 | } |
||
394 | |||
395 | public function setLockRateEndTime($lockRateEndTime) |
||
396 | { |
||
397 | $this->lockRateEndTime = $lockRateEndTime; |
||
398 | $this->apiParas["lock_rate_end_time"] = $lockRateEndTime; |
||
399 | } |
||
400 | |||
401 | public function getLockRateEndTime() |
||
402 | { |
||
403 | return $this->lockRateEndTime; |
||
404 | } |
||
405 | |||
406 | public function setLockRateStartTime($lockRateStartTime) |
||
407 | { |
||
408 | $this->lockRateStartTime = $lockRateStartTime; |
||
409 | $this->apiParas["lock_rate_start_time"] = $lockRateStartTime; |
||
410 | } |
||
411 | |||
412 | public function getLockRateStartTime() |
||
413 | { |
||
414 | return $this->lockRateStartTime; |
||
415 | } |
||
416 | |||
417 | public function setLongitude($longitude) |
||
418 | { |
||
419 | $this->longitude = $longitude; |
||
420 | $this->apiParas["longitude"] = $longitude; |
||
421 | } |
||
422 | |||
423 | public function getLongitude() |
||
424 | { |
||
425 | return $this->longitude; |
||
426 | } |
||
427 | |||
428 | public function setMaterialId($materialId) |
||
429 | { |
||
430 | $this->materialId = $materialId; |
||
431 | $this->apiParas["material_id"] = $materialId; |
||
432 | } |
||
433 | |||
434 | public function getMaterialId() |
||
435 | { |
||
436 | return $this->materialId; |
||
437 | } |
||
438 | |||
439 | public function setNeedFreeShipment($needFreeShipment) |
||
440 | { |
||
441 | $this->needFreeShipment = $needFreeShipment; |
||
442 | $this->apiParas["need_free_shipment"] = $needFreeShipment; |
||
443 | } |
||
444 | |||
445 | public function getNeedFreeShipment() |
||
446 | { |
||
447 | return $this->needFreeShipment; |
||
448 | } |
||
449 | |||
450 | public function setNeedPrepay($needPrepay) |
||
451 | { |
||
452 | $this->needPrepay = $needPrepay; |
||
453 | $this->apiParas["need_prepay"] = $needPrepay; |
||
454 | } |
||
455 | |||
456 | public function getNeedPrepay() |
||
457 | { |
||
458 | return $this->needPrepay; |
||
459 | } |
||
460 | |||
461 | public function setNpxLevel($npxLevel) |
||
462 | { |
||
463 | $this->npxLevel = $npxLevel; |
||
464 | $this->apiParas["npx_level"] = $npxLevel; |
||
465 | } |
||
466 | |||
467 | public function getNpxLevel() |
||
468 | { |
||
469 | return $this->npxLevel; |
||
470 | } |
||
471 | |||
472 | public function setPageNo($pageNo) |
||
473 | { |
||
474 | $this->pageNo = $pageNo; |
||
475 | $this->apiParas["page_no"] = $pageNo; |
||
476 | } |
||
477 | |||
478 | public function getPageNo() |
||
479 | { |
||
480 | return $this->pageNo; |
||
481 | } |
||
482 | |||
483 | public function setPageSize($pageSize) |
||
484 | { |
||
485 | $this->pageSize = $pageSize; |
||
486 | $this->apiParas["page_size"] = $pageSize; |
||
487 | } |
||
488 | |||
489 | public function getPageSize() |
||
490 | { |
||
491 | return $this->pageSize; |
||
492 | } |
||
493 | |||
494 | public function setPlatform($platform) |
||
495 | { |
||
496 | $this->platform = $platform; |
||
497 | $this->apiParas["platform"] = $platform; |
||
498 | } |
||
499 | |||
500 | public function getPlatform() |
||
501 | { |
||
502 | return $this->platform; |
||
503 | } |
||
504 | |||
505 | public function setQ($q) |
||
506 | { |
||
507 | $this->q = $q; |
||
508 | $this->apiParas["q"] = $q; |
||
509 | } |
||
510 | |||
511 | public function getQ() |
||
514 | } |
||
515 | |||
516 | public function setRelationId($relationId) |
||
517 | { |
||
518 | $this->relationId = $relationId; |
||
519 | $this->apiParas["relation_id"] = $relationId; |
||
520 | } |
||
521 | |||
522 | public function getRelationId() |
||
523 | { |
||
524 | return $this->relationId; |
||
525 | } |
||
526 | |||
527 | public function setSellerIds($sellerIds) |
||
528 | { |
||
529 | $this->sellerIds = $sellerIds; |
||
530 | $this->apiParas["seller_ids"] = $sellerIds; |
||
531 | } |
||
532 | |||
533 | public function getSellerIds() |
||
534 | { |
||
535 | return $this->sellerIds; |
||
536 | } |
||
537 | |||
538 | public function setSort($sort) |
||
539 | { |
||
540 | $this->sort = $sort; |
||
541 | $this->apiParas["sort"] = $sort; |
||
542 | } |
||
543 | |||
544 | public function getSort() |
||
547 | } |
||
548 | |||
549 | public function setSpecialId($specialId) |
||
550 | { |
||
551 | $this->specialId = $specialId; |
||
552 | $this->apiParas["special_id"] = $specialId; |
||
553 | } |
||
554 | |||
555 | public function getSpecialId() |
||
556 | { |
||
557 | return $this->specialId; |
||
558 | } |
||
559 | |||
560 | public function setStartDsr($startDsr) |
||
561 | { |
||
562 | $this->startDsr = $startDsr; |
||
563 | $this->apiParas["start_dsr"] = $startDsr; |
||
564 | } |
||
565 | |||
566 | public function getStartDsr() |
||
567 | { |
||
568 | return $this->startDsr; |
||
569 | } |
||
570 | |||
571 | public function setStartKaTkRate($startKaTkRate) |
||
572 | { |
||
573 | $this->startKaTkRate = $startKaTkRate; |
||
574 | $this->apiParas["start_ka_tk_rate"] = $startKaTkRate; |
||
575 | } |
||
576 | |||
577 | public function getStartKaTkRate() |
||
578 | { |
||
579 | return $this->startKaTkRate; |
||
580 | } |
||
581 | |||
582 | public function setStartPrice($startPrice) |
||
583 | { |
||
584 | $this->startPrice = $startPrice; |
||
585 | $this->apiParas["start_price"] = $startPrice; |
||
586 | } |
||
587 | |||
588 | public function getStartPrice() |
||
589 | { |
||
590 | return $this->startPrice; |
||
591 | } |
||
592 | |||
593 | public function setStartTkRate($startTkRate) |
||
594 | { |
||
595 | $this->startTkRate = $startTkRate; |
||
596 | $this->apiParas["start_tk_rate"] = $startTkRate; |
||
597 | } |
||
598 | |||
599 | public function getStartTkRate() |
||
602 | } |
||
603 | |||
604 | public function getApiMethodName() |
||
605 | { |
||
606 | return "taobao.tbk.dg.material.optional"; |
||
607 | } |
||
608 | |||
609 | public function getApiParas() |
||
610 | { |
||
611 | return $this->apiParas; |
||
612 | } |
||
613 | |||
614 | public function check() |
||
615 | { |
||
616 | |||
617 | RequestCheckUtil::checkNotNull($this->adzoneId,"adzoneId"); |
||
618 | RequestCheckUtil::checkMaxValue($this->startDsr,50000,"startDsr"); |
||
619 | } |
||
620 | |||
621 | public function putOtherTextParam($key, $value) { |
||
624 | } |
||
625 | } |
||
626 |