From b23cafcb64a9d4b19adb2e851dff330ee40850d6 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 16:18:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=9A=E5=91=98=E4=B8=BA1?= =?UTF-8?q?=E6=97=B6=E6=83=85=E5=86=B5=E4=B8=8B=E5=A4=84=E7=90=86=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E4=B8=BA=E6=94=AF=E4=BB=98=E9=87=91=E9=A2=9D=E5=87=8F?= =?UTF-8?q?=E5=8E=BB=E5=86=BB=E7=BB=93=E9=87=91=E9=A2=9D=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 | 43 ++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index f7923921f..748971e67 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -304,14 +304,10 @@ class PayNotifyLogic extends BaseLogic $financeLogic = new StoreFinanceFlowLogic(); $user_sing = new UserSign(); - $financeLogic->order = $order; - $financeLogic->user = ['uid' => $order['uid']]; - // if ($order->pay_type != 9 || $order->pay_type != 10) { - $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付 - $count_frees = 0; - //商户应该获得的钱 每个商品的price-ot_price 利润 - // if (isset($order->profit) && $order->profit > 0) { 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) { @@ -329,6 +325,12 @@ 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) { + $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付 + $count_frees = 0; + //平台手续费 $fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2); $count_frees = bcadd($count_frees, $fees, 2); @@ -467,6 +469,25 @@ class PayNotifyLogic extends BaseLogic PayNotify::create($data); } + /** + * 冻结金额 + * @param $oid + * @return int|mixed + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + + public static function dealFrozenPrice($oid) + { + $detail = StoreOrderCartInfo::where('oid',$oid)->select()->toArray(); + $total_vip = 0; + foreach ($detail as $value){ + $total_vip +=$value['cart_info']['vip_frozen_price']; + } + return $total_vip; + } + /** * 处理用户为vip1时得冻结资金 @@ -478,13 +499,9 @@ class PayNotifyLogic extends BaseLogic * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public static function dealVipAmount($order,$pay_type =1, $transaction_id = 0) + public static function dealVipAmount($order,$pay_type =1,$transaction_id = 0) { - $detail = StoreOrderCartInfo::where('oid',$order['id'])->select()->toArray(); - $total_vip = 0; - foreach ($detail as $value){ - $total_vip +=$value['cart_info']['vip_frozen_price']; - } + $total_vip = self::dealFrozenPrice($order['id']); $data=[ 'order_id' => $order['id'], 'transaction_id' => $transaction_id??0,