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 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=80=BB=E8=BE=91=E5=92=8C=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E5=A4=84=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 748971e67..d9041617f 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 00f2c5150..851180901 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; //成本价 收益 From 2e64e57488650cda9d2e5f5e8bffcf355b72c247 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 18:38:42 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=99=E9=A2=9D?= =?UTF-8?q?=E6=94=AF=E4=BB=98=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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index d9041617f..30355e8a4 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -78,6 +78,12 @@ class PayNotifyLogic extends BaseLogic $user->now_money = bcsub($user['now_money'], $order['pay_price'], 2); $user->save(); + 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; + } + } $capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price'],'',0,$order['store_id']); // self::afterPay($order); From f27eb18340755d83bfde9fca4f420dbe78eb3230 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 19:06:24 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=A4=9A=E6=89=A3?= =?UTF-8?q?=E8=B4=B9=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 30355e8a4..ec383da9b 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -324,12 +324,12 @@ class PayNotifyLogic extends BaseLogic }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); +// $final_price = bcsub($order['pay_price'],$order['deduction_price'],2); +// d($final_price,$vipFrozenAmount); + $order['pay_price'] = bcsub($order['pay_price'],$vipFrozenAmount,2); self::dealVipAmount($order, $order['pay_type']); } - $user_number = bcmul($order['pay_price'], '0.10', 2); $sing = [ 'uid' => $order['uid'],