| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?php
- /**
- * 商城 C 端分销接口
- * 用途:mallApp 我的分红页
- */
- namespace mall\controllers;
- use bizHd\distribution\classes\DistributionDepositClass;
- use bizHd\distribution\classes\DistributionFlowClass;
- use bizHd\distribution\classes\DistributionOrderClass;
- use bizHd\distribution\classes\DistributionUserClass;
- use common\components\util;
- use Yii;
- class DistributionController extends BaseController
- {
- /**
- * 我的分红汇总
- */
- public function actionGetMyStat()
- {
- if (empty($this->customId)) {
- util::fail('请先选择花店');
- }
- try {
- $data = DistributionUserClass::getMallMyStat($this->shopId, $this->customId);
- util::success($data);
- } catch (\Exception $e) {
- util::fail($e->getMessage());
- }
- }
- /**
- * 分红变动明细
- */
- public function actionGetFlowList()
- {
- if (empty($this->customId)) {
- util::fail('请先选择花店');
- }
- try {
- $data = DistributionFlowClass::getFlowList($this->shopId, $this->customId);
- util::success($data);
- } catch (\Exception $e) {
- util::fail($e->getMessage());
- }
- }
- /**
- * 拉新客户列表(当前登录客户为邀请人)
- */
- public function actionGetInviteList()
- {
- if (empty($this->customId)) {
- util::fail('请先选择花店');
- }
- try {
- $data = DistributionUserClass::getInviteList($this->shopId, $this->customId);
- util::success($data);
- } catch (\Exception $e) {
- util::fail($e->getMessage());
- }
- }
- /**
- * 下线贡献分红明细(xhDistributionOrder)
- */
- public function actionGetContribOrderList()
- {
- if (empty($this->customId)) {
- util::fail('请先选择花店');
- }
- $buyerId = (int)Yii::$app->request->get('buyerId', 0);
- try {
- $data = DistributionOrderClass::getContribOrderList($this->shopId, $this->customId, $buyerId);
- util::success($data);
- } catch (\Exception $e) {
- util::fail($e->getMessage());
- }
- }
- /**
- * 可存分红全额存入花店余额
- */
- public function actionDepositAvail()
- {
- if (empty($this->customId)) {
- util::fail('请先选择花店');
- }
- if (empty($this->hdId)) {
- util::fail('花店信息无效');
- }
- try {
- $result = DistributionDepositClass::depositAvailFull(
- (int)$this->shopId,
- (int)$this->mainId,
- (int)$this->hdId,
- (int)$this->customId
- );
- $stat = DistributionUserClass::getMallMyStat($this->shopId, $this->customId);
- util::success(array_merge($result, ['stat' => $stat]));
- } catch (\Exception $e) {
- util::fail($e->getMessage());
- }
- }
- }
|