DistributionController.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * 商城 C 端分销接口
  4. * 用途:mallApp 我的分红页
  5. */
  6. namespace mall\controllers;
  7. use bizHd\distribution\classes\DistributionFlowClass;
  8. use bizHd\distribution\classes\DistributionOrderClass;
  9. use bizHd\distribution\classes\DistributionUserClass;
  10. use common\components\util;
  11. use Yii;
  12. class DistributionController extends BaseController
  13. {
  14. /**
  15. * 我的分红汇总
  16. */
  17. public function actionGetMyStat()
  18. {
  19. if (empty($this->customId)) {
  20. util::fail('请先选择花店');
  21. }
  22. try {
  23. $data = DistributionUserClass::getMallMyStat($this->shopId, $this->customId);
  24. util::success($data);
  25. } catch (\Exception $e) {
  26. util::fail($e->getMessage());
  27. }
  28. }
  29. /**
  30. * 分红变动明细
  31. */
  32. public function actionGetFlowList()
  33. {
  34. if (empty($this->customId)) {
  35. util::fail('请先选择花店');
  36. }
  37. try {
  38. $data = DistributionFlowClass::getFlowList($this->shopId, $this->customId);
  39. util::success($data);
  40. } catch (\Exception $e) {
  41. util::fail($e->getMessage());
  42. }
  43. }
  44. /**
  45. * 拉新客户列表(当前登录客户为邀请人)
  46. */
  47. public function actionGetInviteList()
  48. {
  49. if (empty($this->customId)) {
  50. util::fail('请先选择花店');
  51. }
  52. try {
  53. $data = DistributionUserClass::getInviteList($this->shopId, $this->customId);
  54. util::success($data);
  55. } catch (\Exception $e) {
  56. util::fail($e->getMessage());
  57. }
  58. }
  59. /**
  60. * 下线贡献分红明细(xhDistributionOrder)
  61. */
  62. public function actionGetContribOrderList()
  63. {
  64. if (empty($this->customId)) {
  65. util::fail('请先选择花店');
  66. }
  67. $buyerId = (int)Yii::$app->request->get('buyerId', 0);
  68. try {
  69. $data = DistributionOrderClass::getContribOrderList($this->shopId, $this->customId, $buyerId);
  70. util::success($data);
  71. } catch (\Exception $e) {
  72. util::fail($e->getMessage());
  73. }
  74. }
  75. }