123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- namespace JinDouYun\Controller\Commission;
- use JinDouYun\Controller\BaseController;
- use JinDouYun\Model\Commission\MCommissionCalculate;
- use Mall\Framework\Core\ErrorCode;
- class Commission extends BaseController
- {
- private $objMCommissionCalculate;
- /**
- * CommissionCalculate constructor.
- * @param bool $isCheckAcl
- * @param bool $isMustLogin
- * @param bool $checkToken
- * @param bool $getAreaCode
- * @throws \Exception
- */
- public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken = true, $getAreaCode = false)
- {
- parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode);
- $this->objMCommissionCalculate = new MCommissionCalculate($this->onlineEnterpriseId,$this->onlineUserId);
- }
- /**
- * Doc: (des="")
- * User: XMing
- * Date: 2020/7/28
- * Time: 5:52 下午
- * @throws \Exception
- */
- public function createCommission()
- {
- $params = $this->request->getRawJson();
- if(empty($params)){
- parent::sendOutput('参数为空', ErrorCode::$paramError);
- }
- if (!isset($params['orderId']) || empty($params['orderId'])){
- parent::sendOutput('orderId参数为空', ErrorCode::$paramError);
- }
- if (!isset($params['customerId']) || empty($params['customerId'])){
- parent::sendOutput('customerId参数错误', ErrorCode::$paramError);
- }
- $modelResult = $this->objMCommissionCalculate->createCommission($params['customerId'],$params['orderId']);
- if(!$modelResult->isSuccess()){
- parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
- }
- parent::sendOutput($modelResult->getData());
- }
- /**
- * Doc: (des="订单完成将等待入账转移到余额")
- * User: XMing
- * Date: 2020/7/30
- * Time: 6:27 下午
- */
- public function updateBalance()
- {
- $params = $this->request->getRawJson();
- if(empty($params)){
- parent::sendOutput('参数为空', ErrorCode::$paramError);
- }
- if (!isset($params['orderId']) || empty($params['orderId'])){
- parent::sendOutput('orderId参数为空', ErrorCode::$paramError);
- }
- $modelResult = $this->objMCommissionCalculate->updateBalance($params['orderId']);
- if(!$modelResult->isSuccess()){
- parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
- }
- parent::sendOutput($modelResult->getData());
- }
- /**
- * Doc: (des="分销订单取消,扣除待入账")
- * User: XMing
- * Date: 2020/7/31
- * Time: 6:04 下午
- */
- public function cancelSubCommission()
- {
- $params = $this->request->getRawJson();
- if(empty($params)){
- parent::sendOutput('参数为空', ErrorCode::$paramError);
- }
- if (!isset($params['orderId']) || empty($params['orderId'])){
- parent::sendOutput('orderId参数为空', ErrorCode::$paramError);
- }
- $modelResult = $this->objMCommissionCalculate->cancelSubCommission($params['orderId']);
- if(!$modelResult->isSuccess()){
- parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
- }
- parent::sendOutput($modelResult->getData());
- }
- }
|