From 49865c21a4ec83f6ff1b7a79bee55e091546643a Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Mon, 28 Mar 2022 20:17:16 +0800 Subject: [PATCH] setter --- app/controller/api/Coupon.php | 76 ++++++++++++++----------------- app/controller/manager/Coupon.php | 24 +++++----- 2 files changed, 47 insertions(+), 53 deletions(-) diff --git a/app/controller/api/Coupon.php b/app/controller/api/Coupon.php index b2b43bd..ed849a0 100644 --- a/app/controller/api/Coupon.php +++ b/app/controller/api/Coupon.php @@ -939,52 +939,46 @@ class Coupon extends Base $totalMoney = $couponMain['deduction_money'] * $couponMain['count']; //如果开启了分销 - //if($couponMain["is_distribution"] == CouponMain::COMMON_ON){ - - if($couponMain['commission_dis_distributed'] < $couponMain['commission_dis_distribution']){ - //检测 【核销分销者】部分是否最少0.3元 - $distributedMoney = ($couponMain['commission_dis_distributed'] / 100) * $couponMain['deduction_money']; - if ($distributedMoney != 0 && $distributedMoney < CouponMain::min_redpack_money) { - return $this->json(4002, - "扣除金额最低" - . (CouponMain::min_redpack_money * (100 / ($couponMain['commission_dis_distributed']))) - . "元"); - } - }else{ - //检测 【领券分销者】部分是否最少0.3元 - $distributionMoney = ($couponMain['commission_dis_distribution'] / 100) * $couponMain['deduction_money']; - if ($distributionMoney != 0 && $distributionMoney < CouponMain::min_redpack_money) { - return $this->json(4002, - "扣除金额最低" - . (CouponMain::min_redpack_money * (100 / ($couponMain['commission_dis_distribution']))) - . "元"); - } + //if($couponMain['commission_dis_distributed'] < $couponMain['commission_dis_distribution']){ + //检测 【核销分销者】部分是否最少0.3元 + $distributedMoney = ($couponMain['commission_dis_distributed'] / 100) * $couponMain['deduction_money']; + if ($distributedMoney != 0 && $distributedMoney < CouponMain::min_redpack_money) { + return $this->json(4002, + "扣除金额最低" + . (CouponMain::min_redpack_money * (100 / ($couponMain['commission_dis_distributed']))) + . "元"); } - - //}else{ - - if($couponMain['commission_consumer'] < $couponMain['commission_agency']){ - //检测 【消费者】部分是否最少0.3元 - $consumerMoney = ($couponMain['commission_consumer']/100) * $couponMain['deduction_money']; - if ($consumerMoney != 0 && $consumerMoney < CouponMain::min_redpack_money) { - return $this->json(4002, - "扣除金额最低" - . (CouponMain::min_redpack_money * (100 / ($couponMain['commission_consumer']))) - . "元"); - } - }else{ - //检测 【渠道商】部分是否最少0.3元 - $agencyMoney = ($couponMain['commission_agency']/100) * $couponMain['deduction_money']; - if ($agencyMoney != 0 && $agencyMoney < CouponMain::min_redpack_money) { - return $this->json(4002, - "扣除金额最低" - . (CouponMain::min_redpack_money * (100 / ($couponMain['commission_agency']))) - . "元"); - } + //检测 【领券分销者】部分是否最少0.3元 + $distributionMoney = ($couponMain['commission_dis_distribution'] / 100) * $couponMain['deduction_money']; + if ($distributionMoney != 0 && $distributionMoney < CouponMain::min_redpack_money) { + return $this->json(4002, + "扣除金额最低" + . (CouponMain::min_redpack_money * (100 / ($couponMain['commission_dis_distribution']))) + . "元"); } + //} + + //if($couponMain['commission_consumer'] < $couponMain['commission_agency']){ + //检测 【消费者】部分是否最少0.3元 + $consumerMoney = ($couponMain['commission_consumer']/100) * $couponMain['deduction_money']; + if ($consumerMoney != 0 && $consumerMoney < CouponMain::min_redpack_money) { + return $this->json(4002, + "扣除金额最低" + . (CouponMain::min_redpack_money * (100 / ($couponMain['commission_consumer']))) + . "元"); + } + //}else{ + //检测 【渠道商】部分是否最少0.3元 + $agencyMoney = ($couponMain['commission_agency']/100) * $couponMain['deduction_money']; + if ($agencyMoney != 0 && $agencyMoney < CouponMain::min_redpack_money) { + return $this->json(4002, + "扣除金额最低" + . (CouponMain::min_redpack_money * (100 / ($couponMain['commission_agency']))) + . "元"); + } //} diff --git a/app/controller/manager/Coupon.php b/app/controller/manager/Coupon.php index 85b8b17..03b8fe2 100644 --- a/app/controller/manager/Coupon.php +++ b/app/controller/manager/Coupon.php @@ -255,7 +255,7 @@ class Coupon extends Base } } - if($data['commission_dis_distribution'] < $data['commission_dis_distributed']){ + //if($data['commission_dis_distribution'] < $data['commission_dis_distributed']){ //检测【分销者】部分是否最少0.3元 $distributionMoney = ($data['commission_dis_distribution'] / 100) * $data['deduction_money']; if ($distributionMoney != 0 && $distributionMoney < CouponMain::min_redpack_money) { @@ -266,7 +266,7 @@ class Coupon extends Base (CouponMain::min_redpack_money * (100 / ($data['commission_dis_distribution']))) . "元"); } - }else{ + //}else{ //检测【核销分销者】部分是否最少0.3元 $distributedMoney = ($data['commission_dis_distributed'] / 100) * $data['deduction_money']; if ($distributedMoney != 0 && $distributedMoney < CouponMain::min_redpack_money) { @@ -277,11 +277,11 @@ class Coupon extends Base (CouponMain::min_redpack_money * (100 / ($data['commission_dis_distributed']))) . "元"); } - } + //} - if($data['commission_agency'] < $data['commission_consumer']){ + //if($data['commission_agency'] < $data['commission_consumer']){ //检测【渠道商】部分是否最少0.3元 $agencyMoney = ($data['commission_agency'] / 100) * $data['deduction_money']; if ($agencyMoney != 0 && $agencyMoney < CouponMain::min_redpack_money) { @@ -292,7 +292,7 @@ class Coupon extends Base (CouponMain::min_redpack_money * (100 / ($data['commission_agency']))) . "元"); } - }else{ + //}else{ //检测【消费者】部分是否最少0.3元 $consumerMoney = ($data['commission_consumer'] / 100) * $data['deduction_money']; if ($consumerMoney != 0 && $consumerMoney < CouponMain::min_redpack_money) { @@ -303,7 +303,7 @@ class Coupon extends Base (CouponMain::min_redpack_money * (100 / ($data['commission_consumer']))) . "元"); } - } + //} @@ -423,7 +423,7 @@ class Coupon extends Base return $this->json(5002, "商家没有指派渠道商,不能关闭分销"); } } - if($data['commission_dis_distribution'] < $data['commission_dis_distributed']){ + //if($data['commission_dis_distribution'] < $data['commission_dis_distributed']){ //检测【领券分销者】部分是否最少0.3元 $distributionMoney = ($data['commission_dis_distribution']/100) * $couponMain['deduction_money']; if ($distributionMoney != 0 && $distributionMoney < CouponMain::min_redpack_money) { @@ -435,7 +435,7 @@ class Coupon extends Base . "%" ); } - }else{ + //}else{ //检测【核销分销者】部分是否最少0.3元 $distributedMoney = ($data['commission_dis_distributed']/100) * $couponMain['deduction_money']; if ($distributedMoney != 0 && $distributedMoney < CouponMain::min_redpack_money) { @@ -446,11 +446,11 @@ class Coupon extends Base (round((CouponMain::min_redpack_money / ($data['deduction_money'])) * 100, 2)) . "%"); } - } + //} - if($data['commission_consumer'] < $data['commission_agency']){ + //if($data['commission_consumer'] < $data['commission_agency']){ //检测 【消费者】部分是否最少0.3元 $consumerMoney = ($data['commission_consumer']/100) * $couponMain['deduction_money']; if ($consumerMoney != 0 && $consumerMoney < CouponMain::min_redpack_money) { @@ -461,7 +461,7 @@ class Coupon extends Base (round((CouponMain::min_redpack_money / ($couponMain['deduction_money'])) * 100, 2)) . "%"); } - }else{ + //}else{ //检测 【渠道商】部分是否最少0.3元 $agencyMoney = ($data['commission_agency']/100) * $couponMain['deduction_money']; if ($agencyMoney != 0 && $agencyMoney < CouponMain::min_redpack_money) { @@ -472,7 +472,7 @@ class Coupon extends Base (round((CouponMain::min_redpack_money / ($couponMain['deduction_money'])) * 100, 2)) . "%"); } - } + //}