From ea4e67a38feef66fbd303caff913d46eb5cb55df Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 18:25:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=97=E9=93=BA=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=80=BB=E8=BE=91=E5=92=8C=E5=9B=9E=E8=B0=83=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 18 +++++++++++++++--- .../logic/store_order/StoreOrderLogic.php | 7 +++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 748971e6..d9041617 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -306,13 +306,24 @@ class PayNotifyLogic extends BaseLogic if ($order['uid'] > 0) { // 结算金额 要支付的钱减去冻结得钱去走后面得逻辑 发得兑换券也要去减去 - $vipFrozenAmount = self::dealFrozenPrice($order['id']); - $order['pay_price'] = bcsub($order['pay_price'],$vipFrozenAmount,2); //用户下单该用户等级为1得时候才处理冻结金额 $user = User::where('id', $order['uid'])->find(); - if ($user['user_ship'] == 1) { + + //纯在分销关系的时候要去判断分销出来的用户的采购款的额度 + if ($order['spread_uid'] > 0 && $user['user_ship'] == 1) { + $oldUser = User::where('id',$order['spread_uid'])->value('purchase_funds'); + if ($oldUser < $order['pay_price']) { + $order['pay_price'] = $oldUser; + } + }elseif ($user['user_ship'] == 1){ + $vipFrozenAmount = self::dealFrozenPrice($order['id']); + //为1的时候要去减活动价 + $final_price = bcsub($order['pay_price'],$order['deduction_price'],2); + $order['pay_price'] = bcsub($final_price,$vipFrozenAmount,2); self::dealVipAmount($order, $order['pay_type']); } + + $user_number = bcmul($order['pay_price'], '0.10', 2); $sing = [ 'uid' => $order['uid'], @@ -325,6 +336,7 @@ class PayNotifyLogic extends BaseLogic User::where('id', $order['uid'])->inc('integral', $user_number)->update(); } + $financeLogic->order = $order; $financeLogic->user = ['uid' => $order['uid']]; // if ($order->pay_type != 9 || $order->pay_type != 10) { diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index 00f2c515..85118090 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -110,8 +110,11 @@ class StoreOrderLogic extends BaseLogic self::$store_price = bcadd(self::$store_price, $cart_select[$k]['store_price'], 2);//门店零售价格 // self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2); } - - $pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 + if ($user && $user['user_ship'] == 1) { + $pay_price = self::$pay_price; + }else{ + $pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 + } $vipPrice = 0; //成本价 收益