diff --git a/app/controller/api/Coupon.php b/app/controller/api/Coupon.php index bd7372f..4908b6e 100644 --- a/app/controller/api/Coupon.php +++ b/app/controller/api/Coupon.php @@ -315,6 +315,11 @@ class Coupon extends Base return $this->json(4001, "商家已禁用"); } + //如果商家指派了渠道商 分销人重新定义为空 + if ($couponMain->business->is_agency == BusinessModel::COMMON_ON){ + $distributionUserCode = ""; + } + try { //检查优惠券状态 CouponRepository::getInstance()->checkCouponMainReceiveStatus($couponMain); @@ -573,9 +578,9 @@ class Coupon extends Base //开启了分销 覆盖 平台应得金额 和消费者应得金额 并且取消 渠道商打款 if( - $coupon->couponMain->is_distribution == CouponMain::COMMON_ON - && $business->is_assign == BusinessModel::COMMON_OFF + || + (!empty($coupon->distribution_user_code)&&$business->is_assign == BusinessModel::COMMON_ON) ){ $disAdminMoney = (($deductionMoney/100) * $coupon->couponMain->commission_dis_admin); //$disDistributionMoney = (($deductionMoney/100) * $coupon->couponMain->commission_dis_distribution); @@ -650,8 +655,8 @@ class Coupon extends Base $payment = WechatPay::getInstance(); - //5. 渠道商加钱 【关闭了分销 渠道商才能加钱 红包方式直接打款 成功失败不管】 - if($coupon->couponMain->is_is_distribution == CouponMain::COMMON_OFF){ + //5. 渠道商加钱 【只要指派了渠道商 并且没有分销人 渠道商才能加钱 红包方式直接打款 成功失败不管】 + if($business->is_assign == BusinessModel::COMMON_ON && (empty($coupon->distribution_user_code))){ if(isset($business->agency) && $business->agency){ //$business->agency->inc("balance",$agencyMoney)->update(); //6. 用户提现到零钱 写入红包记录