Total Complexity | 106 |
Total Lines | 1448 |
Duplicated Lines | 0 % |
Changes | 11 | ||
Bugs | 0 | Features | 0 |
Complex classes like TbkService 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 TbkService, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
29 | class TbkService extends Service |
||
30 | { |
||
31 | /** |
||
32 | * 是否为沙箱 |
||
33 | * @var bool |
||
34 | */ |
||
35 | private $sandbox = false; |
||
36 | |||
37 | /** |
||
38 | * TOP分配给应用的 |
||
39 | * @var string |
||
40 | */ |
||
41 | private $app_key, $app_secret = ""; |
||
42 | |||
43 | /** |
||
44 | * API接口名称 |
||
45 | * @var string |
||
46 | */ |
||
47 | private $method = ''; |
||
48 | |||
49 | /** |
||
50 | * 签名的摘要算法 |
||
51 | * @var string |
||
52 | */ |
||
53 | private $sign_method = "md5"; |
||
54 | |||
55 | /** |
||
56 | * 需要发送的的参数 |
||
57 | * @var |
||
58 | */ |
||
59 | private $param; |
||
60 | |||
61 | /** |
||
62 | * 响应格式 |
||
63 | * @var string |
||
64 | */ |
||
65 | private $format = "json"; |
||
66 | |||
67 | /** |
||
68 | * API协议版本 |
||
69 | * @var string |
||
70 | */ |
||
71 | private $v = "2.0"; |
||
72 | |||
73 | /** |
||
74 | * 响应内容 |
||
75 | * @var |
||
76 | */ |
||
77 | private $output; |
||
78 | |||
79 | /** |
||
80 | * 安全协议 |
||
81 | * @var string |
||
82 | */ |
||
83 | private $protocol = 'http'; |
||
84 | |||
85 | /** |
||
86 | * 设置安全协议 |
||
87 | * @param string $protocol |
||
88 | * @return $this |
||
89 | */ |
||
90 | public function setProtocol($protocol = 'http'): self |
||
91 | { |
||
92 | $this->protocol = $protocol; |
||
93 | return $this; |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * 是否为沙箱 |
||
98 | * @return $this |
||
99 | */ |
||
100 | public function sandbox(): self |
||
101 | { |
||
102 | $this->sandbox = true; |
||
103 | return $this; |
||
104 | } |
||
105 | |||
106 | /** |
||
107 | * 配置应用的AppKey |
||
108 | * @param string $appKey |
||
109 | * @return $this |
||
110 | */ |
||
111 | public function appKey(string $appKey): self |
||
112 | { |
||
113 | $this->app_key = $appKey; |
||
114 | return $this; |
||
115 | } |
||
116 | |||
117 | /** |
||
118 | * 应用AppSecret |
||
119 | * @param string $appSecret |
||
120 | * @return $this |
||
121 | */ |
||
122 | public function appSecret(string $appSecret): self |
||
123 | { |
||
124 | $this->app_secret = $appSecret; |
||
125 | return $this; |
||
126 | } |
||
127 | |||
128 | /** |
||
129 | * API接口名称 |
||
130 | * @param string $signMethod |
||
131 | * @return $this |
||
132 | */ |
||
133 | public function signMethod(string $signMethod): self |
||
134 | { |
||
135 | $this->sign_method = $signMethod; |
||
136 | return $this; |
||
137 | } |
||
138 | |||
139 | /** |
||
140 | * 请求参数 |
||
141 | * @param array $param |
||
142 | * @return $this |
||
143 | */ |
||
144 | public function param(array $param): self |
||
145 | { |
||
146 | $this->param = $param; |
||
147 | return $this; |
||
148 | } |
||
149 | |||
150 | /** |
||
151 | * 获取配置信息 |
||
152 | * @return $this |
||
153 | */ |
||
154 | private function getConfig(): self |
||
155 | { |
||
156 | $this->app_key = config('dtapp.taobao.tbk.app_key'); |
||
|
|||
157 | $this->app_secret = config('dtapp.taobao.tbk.app_secret'); |
||
158 | return $this; |
||
159 | } |
||
160 | |||
161 | /** |
||
162 | * 淘宝客-推广者-所有订单查询 |
||
163 | * @return $this |
||
164 | */ |
||
165 | public function orderDetailsGet(): self |
||
166 | { |
||
167 | $this->method = 'taobao.tbk.order.details.get'; |
||
168 | return $this; |
||
169 | } |
||
170 | |||
171 | /** |
||
172 | * 淘宝客-服务商-所有订单查询 |
||
173 | * @return $this |
||
174 | */ |
||
175 | public function scOrderDetailsGet(): self |
||
176 | { |
||
177 | $this->method = 'taobao.tbk.sc.order.details.get'; |
||
178 | return $this; |
||
179 | } |
||
180 | |||
181 | /** |
||
182 | * 淘宝客-服务商-淘口令解析&转链 |
||
183 | * @return $this |
||
184 | */ |
||
185 | public function scTpwdConvert(): self |
||
186 | { |
||
187 | $this->method = 'taobao.tbk.sc.tpwd.convert'; |
||
188 | return $this; |
||
189 | } |
||
190 | |||
191 | /** |
||
192 | * 淘宝客-服务商-维权退款订单查询 |
||
193 | * @return $this |
||
194 | */ |
||
195 | public function scRelationRefund(): self |
||
196 | { |
||
197 | $this->method = 'taobao.tbk.sc.relation.refund'; |
||
198 | return $this; |
||
199 | } |
||
200 | |||
201 | /** |
||
202 | * 淘宝客-服务商-店铺链接转换 |
||
203 | * @return $this |
||
204 | */ |
||
205 | public function scShopConvert(): self |
||
206 | { |
||
207 | $this->method = 'taobao.tbk.sc.shop.convert'; |
||
208 | return $this; |
||
209 | } |
||
210 | |||
211 | /** |
||
212 | * 淘宝客-推广者-官办找福利页 |
||
213 | * @return $this |
||
214 | */ |
||
215 | public function jzfConvert(): self |
||
216 | { |
||
217 | $this->method = 'taobao.tbk.jzf.convert'; |
||
218 | return $this; |
||
219 | } |
||
220 | |||
221 | /** |
||
222 | * 淘宝客-推广者-维权退款订单查询 |
||
223 | * @return $this |
||
224 | */ |
||
225 | public function relationRefund(): self |
||
226 | { |
||
227 | $this->method = 'taobao.tbk.relation.refund'; |
||
228 | return $this; |
||
229 | } |
||
230 | |||
231 | /** |
||
232 | * 淘宝客-服务商-淘礼金创建 |
||
233 | * @return $this |
||
234 | */ |
||
235 | public function scVegasTljCreate(): self |
||
236 | { |
||
237 | $this->method = 'taobao.tbk.sc.vegas.tlj.create'; |
||
238 | return $this; |
||
239 | } |
||
240 | |||
241 | /** |
||
242 | * 淘宝客商品展示规则获取 |
||
243 | * @return $this |
||
244 | */ |
||
245 | public function itemRuleGet(): self |
||
246 | { |
||
247 | $this->method = 'qimen.taobao.tbk.item.rule.get'; |
||
248 | return $this; |
||
249 | } |
||
250 | |||
251 | /** |
||
252 | * 淘宝客-推广者-处罚订单查询 |
||
253 | * @return $this |
||
254 | */ |
||
255 | public function dgPunishOrderGet(): self |
||
256 | { |
||
257 | $this->method = 'taobao.tbk.dg.punish.order.get'; |
||
258 | return $this; |
||
259 | } |
||
260 | |||
261 | /** |
||
262 | * 淘宝客-公用-淘口令解析出原链接 |
||
263 | * @return $this |
||
264 | */ |
||
265 | public function tpwdParse(): self |
||
266 | { |
||
267 | $this->method = 'taobao.tbk.tpwd.parse'; |
||
268 | return $this; |
||
269 | } |
||
270 | |||
271 | /** |
||
272 | * 淘宝客-推广者-新用户订单明细查询 |
||
273 | * @return $this |
||
274 | */ |
||
275 | public function dgNewUserOrderGet(): self |
||
276 | { |
||
277 | $this->method = 'taobao.tbk.dg.newuser.order.get'; |
||
278 | return $this; |
||
279 | } |
||
280 | |||
281 | /** |
||
282 | * 淘宝客-服务商-新用户订单明细查询 |
||
283 | * @return $this |
||
284 | */ |
||
285 | public function scNewuserOrderGet(): self |
||
286 | { |
||
287 | $this->method = 'taobao.tbk.sc.newuser.order.get'; |
||
288 | return $this; |
||
289 | } |
||
290 | |||
291 | /** |
||
292 | * 淘宝客-推广者-拉新活动对应数据查询 |
||
293 | * @return $this |
||
294 | */ |
||
295 | public function dgNewUserOrderSum(): self |
||
296 | { |
||
297 | $this->method = 'taobao.tbk.dg.newuser.order.sum'; |
||
298 | return $this; |
||
299 | } |
||
300 | |||
301 | /** |
||
302 | * 超级红包发放个数 - 淘宝客-推广者-查询超级红包发放个数 |
||
303 | * https://open.taobao.com/api.htm?spm=a2e0r.13193907.0.0.210524ad2gvyOW&docId=47593&docType=2 |
||
304 | * @return $this |
||
305 | */ |
||
306 | public function dgVegasSendReport(): self |
||
307 | { |
||
308 | $this->method = 'taobao.tbk.dg.vegas.send.report'; |
||
309 | return $this; |
||
310 | } |
||
311 | |||
312 | /** |
||
313 | * 淘宝客-推广者-官方活动转链 |
||
314 | * @return $this |
||
315 | */ |
||
316 | public function activityInfoGet(): self |
||
317 | { |
||
318 | $this->method = 'taobao.tbk.activity.info.get'; |
||
319 | return $this; |
||
320 | } |
||
321 | |||
322 | /** |
||
323 | * 淘宝客-服务商-官方活动转链 |
||
324 | * @return $this |
||
325 | */ |
||
326 | public function scActivityInfoGet(): self |
||
327 | { |
||
328 | $this->method = 'taobao.tbk.sc.activity.info.get'; |
||
329 | return $this; |
||
330 | } |
||
331 | |||
332 | /** |
||
333 | * 淘宝客-推广者-联盟口令生成 |
||
334 | * @return $this |
||
335 | */ |
||
336 | public function textTpwdCreate(): self |
||
337 | { |
||
338 | $this->method = 'taobao.tbk.text.tpwd.create'; |
||
339 | return $this; |
||
340 | } |
||
341 | |||
342 | /** |
||
343 | * 淘宝客-推广者-官方活动转链(2020.9.30下线) |
||
344 | * @return $this |
||
345 | */ |
||
346 | public function activityLinkGet(): self |
||
347 | { |
||
348 | $this->method = 'taobao.tbk.activitylink.get'; |
||
349 | return $this; |
||
350 | } |
||
351 | |||
352 | /** |
||
353 | * 淘宝客-公用-淘口令生成 |
||
354 | * @return $this |
||
355 | */ |
||
356 | public function tpWdCreate(): self |
||
357 | { |
||
358 | $this->method = 'taobao.tbk.tpwd.create'; |
||
359 | return $this; |
||
360 | } |
||
361 | |||
362 | /** |
||
363 | * 淘宝客-公用-长链转短链 |
||
364 | * @return $this |
||
365 | */ |
||
366 | public function spreadGet(): self |
||
367 | { |
||
368 | $this->method = 'taobao.tbk.spread.get'; |
||
369 | return $this; |
||
370 | } |
||
371 | |||
372 | /** |
||
373 | * 聚划算商品搜索接口 |
||
374 | * https://open.taobao.com/api.htm?docId=28762&docType=2&scopeId=16517 |
||
375 | * @return $this |
||
376 | */ |
||
377 | public function itemsSearch(): self |
||
378 | { |
||
379 | $this->method = 'taobao.ju.items.search'; |
||
380 | return $this; |
||
381 | } |
||
382 | |||
383 | /** |
||
384 | * 淘抢购api(2020.9.30下线) |
||
385 | * @return $this |
||
386 | */ |
||
387 | public function juTqgGet(): self |
||
388 | { |
||
389 | $this->method = 'taobao.tbk.ju.tqg.get'; |
||
390 | return $this; |
||
391 | } |
||
392 | |||
393 | /** |
||
394 | * 淘宝客-推广者-淘礼金创建 |
||
395 | * @return $this |
||
396 | */ |
||
397 | public function dgVegasTljCreate(): self |
||
398 | { |
||
399 | $this->method = 'taobao.tbk.dg.vegas.tlj.create'; |
||
400 | return $this; |
||
401 | } |
||
402 | |||
403 | /** |
||
404 | * 淘宝客-推广者-轻店铺淘口令解析 |
||
405 | * @return $this |
||
406 | */ |
||
407 | public function lightshopTbpswdParse(): self |
||
408 | { |
||
409 | $this->method = 'taobao.tbk.lightshop.tbpswd.parse'; |
||
410 | return $this; |
||
411 | } |
||
412 | |||
413 | /** |
||
414 | * 淘宝客-推广者-淘礼金发放及使用报表 |
||
415 | * @return $this |
||
416 | */ |
||
417 | public function dgVegasTljInstanceReport(): self |
||
418 | { |
||
419 | $this->method = 'taobao.tbk.dg.vegas.tlj.instance.report'; |
||
420 | return $this; |
||
421 | } |
||
422 | |||
423 | /** |
||
424 | * 淘宝客-服务商-手淘群发单 |
||
425 | * @return $this |
||
426 | */ |
||
427 | public function scGroupchatMessageSend(): self |
||
428 | { |
||
429 | $this->method = 'taobao.tbk.sc.groupchat.message.send'; |
||
430 | return $this; |
||
431 | } |
||
432 | |||
433 | /** |
||
434 | * 淘宝客-服务商-手淘群创建 |
||
435 | * @return $this |
||
436 | */ |
||
437 | public function scGroupchatCreate(): self |
||
438 | { |
||
439 | $this->method = 'taobao.tbk.sc.groupchat.create'; |
||
440 | return $this; |
||
441 | } |
||
442 | |||
443 | /** |
||
444 | * 淘宝客-服务商-手淘群查询 |
||
445 | * @return $this |
||
446 | */ |
||
447 | public function scGroupchatGet(): self |
||
448 | { |
||
449 | $this->method = 'taobao.tbk.sc.groupchat.get'; |
||
450 | return $this; |
||
451 | } |
||
452 | |||
453 | /** |
||
454 | * 淘宝客-公用-手淘注册用户判定 |
||
455 | * @return $this |
||
456 | */ |
||
457 | public function tbinfoGet(): self |
||
458 | { |
||
459 | $this->method = 'taobao.tbk.tbinfo.get'; |
||
460 | return $this; |
||
461 | } |
||
462 | |||
463 | /** |
||
464 | * 淘宝客-公用-pid校验 |
||
465 | * @return $this |
||
466 | */ |
||
467 | public function tbkinfoGet(): self |
||
468 | { |
||
469 | $this->method = 'taobao.tbk.tbkinfo.get'; |
||
470 | return $this; |
||
471 | } |
||
472 | |||
473 | /** |
||
474 | * 淘宝客-公用-私域用户邀请码生成 |
||
475 | * @return $this |
||
476 | */ |
||
477 | public function scInvIteCodeGet(): self |
||
478 | { |
||
479 | $this->method = 'taobao.tbk.sc.invitecode.get'; |
||
480 | return $this; |
||
481 | } |
||
482 | |||
483 | /** |
||
484 | * 淘宝客-公用-私域用户备案信息查询 |
||
485 | * @return $this |
||
486 | */ |
||
487 | public function scPublisherInfoGet(): self |
||
488 | { |
||
489 | $this->method = 'taobao.tbk.sc.publisher.info.get'; |
||
490 | return $this; |
||
491 | } |
||
492 | |||
493 | /** |
||
494 | * 淘宝客-公用-私域用户备案 |
||
495 | * @return $this |
||
496 | */ |
||
497 | public function scPublisherInfoSave(): self |
||
498 | { |
||
499 | $this->method = 'taobao.tbk.sc.publisher.info.save'; |
||
500 | return $this; |
||
501 | } |
||
502 | |||
503 | /** |
||
504 | * 淘宝客-公用-淘宝客商品详情查询(简版) |
||
505 | * @return $this |
||
506 | */ |
||
507 | public function itemInfoGet(): self |
||
508 | { |
||
509 | $this->method = 'taobao.tbk.item.info.get'; |
||
510 | return $this; |
||
511 | } |
||
512 | |||
513 | /** |
||
514 | * 淘宝客-公用-阿里妈妈推广券详情查询 |
||
515 | * @return $this |
||
516 | */ |
||
517 | public function couponGet(): self |
||
518 | { |
||
519 | $this->method = 'taobao.tbk.coupon.get'; |
||
520 | return $this; |
||
521 | } |
||
522 | |||
523 | /** |
||
524 | * 淘宝客-推广者-物料搜索 |
||
525 | * @return $this |
||
526 | */ |
||
527 | public function dgMaterialOptional(): self |
||
528 | { |
||
529 | $this->method = 'taobao.tbk.dg.material.optional'; |
||
530 | return $this; |
||
531 | } |
||
532 | |||
533 | /** |
||
534 | * 淘宝客-推广者-店铺搜索 |
||
535 | * @return $this |
||
536 | */ |
||
537 | public function shopGet(): self |
||
538 | { |
||
539 | $this->method = 'taobao.tbk.shop.get'; |
||
540 | return $this; |
||
541 | } |
||
542 | |||
543 | /** |
||
544 | * 淘宝客-推广者-物料精选 |
||
545 | * @return $this |
||
546 | */ |
||
547 | public function dgOpTiUsMaterial(): self |
||
548 | { |
||
549 | $this->method = 'taobao.tbk.dg.optimus.material'; |
||
550 | return $this; |
||
551 | } |
||
552 | |||
553 | /** |
||
554 | * 淘宝客-推广者-图文内容输出(2020.9.30下线) |
||
555 | * @return $this |
||
556 | */ |
||
557 | public function contentGet(): self |
||
558 | { |
||
559 | $this->method = 'taobao.tbk.content.get'; |
||
560 | return $this; |
||
561 | } |
||
562 | |||
563 | /** |
||
564 | * 淘宝客-推广者-图文内容效果数据(2020.9.30下线) |
||
565 | * @return $this |
||
566 | */ |
||
567 | public function contentEffectGet(): self |
||
568 | { |
||
569 | $this->method = 'taobao.tbk.content.effect.get'; |
||
570 | return $this; |
||
571 | } |
||
572 | |||
573 | |||
574 | /** |
||
575 | * 淘宝客-推广者-商品出词 |
||
576 | * @return $this |
||
577 | */ |
||
578 | public function itemWordGet(): self |
||
579 | { |
||
580 | $this->method = 'taobao.tbk.item.word.get'; |
||
581 | return $this; |
||
582 | } |
||
583 | |||
584 | /** |
||
585 | * 淘宝客-推广者-商品链接转换 |
||
586 | * @return $this |
||
587 | */ |
||
588 | public function itemConvert(): self |
||
589 | { |
||
590 | $this->method = 'taobao.tbk.item.convert'; |
||
591 | return $this; |
||
592 | } |
||
593 | |||
594 | /** |
||
595 | * 淘宝客-公用-链接解析出商品id |
||
596 | * @return $this |
||
597 | */ |
||
598 | public function itemClickExtract(): self |
||
599 | { |
||
600 | $this->method = 'taobao.tbk.item.click.extract'; |
||
601 | return $this; |
||
602 | } |
||
603 | |||
604 | /** |
||
605 | * 淘宝客-公用-商品关联推荐(2020.9.30下线) |
||
606 | * @return $this |
||
607 | */ |
||
608 | public function itemRecommendGet(): self |
||
609 | { |
||
610 | $this->method = 'taobao.tbk.item.recommend.get'; |
||
611 | return $this; |
||
612 | } |
||
613 | |||
614 | /** |
||
615 | * 淘宝客-公用-店铺关联推荐 |
||
616 | * @return $this |
||
617 | */ |
||
618 | public function shopRecommendGet(): self |
||
619 | { |
||
620 | $this->method = 'taobao.tbk.shop.recommend.get'; |
||
621 | return $this; |
||
622 | } |
||
623 | |||
624 | /** |
||
625 | * 淘宝客-推广者-选品库宝贝信息(2020.9.30下线) |
||
626 | * @return $this |
||
627 | */ |
||
628 | public function uaTmFavoritesItemGet(): self |
||
629 | { |
||
630 | $this->method = 'taobao.tbk.uatm.favorites.item.get'; |
||
631 | return $this; |
||
632 | } |
||
633 | |||
634 | /** |
||
635 | * 淘宝客-推广者-选品库宝贝列表(2020.9.30下线) |
||
636 | * @return $this |
||
637 | */ |
||
638 | public function uaTmFavoritesGet(): self |
||
639 | { |
||
640 | $this->method = 'taobao.tbk.uatm.favorites.get'; |
||
641 | return $this; |
||
642 | } |
||
643 | |||
644 | /** |
||
645 | * 淘宝客-服务商-官方活动转链(2020.9.30下线) |
||
646 | * @return $this |
||
647 | */ |
||
648 | public function scActivityLinkToolGet(): self |
||
649 | { |
||
650 | $this->method = 'taobao.tbk.sc.activitylink.toolget'; |
||
651 | return $this; |
||
652 | } |
||
653 | |||
654 | /** |
||
655 | * 淘宝客-服务商-处罚订单查询 |
||
656 | * @return $this |
||
657 | */ |
||
658 | public function scPunishOrderGet(): self |
||
659 | { |
||
660 | $this->method = 'taobao.tbk.sc.punish.order.get'; |
||
661 | return $this; |
||
662 | } |
||
663 | |||
664 | /** |
||
665 | * 淘宝客-推广者-创建推广位 |
||
666 | * @return $this |
||
667 | */ |
||
668 | public function adZoneCreate(): self |
||
669 | { |
||
670 | $this->method = 'taobao.tbk.adzone.create'; |
||
671 | return $this; |
||
672 | } |
||
673 | |||
674 | /** |
||
675 | * 淘宝客文本淘口令 |
||
676 | * @return $this |
||
677 | */ |
||
678 | public function tpwdMixCreate(): self |
||
679 | { |
||
680 | $this->method = 'taobao.tbk.tpwd.mix.create'; |
||
681 | return $this; |
||
682 | } |
||
683 | |||
684 | /** |
||
685 | * 淘宝客-推广者-b2c平台用户行为跟踪服务商 |
||
686 | * @return $this |
||
687 | */ |
||
688 | public function traceBtocAddtrace(): self |
||
689 | { |
||
690 | $this->method = 'taobao.tbk.trace.btoc.addtrace'; |
||
691 | return $this; |
||
692 | } |
||
693 | |||
694 | /** |
||
695 | * 淘宝客-推广者-登陆信息跟踪服务商 |
||
696 | * @return $this |
||
697 | */ |
||
698 | public function traceLogininfoAdd(): self |
||
699 | { |
||
700 | $this->method = 'taobao.tbk.trace.logininfo.add'; |
||
701 | return $this; |
||
702 | } |
||
703 | |||
704 | /** |
||
705 | * 淘宝客-推广者-用户行为跟踪服务商 |
||
706 | * @return $this |
||
707 | */ |
||
708 | public function traceShopitemAddtrace(): self |
||
709 | { |
||
710 | $this->method = 'taobao.tbk.trace.shopitem.addtrace'; |
||
711 | return $this; |
||
712 | } |
||
713 | |||
714 | /** |
||
715 | * 淘宝客-推广者-商品三方分成链接转换 |
||
716 | * @return $this |
||
717 | */ |
||
718 | public function itemShareConvert(): self |
||
719 | { |
||
720 | $this->method = 'taobao.tbk.item.share.convert'; |
||
721 | return $this; |
||
722 | } |
||
723 | |||
724 | /** |
||
725 | * 淘宝客-推广者-店铺链接转换 |
||
726 | * @return $this |
||
727 | */ |
||
728 | public function shopConvert(): self |
||
729 | { |
||
730 | $this->method = 'taobao.tbk.shop.convert'; |
||
731 | return $this; |
||
732 | } |
||
733 | |||
734 | /** |
||
735 | * 淘宝客-推广者-店铺三方分成链接转换 |
||
736 | * @return $this |
||
737 | */ |
||
738 | public function shopShareConvert(): self |
||
739 | { |
||
740 | $this->method = 'taobao.tbk.shop.share.convert'; |
||
741 | return $this; |
||
742 | } |
||
743 | |||
744 | /** |
||
745 | * 淘宝客-推广者-返利商家授权查询 |
||
746 | * @return $this |
||
747 | */ |
||
748 | public function rebateAuthGet(): self |
||
749 | { |
||
750 | $this->method = 'taobao.tbk.rebate.auth.get'; |
||
751 | return $this; |
||
752 | } |
||
753 | |||
754 | /** |
||
755 | * 淘宝客-推广者-返利订单查询 |
||
756 | * @return $this |
||
757 | */ |
||
758 | public function rebateOrderGet(): self |
||
759 | { |
||
760 | $this->method = 'taobao.tbk.rebate.order.get'; |
||
761 | return $this; |
||
762 | } |
||
763 | |||
764 | /** |
||
765 | * 淘宝客-推广者-根据宝贝id批量查询优惠券 |
||
766 | * @return $this |
||
767 | */ |
||
768 | public function itemidCouponGet(): self |
||
769 | { |
||
770 | $this->method = 'taobao.tbk.itemid.coupon.get'; |
||
771 | return $this; |
||
772 | } |
||
773 | |||
774 | /** |
||
775 | * 淘宝客-服务商-保护门槛 |
||
776 | * @return $this |
||
777 | */ |
||
778 | public function dataReport(): self |
||
779 | { |
||
780 | $this->method = 'taobao.tbk.data.report'; |
||
781 | return $this; |
||
782 | } |
||
783 | |||
784 | /** |
||
785 | * 淘宝客-推广者-单品券高效转链 |
||
786 | * @return $this |
||
787 | */ |
||
788 | public function couponConvert(): self |
||
789 | { |
||
790 | $this->method = 'taobao.tbk.coupon.convert'; |
||
791 | return $this; |
||
792 | } |
||
793 | |||
794 | /** |
||
795 | * 淘宝客-推广者-淘口令解析&三方分成转链 |
||
796 | * @return $this |
||
797 | */ |
||
798 | public function tpwdShareConvert(): self |
||
799 | { |
||
800 | $this->method = 'taobao.tbk.tpwd.share.convert'; |
||
801 | return $this; |
||
802 | } |
||
803 | |||
804 | /** |
||
805 | * 淘宝客-推广者-淘口令解析&转链 |
||
806 | * @return $this |
||
807 | */ |
||
808 | public function tpwdConvert(): self |
||
809 | { |
||
810 | $this->method = 'taobao.tbk.tpwd.convert'; |
||
811 | return $this; |
||
812 | } |
||
813 | |||
814 | /** |
||
815 | * 淘宝客-服务商-创建推广者位 |
||
816 | * @return $this |
||
817 | */ |
||
818 | public function scAdzoneCreate(): self |
||
819 | { |
||
820 | $this->method = 'taobao.tbk.sc.adzone.create'; |
||
821 | return $this; |
||
822 | } |
||
823 | |||
824 | /** |
||
825 | * 淘宝客-服务商-物料精选 |
||
826 | * @return $this |
||
827 | */ |
||
828 | public function scOptimusMaterial(): self |
||
829 | { |
||
830 | $this->method = 'taobao.tbk.sc.optimus.material'; |
||
831 | return $this; |
||
832 | } |
||
833 | |||
834 | /** |
||
835 | * 淘宝客-服务商-物料搜索 |
||
836 | * @return $this |
||
837 | */ |
||
838 | public function scMaterialOptional(): self |
||
842 | } |
||
843 | |||
844 | /** |
||
845 | * 淘宝客-服务商-拉新活动数据查询 |
||
846 | * @return $this |
||
847 | */ |
||
848 | public function scNewuserOrderSum(): self |
||
849 | { |
||
850 | $this->method = 'taobao.tbk.sc.newuser.order.sum'; |
||
851 | return $this; |
||
852 | } |
||
853 | |||
854 | /** |
||
855 | * 自定义接口 |
||
856 | * @param string $method |
||
857 | * @return $this |
||
858 | */ |
||
859 | public function setMethod($method = ''): self |
||
860 | { |
||
861 | $this->method = $method; |
||
862 | return $this; |
||
863 | } |
||
864 | |||
865 | /** |
||
866 | * 返回Array |
||
867 | * @return array|mixed |
||
868 | * @throws DtaException |
||
869 | */ |
||
870 | public function toArray() |
||
913 | } |
||
914 | |||
915 | /** |
||
916 | * 返回Xml |
||
917 | * @return mixed |
||
918 | * @throws DtaException |
||
919 | */ |
||
920 | public function toXml() |
||
929 | } |
||
930 | |||
931 | /** |
||
932 | * 网络请求 |
||
933 | * @throws DtaException |
||
934 | */ |
||
935 | private function http(): void |
||
936 | { |
||
937 | //生成签名 |
||
938 | $sign = $this->createSign(); |
||
939 | //组织参数 |
||
940 | $strParam = $this->createStrParam(); |
||
941 | $strParam .= 'sign=' . $sign; |
||
942 | //访问服务 |
||
943 | if ($this->protocol === 'http') { |
||
944 | if (empty($this->sandbox)) { |
||
945 | $url = 'http://gw.api.taobao.com/router/rest?' . $strParam; |
||
946 | } else { |
||
947 | $url = 'http://gw.api.tbsandbox.com/router/rest?' . $strParam; |
||
948 | } |
||
949 | } |
||
950 | if ($this->protocol === 'https') { |
||
951 | if (empty($this->sandbox)) { |
||
952 | $url = 'https://eco.taobao.com/router/rest?' . $strParam; |
||
953 | } else { |
||
954 | $url = 'https://gw.api.tbsandbox.com/router/rest?' . $strParam; |
||
955 | } |
||
956 | } |
||
957 | $result = file_get_contents($url); |
||
958 | $result = json_decode($result, true); |
||
959 | $this->output = $result; |
||
960 | } |
||
961 | |||
962 | /** |
||
963 | * 签名 |
||
964 | * @return string |
||
965 | * @throws DtaException |
||
966 | */ |
||
967 | private function createSign(): string |
||
985 | } |
||
986 | |||
987 | /** |
||
988 | * 组参 |
||
989 | * @return string |
||
990 | */ |
||
991 | private function createStrParam(): string |
||
992 | { |
||
993 | $strParam = ''; |
||
994 | foreach ($this->param as $key => $val) { |
||
995 | if ($key !== '' && $val !== '') { |
||
996 | $strParam .= $key . '=' . urlencode($val) . '&'; |
||
997 | } |
||
998 | } |
||
999 | return $strParam; |
||
1000 | } |
||
1001 | |||
1002 | /** |
||
1003 | * 获取活动物料 |
||
1004 | * @return array[] |
||
1005 | */ |
||
1006 | public function getActivityMaterialIdList(): array |
||
1007 | { |
||
1008 | return [ |
||
1009 | [ |
||
1010 | // https://market.m.taobao.com/app/qn/toutiao-new/index-pc.html#/detail/10628646?_k=tcswm1 |
||
1011 | 'name' => '口碑', |
||
1012 | 'list' => [ |
||
1013 | [ |
||
1014 | 'name' => '口碑主会场活动(2.3%佣金起)', |
||
1015 | 'material_id' => 1583739244161 |
||
1016 | ], |
||
1017 | [ |
||
1018 | 'name' => '生活服务分会场活动(2.3%佣金起)', |
||
1019 | 'material_id' => 1583739244162 |
||
1020 | ] |
||
1021 | ] |
||
1022 | ], |
||
1023 | [ |
||
1024 | // https://market.m.taobao.com/app/qn/toutiao-new/index-pc.html#/detail/10628647?_k=hwggf9 |
||
1025 | // https://market.m.taobao.com/app/qn/toutiao-new/index-pc.html#/detail/10630427?_k=sdet4e |
||
1026 | // https://market.m.taobao.com/app/qn/toutiao-new/index-pc.html#/detail/10630361?_k=nq6zgt |
||
1027 | 'name' => '饿了么', |
||
1028 | 'list' => [ |
||
1029 | [ |
||
1030 | 'name' => '聚合页(6%佣金起)', |
||
1031 | 'material_id' => 1571715733668 |
||
1032 | ], |
||
1033 | [ |
||
1034 | 'name' => '新零售(4%佣金起)', |
||
1035 | 'material_id' => 1585018034441 |
||
1036 | ], |
||
1037 | [ |
||
1038 | 'name' => '餐饮', |
||
1039 | 'material_id' => 1579491209717 |
||
1040 | ], |
||
1041 | ] |
||
1042 | ], |
||
1043 | [ |
||
1044 | // https://market.m.taobao.com/app/qn/toutiao-new/index-pc.html#/detail/10634663?_k=zqgq01 |
||
1045 | 'name' => '卡券(饭票)', |
||
1046 | 'list' => [ |
||
1047 | [ |
||
1048 | 'name' => '饿了么卡券(1元以下商品)', |
||
1049 | 'material_id' => 32469 |
||
1050 | ], |
||
1051 | [ |
||
1052 | 'name' => '饿了么卡券投放全网商品库', |
||
1053 | 'material_id' => 32470 |
||
1054 | ], |
||
1055 | [ |
||
1056 | 'name' => '饿了么卡券(5折以下)', |
||
1057 | 'material_id' => 32603 |
||
1058 | ], |
||
1059 | [ |
||
1060 | 'name' => '饿了么头部全国KA商品库', |
||
1061 | 'material_id' => 32663 |
||
1062 | ], |
||
1063 | [ |
||
1064 | 'name' => '饿了么卡券招商爆品库', |
||
1065 | 'material_id' => 32738 |
||
1066 | ], |
||
1067 | ] |
||
1068 | ], |
||
1069 | ]; |
||
1070 | } |
||
1071 | |||
1072 | /** |
||
1073 | * 获取官方物料API汇总 |
||
1074 | * https://market.m.taobao.com/app/qn/toutiao-new/index-pc.html#/detail/10628875?_k=gpov9a |
||
1075 | * @return array |
||
1076 | */ |
||
1077 | public function getMaterialIdList(): array |
||
1477 | ], |
||
1478 | ] |
||
1479 | ], |
||
1480 | ]; |
||
1481 | } |
||
1482 | } |
||
1483 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.