From 7f330fe4f21ab7e7abdad59949c80c7deb420fcd Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Fri, 4 Dec 2020 16:30:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/common/model/Orders.php | 27 ++++++----------- hyhproject/home/controller/Index.php | 43 +--------------------------- 2 files changed, 10 insertions(+), 60 deletions(-) diff --git a/hyhproject/common/model/Orders.php b/hyhproject/common/model/Orders.php index 2caafa5..a3ce5fe 100755 --- a/hyhproject/common/model/Orders.php +++ b/hyhproject/common/model/Orders.php @@ -1519,7 +1519,7 @@ class Orders extends Base{ $vm = new UserVouchers(); - $zgSwipeUseReal = boolval(dataConf('zgSwipeUseReal')); + $zgSwipeUseReal = dataConf('zgSwipeUseReal') != 0; $zgSwipeUnless = floatval(dataConf('zgSwipeUnless')); $zgSwipeToLevel = (int)$order['helpUserLevel']; // 确认是否滑动 @@ -1559,27 +1559,18 @@ class Orders extends Base{ $totalMoney = $order['realTotalMoney'];//产品额 $buyerPreProductNum = $buyerPreProductNum > $totalMoney ? $totalMoney : $buyerPreProductNum; // 10.15添加:助购户的 助购预获 减少的同时 代快付值等额减少 - if ((int)$order["helpUserLevel"] === 1) { - Db::name("orders")->where(compact('orderId'))->update([ - "helpGetCount"=>$buyerPreProductNum, - "helpGetCount2"=>$calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100), - ]);} - else { - Db::name("orders")->where(compact('orderId'))->update([ - "helpGetCount"=>$buyerPreProductNum*((int)$order["helpUserLevel"])*(float)dataConf("helpSaleCalBase"), - "helpGetCount2"=>$calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100), - ]); + if ($order["helpUserLevel"] > 1) { + $buyerPreProductNum = $buyerPreProductNum*((int)$order["helpUserLevel"])*(float)dataConf("helpSaleCalBase"); } + Db::name("orders")->where(compact('orderId'))->update([ + "helpGetCount"=>$buyerPreProductNum, + "helpGetCount2"=>$calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100), + ]); + // step 5 平台送自己:10000×N“助购预获”, // 10000“预获产品券”; // 10000×0.4×0.5×0.5=1000“预获优惠券”。 - if ((int)$order["helpUserLevel"] === 1) { - $vm->insertHelpSaleNotice($userId, $orderId, $buyerPreProductNum, - '订单【'.$order['orderNo'].'】购户购物所得', 1); - } else { - $vm->insertHelpSaleNotice($userId, $orderId, $buyerPreProductNum*((int)$order["helpUserLevel"])*(float)dataConf("helpSaleCalBase"), - '订单【'.$order['orderNo'].'】购户购物所得', 1); - } + $vm->insertHelpSaleNotice($userId, $orderId, $buyerPreProductNum, '订单【'.$order['orderNo'].'】购户购物所得', 1); // step 8 平台送自己的上第N层:扣减“助购预获”、“预获产品券”各10000×0.4×0.5=2000, // 同时添加10000×0.4×0.5=2000“已获产品券”。 diff --git a/hyhproject/home/controller/Index.php b/hyhproject/home/controller/Index.php index 4540b25..9b2746e 100755 --- a/hyhproject/home/controller/Index.php +++ b/hyhproject/home/controller/Index.php @@ -8,48 +8,7 @@ class Index extends Base{ protected $beforeActionList = [ 'checkAuth' => ['only'=>'getsysmessages'] ]; - public function index(){ - $pay['needPay'] =200; - $userId=1;//$this->getUserId() - //产品券 - $buyerMaxProductScale = round(dataConf('buyerMaxProductScale')*0.01,2); - $pay['maxProduct'] = $pay['needPay'] * $buyerMaxProductScale;//最大可用产品券 - $pay['productHandlingFee'] = round(dataConf('useHasHandlingFee')*0.01,2);//产品券手续费 - $pay['productTaxFee'] = round(dataConf('useHasTaxFee')*0.01,2);//产品券税费 - $pay['maxAllProduct'] = $this->getMaxNum($pay['maxProduct'],(1-$pay['productHandlingFee']-$pay['productTaxFee'] ));//加上手续费,税费最多扣除产品券 - - //优惠券 - $pay['maxCoupons'] = $pay['needPay'] - $pay['maxProduct'] ;//最大可用其他券,优惠券+旺旺券+现金券 - $pay['coupousHandlingFee'] = round(dataConf('useHasHandlingFee')*0.01,2);//优惠券手续费 - $pay['coupousTaxFee'] = round(dataConf('useHasTaxFee')*0.01,2);//优惠券税费 - $pay['maxAllCoupons'] = $this->getMaxNum($pay['maxCoupons'],(1-$pay['coupousHandlingFee']-$pay['coupousTaxFee'] ));//加上手续费,税费最多扣除优惠券 - - $pay['money']['useMoney'] = 0; - $pay['wang']['useWang'] = 0; - //实际应用最大的产品券 - $userInfo = getUserInfo(['userId'=>$userId],'couponsNum,productNum,wangNum'); - $pay['product']['useProduct'] = $userInfo['productNum'] >= $pay['maxAllProduct'] ? $pay['maxAllProduct'] : $userInfo['productNum']; - $pay['product']['useProductHandlingFee'] = $pay['product']['useProduct'] * $pay['productHandlingFee'];//产品券手续费 - $pay['product']['useProductTaxFee'] = $pay['product']['useProduct'] * $pay['productTaxFee']; - $pay['product']['useProductOk'] = $pay['product']['useProduct'] - $pay['product']['useProductHandlingFee'] - $pay['product']['useProductTaxFee']; - - //实际应用最大的优惠券 - $pay['coupons']['useCoupons'] = $userInfo['couponsNum'] >= $pay['maxAllCoupons'] ? $pay['maxAllCoupons'] : $userInfo['couponsNum']; - $pay['coupons']['useCouponsHandlingFee'] = round($pay['coupons']['useCoupons'] * $pay['coupousHandlingFee'],2);//产品券手续费 - $pay['coupons']['useCouponsTaxFee'] = round($pay['coupons']['useCoupons'] * $pay['coupousTaxFee'],2); - $pay['coupons']['useCouponsOk'] = $pay['coupons']['useCoupons'] - $pay['coupons']['useCouponsHandlingFee'] - $pay['coupons']['useCouponsTaxFee']; - $remNum = $pay['needPay'] - $pay['product']['useProduct'] - $pay['coupons']['useCouponsHandlingFee']; - if($remNum > 0 ){ - //旺旺券 - $pay['wang']['useWang'] = $userInfo['wangNum'] >= $remNum ? $remNum : $userInfo['wangNum']; - $remNum = $pay['needPay'] - $pay['product']['useProduct'] - $pay['coupons']['useCouponsHandlingFee']-$pay['wang']['useWang']; - if($remNum > 0 ){ - $pay['money']['useMoney'] = $remNum; - } - } - - // dump($pay); - + public function index(){ return $this->fetch('index'); } /**