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