| Total Complexity | 46 | 
| Total Lines | 620 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
Complex classes like BuyIn 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 BuyIn, and based on these observations, apply Extract Interface, too.
| 1 | <?php | ||
| 8 | class BuyIn extends BaseRequest | ||
| 9 | { | ||
| 10 | /** | ||
| 11 | * 商品定向计划管理. | ||
| 12 | * | ||
| 13 | * @param array $params | ||
| 14 | * | ||
| 15 | * @throws RequestException | ||
| 16 | * @throws InvalidArgumentException | ||
| 17 | * | ||
| 18 | * @return array | ||
| 19 | */ | ||
| 20 | public function orienPlanCtrl(array $params): array | ||
| 21 |     { | ||
| 22 |         return $this->httpPost('buyin/orienPlanCtrl', $params); | ||
| 23 | } | ||
| 24 | |||
| 25 | /** | ||
| 26 | * 商品定向计划查询. | ||
| 27 | * | ||
| 28 | * @param array $params | ||
| 29 | * | ||
| 30 | * @throws InvalidArgumentException | ||
| 31 | * @throws RequestException | ||
| 32 | * | ||
| 33 | * @return array | ||
| 34 | */ | ||
| 35 | public function orienPlanList(array $params): array | ||
| 38 | } | ||
| 39 | |||
| 40 | /** | ||
| 41 | * 向指定定向计划中添加达人. | ||
| 42 | * | ||
| 43 | * @param array $params | ||
| 44 | * | ||
| 45 | * @throws InvalidArgumentException | ||
| 46 | * @throws RequestException | ||
| 47 | * | ||
| 48 | * @return array | ||
| 49 | */ | ||
| 50 | public function orienPlanAuthorsAdd(array $params): array | ||
| 51 |     { | ||
| 52 |         return $this->httpPost('buyin/orienPlanAuthorsAdd', $params); | ||
| 53 | } | ||
| 54 | |||
| 55 | /** | ||
| 56 | * 定向计划达人申请审核. | ||
| 57 | * | ||
| 58 | * @param array $params | ||
| 59 | * | ||
| 60 | * @throws InvalidArgumentException | ||
| 61 | * @throws RequestException | ||
| 62 | * | ||
| 63 | * @return array | ||
| 64 | */ | ||
| 65 | public function orienPlanAudit(array $params): array | ||
| 66 |     { | ||
| 67 |         return $this->httpPost('buyin/orienPlanAudit', $params); | ||
| 68 | } | ||
| 69 | |||
| 70 | /** | ||
| 71 | * 创建/修改商品定向计划. | ||
| 72 | * | ||
| 73 | * @param array $params | ||
| 74 | * | ||
| 75 | * @throws InvalidArgumentException | ||
| 76 | * @throws RequestException | ||
| 77 | * | ||
| 78 | * @return array | ||
| 79 | */ | ||
| 80 | public function createOrUpdateOrienPlan(array $params): array | ||
| 81 |     { | ||
| 82 |         return $this->httpPost('buyin/createOrUpdateOrienPlan', $params); | ||
| 83 | } | ||
| 84 | |||
| 85 | /** | ||
| 86 | * 查询定向计划作者列表. | ||
| 87 | * | ||
| 88 | * @param array $params | ||
| 89 | * | ||
| 90 | * @throws InvalidArgumentException | ||
| 91 | * @throws RequestException | ||
| 92 | * | ||
| 93 | * @return array | ||
| 94 | */ | ||
| 95 | public function orienPlanAuthors(array $params): array | ||
| 96 |     { | ||
| 97 |         return $this->httpPost('buyin/orienPlanAuthors', $params); | ||
| 98 | } | ||
| 99 | |||
| 100 | /** | ||
| 101 | * 团长活动查询接口. | ||
| 102 | * | ||
| 103 | * @param array $params | ||
| 104 | * | ||
| 105 | * @throws InvalidArgumentException | ||
| 106 | * @throws RequestException | ||
| 107 | * | ||
| 108 | * @return array | ||
| 109 | */ | ||
| 110 | public function activitySearch(array $params): array | ||
| 111 |     { | ||
| 112 |         return $this->httpPost('buyin/activitySearch', $params); | ||
| 113 | } | ||
| 114 | |||
| 115 | /** | ||
| 116 | * 商品团长活动提报接口. | ||
| 117 | * | ||
| 118 | * @param array $params | ||
| 119 | * | ||
| 120 | * @throws InvalidArgumentException | ||
| 121 | * @throws RequestException | ||
| 122 | * | ||
| 123 | * @return array | ||
| 124 | */ | ||
| 125 | public function applyActivities(array $params): array | ||
| 128 | } | ||
| 129 | |||
| 130 | /** | ||
| 131 | * 创建/修改商品专属推广计划. | ||
| 132 | * | ||
| 133 | * @param array $params | ||
| 134 | * | ||
| 135 | * @throws InvalidArgumentException | ||
| 136 | * @throws RequestException | ||
| 137 | * | ||
| 138 | * @return array | ||
| 139 | */ | ||
| 140 | public function exclusivePlan(array $params): array | ||
| 143 | } | ||
| 144 | |||
| 145 | /** | ||
| 146 | * 创建/修改普通商品推广计划. | ||
| 147 | * | ||
| 148 | * @param array $params | ||
| 149 | * | ||
| 150 | * @throws InvalidArgumentException | ||
| 151 | * @throws RequestException | ||
| 152 | * | ||
| 153 | * @return array | ||
| 154 | */ | ||
| 155 | public function simplePlan(array $params): array | ||
| 158 | } | ||
| 159 | |||
| 160 | /** | ||
| 161 | * 机构查询达人直播间分销订单. | ||
| 162 | * | ||
| 163 | * @param array $params | ||
| 164 | * | ||
| 165 | * @throws InvalidArgumentException | ||
| 166 | * @throws RequestException | ||
| 167 | * | ||
| 168 | * @return array | ||
| 169 | */ | ||
| 170 | public function instituteOrderAds(array $params): array | ||
| 173 | } | ||
| 174 | |||
| 175 | /** | ||
| 176 | * 商品状态查询. | ||
| 177 | * | ||
| 178 | * @param array $params | ||
| 179 | * @return array | ||
| 180 | * @throws InvalidArgumentException | ||
| 181 | * @throws RequestException | ||
| 182 | */ | ||
| 183 | public function materialsProductStatus(array $params): array | ||
| 184 |     { | ||
| 185 |         return $this->httpPost('buyin/materialsProductStatus', $params); | ||
| 186 | } | ||
| 187 | |||
| 188 | /** | ||
| 189 | * 查询机构联盟订单. | ||
| 190 | * | ||
| 191 | * @param array $params | ||
| 192 | * @return array | ||
| 193 | * @throws InvalidArgumentException | ||
| 194 | * @throws RequestException | ||
| 195 | */ | ||
| 196 | public function queryInstituteOrders(array $params): array | ||
| 197 |     { | ||
| 198 |         return $this->httpPost('buyin/queryInstituteOrders', $params); | ||
| 199 | } | ||
| 200 | |||
| 201 | /** | ||
| 202 | * 达人PID创建. | ||
| 203 | * | ||
| 204 | * @param array $params | ||
| 205 | * @return array | ||
| 206 | * @throws InvalidArgumentException | ||
| 207 | * @throws RequestException | ||
| 208 | */ | ||
| 209 | public function kolPidCreate(array $params): array | ||
| 210 |     { | ||
| 211 |         return $this->httpPost('buyin/kolPidCreate', $params); | ||
| 212 | } | ||
| 213 | |||
| 214 | /** | ||
| 215 | * 达人PID查询接口. | ||
| 216 | * | ||
| 217 | * @param array $params | ||
| 218 | * @return array | ||
| 219 | * @throws InvalidArgumentException | ||
| 220 | * @throws RequestException | ||
| 221 | */ | ||
| 222 | public function kolPidList(array $params): array | ||
| 223 |     { | ||
| 224 |         return $this->httpPost('buyin/kolPidList', $params); | ||
| 225 | } | ||
| 226 | |||
| 227 | /** | ||
| 228 | * 达人PID 编辑. | ||
| 229 | * | ||
| 230 | * @param array $params | ||
| 231 | * @return array | ||
| 232 | * @throws InvalidArgumentException | ||
| 233 | * @throws RequestException | ||
| 234 | */ | ||
| 235 | public function kolPidEdit(array $params): array | ||
| 236 |     { | ||
| 237 |         return $this->httpPost('buyin/kolPidEdit', $params); | ||
| 238 | } | ||
| 239 | |||
| 240 | /** | ||
| 241 | * 达人PID删除. | ||
| 242 | * | ||
| 243 | * @param array $params | ||
| 244 | * @return array | ||
| 245 | * @throws InvalidArgumentException | ||
| 246 | * @throws RequestException | ||
| 247 | */ | ||
| 248 | public function kolPidDel(array $params): array | ||
| 249 |     { | ||
| 250 |         return $this->httpPost('buyin/kolPidDel', $params); | ||
| 251 | } | ||
| 252 | |||
| 253 | /** | ||
| 254 | * 商品分销转链. | ||
| 255 | * | ||
| 256 | * @param array $params | ||
| 257 | * @return array | ||
| 258 | * @throws InvalidArgumentException | ||
| 259 | * @throws RequestException | ||
| 260 | */ | ||
| 261 | public function kolProductShare(array $params): array | ||
| 262 |     { | ||
| 263 |         return $this->httpPost('buyin/kolProductShare', $params); | ||
| 264 | } | ||
| 265 | |||
| 266 | /** | ||
| 267 | * 机构PID创建. | ||
| 268 | * | ||
| 269 | * @param array $params | ||
| 270 | * @return array | ||
| 271 | * @throws InvalidArgumentException | ||
| 272 | * @throws RequestException | ||
| 273 | */ | ||
| 274 | public function institutePidCreate(array $params): array | ||
| 275 |     { | ||
| 276 |         return $this->httpPost('buyin/institutePidCreate', $params); | ||
| 277 | } | ||
| 278 | |||
| 279 | /** | ||
| 280 | * 机构PID 编辑. | ||
| 281 | * | ||
| 282 | * @param array $params | ||
| 283 | * @return array | ||
| 284 | * @throws InvalidArgumentException | ||
| 285 | * @throws RequestException | ||
| 286 | */ | ||
| 287 | public function institutePidEdit(array $params): array | ||
| 288 |     { | ||
| 289 |         return $this->httpPost('buyin/institutePidEdit', $params); | ||
| 290 | } | ||
| 291 | |||
| 292 | /** | ||
| 293 | * 机构PID删除. | ||
| 294 | * | ||
| 295 | * @param array $params | ||
| 296 | * @return array | ||
| 297 | * @throws InvalidArgumentException | ||
| 298 | * @throws RequestException | ||
| 299 | */ | ||
| 300 | public function institutePidDel(array $params): array | ||
| 301 |     { | ||
| 302 |         return $this->httpPost('buyin/institutePidDel', $params); | ||
| 303 | } | ||
| 304 | |||
| 305 | /** | ||
| 306 | * 直播间分销物料查询. | ||
| 307 | * | ||
| 308 | * @param array $params | ||
| 309 | * @return array | ||
| 310 | * @throws InvalidArgumentException | ||
| 311 | * @throws RequestException | ||
| 312 | */ | ||
| 313 | public function liveShareMaterial(array $params): array | ||
| 314 |     { | ||
| 315 |         return $this->httpPost('buyin/liveShareMaterial', $params); | ||
| 316 | } | ||
| 317 | |||
| 318 | /** | ||
| 319 | * 机构获取达人直播间分享链接. | ||
| 320 | * | ||
| 321 | * @param array $params | ||
| 322 | * @return array | ||
| 323 | * @throws InvalidArgumentException | ||
| 324 | * @throws RequestException | ||
| 325 | */ | ||
| 326 | public function instituteLiveShare(array $params): array | ||
| 327 |     { | ||
| 328 |         return $this->httpPost('buyin/instituteLiveShare', $params); | ||
| 329 | } | ||
| 330 | |||
| 331 | /** | ||
| 332 | * 机构PID查询接口. | ||
| 333 | * | ||
| 334 | * @param array $params | ||
| 335 | * @return array | ||
| 336 | * @throws InvalidArgumentException | ||
| 337 | * @throws RequestException | ||
| 338 | */ | ||
| 339 | public function institutePidList(array $params): array | ||
| 340 |     { | ||
| 341 |         return $this->httpPost('buyin/institutePidList', $params); | ||
| 342 | } | ||
| 343 | |||
| 344 | /** | ||
| 345 | * 查询达人直播间分销订单. | ||
| 346 | * | ||
| 347 | * @param array $params | ||
| 348 | * @return array | ||
| 349 | * @throws InvalidArgumentException | ||
| 350 | * @throws RequestException | ||
| 351 | */ | ||
| 352 | public function kolOrderAds(array $params): array | ||
| 355 | } | ||
| 356 | |||
| 357 | /** | ||
| 358 | * 查询机构下团长活动特殊申请. | ||
| 359 | * | ||
| 360 | * @param array $params | ||
| 361 | * @return array | ||
| 362 | * @throws InvalidArgumentException | ||
| 363 | * @throws RequestException | ||
| 364 | */ | ||
| 365 | public function specialApplyList(array $params): array | ||
| 366 |     { | ||
| 367 |         return $this->httpPost('buyin/colonel/specialApplyList', $params); | ||
| 368 | } | ||
| 369 | |||
| 370 | /** | ||
| 371 | * 团长活动特殊申请审核. | ||
| 372 | * | ||
| 373 | * @param array $params | ||
| 374 | * @return array | ||
| 375 | * @throws InvalidArgumentException | ||
| 376 | * @throws RequestException | ||
| 377 | */ | ||
| 378 | public function specialApplyDeal(array $params): array | ||
| 379 |     { | ||
| 380 |         return $this->httpPost('buyin/colonel/specialApplyDeal', $params); | ||
| 381 | } | ||
| 382 | |||
| 383 | /** | ||
| 384 | * 查询达人视角商品详情. | ||
| 385 | * | ||
| 386 | * @param array $params | ||
| 387 | * @return array | ||
| 388 | * @throws InvalidArgumentException | ||
| 389 | * @throws RequestException | ||
| 390 | */ | ||
| 391 | public function kolMaterialsProductsDetails(array $params): array | ||
| 394 | } | ||
| 395 | |||
| 396 | /** | ||
| 397 | * 查询机构联盟MCN机构订单. | ||
| 398 | * | ||
| 399 | * @param array $params | ||
| 400 | * @return array | ||
| 401 | * @throws InvalidArgumentException | ||
| 402 | * @throws RequestException | ||
| 403 | */ | ||
| 404 | public function instituteOrderMCN(array $params): array | ||
| 405 |     { | ||
| 406 |         return $this->httpPost('buyin/instituteOrderMCN', $params); | ||
| 407 | } | ||
| 408 | |||
| 409 | /** | ||
| 410 | * 机构查询团长订单. | ||
| 411 | * | ||
| 412 | * @param array $params | ||
| 413 | * @return array | ||
| 414 | * @throws InvalidArgumentException | ||
| 415 | * @throws RequestException | ||
| 416 | */ | ||
| 417 | public function instituteOrderColonel(array $params): array | ||
| 420 | } | ||
| 421 | |||
| 422 | /** | ||
| 423 | * 店铺会员绑定渠道关系创建. | ||
| 424 | * | ||
| 425 | * @param array $params | ||
| 426 | * @return array | ||
| 427 | * @throws InvalidArgumentException | ||
| 428 | * @throws RequestException | ||
| 429 | */ | ||
| 430 | public function shopPidMemberCreate(array $params): array | ||
| 431 |     { | ||
| 432 |         return $this->httpPost('buyin/shopPidMemberCreate', $params); | ||
| 433 | } | ||
| 434 | |||
| 435 | /** | ||
| 436 | * 查询商品 SKU. | ||
| 437 | * | ||
| 438 | * @param array $params | ||
| 439 | * @return array | ||
| 440 | * @throws InvalidArgumentException | ||
| 441 | * @throws RequestException | ||
| 442 | */ | ||
| 443 | public function productSkus(array $params): array | ||
| 444 |     { | ||
| 445 |         return $this->httpPost('buyin/productSkus', $params); | ||
| 446 | } | ||
| 447 | |||
| 448 | /** | ||
| 449 | * 商家可参与的团长活动查询接口. | ||
| 450 | * | ||
| 451 | * @param array $params | ||
| 452 | * @return array | ||
| 453 | * @throws InvalidArgumentException | ||
| 454 | * @throws RequestException | ||
| 455 | */ | ||
| 456 | public function shopActivityList(array $params): array | ||
| 457 |     { | ||
| 458 |         return $this->httpPost('buyin/ShopActivityList', $params); | ||
| 459 | } | ||
| 460 | |||
| 461 | /** | ||
| 462 | * 延长推广待处理/已处理记录查询. | ||
| 463 | * | ||
| 464 | * @param array $params | ||
| 465 | * @return array | ||
| 466 | * @throws InvalidArgumentException | ||
| 467 | * @throws RequestException | ||
| 468 | */ | ||
| 469 | public function activityProductExtendList(array $params): array | ||
| 470 |     { | ||
| 471 |         return $this->httpPost('buyin/activityProductExtendList', $params); | ||
| 472 | } | ||
| 473 | |||
| 474 | /** | ||
| 475 | * 商家处理团长活动商品的推广延期申请. | ||
| 476 | * | ||
| 477 | * @param array $params | ||
| 478 | * @return array | ||
| 479 | * @throws InvalidArgumentException | ||
| 480 | * @throws RequestException | ||
| 481 | */ | ||
| 482 | public function activityProductExtendApprove(array $params): array | ||
| 483 |     { | ||
| 484 |         return $this->httpPost('buyin/activityProductExtendApprove', $params); | ||
| 485 | } | ||
| 486 | |||
| 487 | /** | ||
| 488 | * 团长可参与的二级团长活动查询接口. | ||
| 489 | * | ||
| 490 | * @param array $params | ||
| 491 | * @return array | ||
| 492 | * @throws InvalidArgumentException | ||
| 493 | * @throws RequestException | ||
| 494 | */ | ||
| 495 | public function originColonelEnrollableActivityList(array $params): array | ||
| 496 |     { | ||
| 497 |         return $this->httpPost('buyin/originColonelEnrollableActivityList', $params); | ||
| 498 | } | ||
| 499 | |||
| 500 | /** | ||
| 501 | * 获取团长活动详情. | ||
| 502 | * | ||
| 503 | * @param array $params | ||
| 504 | * @return array | ||
| 505 | * @throws InvalidArgumentException | ||
| 506 | * @throws RequestException | ||
| 507 | */ | ||
| 508 | public function colonelActivityDetail(array $params): array | ||
| 509 |     { | ||
| 510 |         return $this->httpPost('buyin/colonelActivityDetail', $params); | ||
| 511 | } | ||
| 512 | |||
| 513 | /** | ||
| 514 | * 团长获取可提报二级团长活动的商品列表. | ||
| 515 | * | ||
| 516 | * @param array $params | ||
| 517 | * @return array | ||
| 518 | * @throws InvalidArgumentException | ||
| 519 | * @throws RequestException | ||
| 520 | */ | ||
| 521 | public function originColonelUnappliedProductList(array $params): array | ||
| 522 |     { | ||
| 523 |         return $this->httpPost('buyin/originColonelUnappliedProductList', $params); | ||
| 524 | } | ||
| 525 | |||
| 526 | /** | ||
| 527 | * 团长报名二级团长活动. | ||
| 528 | * | ||
| 529 | * @param array $params | ||
| 530 | * @return array | ||
| 531 | * @throws InvalidArgumentException | ||
| 532 | * @throws RequestException | ||
| 533 | */ | ||
| 534 | public function originColonelApplyActivities(array $params): array | ||
| 537 | } | ||
| 538 | |||
| 539 | /** | ||
| 540 | * 商品选品来源转链. | ||
| 541 | * | ||
| 542 | * @param array $params | ||
| 543 | * @return array | ||
| 544 | * @throws InvalidArgumentException | ||
| 545 | * @throws RequestException | ||
| 546 | */ | ||
| 547 | public function instPickSourceConvert(array $params): array | ||
| 548 |     { | ||
| 549 |         return $this->httpPost('buyin/instPickSourceConvert', $params); | ||
| 550 | } | ||
| 551 | |||
| 552 | /** | ||
| 553 | * 机构选品GMV查询接口. | ||
| 554 | * | ||
| 555 | * @param array $params | ||
| 556 | * @return array | ||
| 557 | * @throws InvalidArgumentException | ||
| 558 | * @throws RequestException | ||
| 559 | */ | ||
| 560 | public function instGmv(array $params): array | ||
| 563 | } | ||
| 564 | |||
| 565 | /** | ||
| 566 | * 机构选品GMV明细查询接口. | ||
| 567 | * | ||
| 568 | * @param array $params | ||
| 569 | * @return array | ||
| 570 | * @throws InvalidArgumentException | ||
| 571 | * @throws RequestException | ||
| 572 | */ | ||
| 573 | public function instGmvDetail(array $params): array | ||
| 576 | } | ||
| 577 | |||
| 578 | /** | ||
| 579 | * 分销直播间商品列表. | ||
| 580 | * | ||
| 581 | * @param array $params | ||
| 582 | * @return array | ||
| 583 | * @throws InvalidArgumentException | ||
| 584 | * @throws RequestException | ||
| 585 | */ | ||
| 586 | public function distributionLiveProductList(array $params): array | ||
| 589 | } | ||
| 590 | |||
| 591 | /** | ||
| 592 | * 商品口令转商品解析. | ||
| 593 | * | ||
| 594 | * @param array $params | ||
| 595 | * @return array | ||
| 596 | * @throws InvalidArgumentException | ||
| 597 | * @throws RequestException | ||
| 598 | */ | ||
| 599 | public function shareCommandParse(array $params): array | ||
| 600 |     { | ||
| 601 |         return $this->httpPost('buyin/shareCommandParse', $params); | ||
| 602 | } | ||
| 603 | |||
| 604 | /** | ||
| 605 | * 检索精选联盟商品,需达人授权. | ||
| 606 | * | ||
| 607 | * @param array $params | ||
| 608 | * @return array | ||
| 609 | * @throws InvalidArgumentException | ||
| 610 | * @throws RequestException | ||
| 611 | */ | ||
| 612 | public function kolMaterialsProductsSearch(array $params): array | ||
| 613 |     { | ||
| 614 |         return $this->httpPost('buyin/kolMaterialsProductsSearch', $params); | ||
| 615 | } | ||
| 616 | |||
| 617 | /** | ||
| 618 | * 获取达人直播间分享链接. | ||
| 619 | * | ||
| 620 | * @param array $params | ||
| 621 | * @return array | ||
| 622 | * @throws InvalidArgumentException | ||
| 623 | * @throws RequestException | ||
| 624 | */ | ||
| 625 | public function kolLiveShare(array $params): array | ||
| 628 | } | ||
| 629 | } | ||
| 630 |