From 1f9765d44ffecaae4a30b33c252fabf079820db9 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 15 Jun 2024 18:45:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BA=86=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=80=9A=E7=9F=A5=E9=80=BB=E8=BE=91=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E6=9D=A1=E4=BB=B6=E5=88=A4=E6=96=AD=E4=BB=A5?= =?UTF-8?q?=E5=A4=84=E7=90=86=E4=B8=8D=E5=90=8C=E6=83=85=E5=86=B5=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E6=89=8B=E7=BB=AD=E8=B4=B9=E3=80=81=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E8=B4=B9=E7=94=A8=E7=AD=89=E6=94=AF=E5=87=BA=E5=92=8C=E6=94=B6?= =?UTF-8?q?=E5=85=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 75 ++++++++++++++++++----------- 1 file changed, 46 insertions(+), 29 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index f40bd4027..cd804d806 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -304,10 +304,10 @@ class PayNotifyLogic extends BaseLogic //平台手续费 $fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2); $count_frees = bcadd($count_frees, $fees, 2); - $financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], 0,0, $order['pay_type']); //平台手续费 - - $financeLogic->out($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //商户平台手续费支出 - //冻结金额的 + if ($fees > 0) { + $financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费 + $financeLogic->out($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //商户平台手续费支出 + } // $frozen = bcsub($order->profit, $fees, 2); //缴纳齐全了就加商户没有就加到平台 $money_limt = SystemStore::where('id', $order['store_id'])->field('paid_deposit,security_deposit')->find(); @@ -316,22 +316,32 @@ class PayNotifyLogic extends BaseLogic $count_frees = bcadd($count_frees, $store_profit, 2); if ($deposit > 0) { if ($deposit > $store_profit) { - $financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + if ($store_profit > 0) { + $financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + } } else { $money = bcsub($store_profit, $deposit, 2); - $financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); - $financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0,$order['pay_type']); //平台手续费 + if ($deposit > 0) { + $financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + } + if ($money) { + $financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费 + } } } else { - $financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0,0, $order['pay_type']); //平台手续费 + if ($store_profit > 0) { + $financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费 + } } - if ($order['is_vip'] >=1) { + if ($order['is_vip'] >= 1) { if ($order['spread_uid'] > 0) { $financeLogic->other_arr['vip_uid'] = $order['spread_uid']; $fees = bcdiv(bcmul($order['pay_price'], '0.08', 2), 1, 2); $count_frees = bcadd($count_frees, $fees, 2); - $financeLogic->in($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], 0, 0,$order['pay_type']); //vip订单获得 - $financeLogic->out($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + if ($fees > 0) { + $financeLogic->in($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //vip订单获得 + $financeLogic->out($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + } } $fees = bcdiv(bcmul($order['pay_price'], '0.01', 2), 1, 2); $count_frees = bcadd($count_frees, bcmul($fees, 3, 2), 2); @@ -351,27 +361,34 @@ class PayNotifyLogic extends BaseLogic } } } - //村长获得 - if ($village_uid > 0) { - $financeLogic->other_arr['vip_uid'] = $village_uid; + if ($fees > 0) { + //村长获得 + if ($village_uid > 0) { + $financeLogic->other_arr['vip_uid'] = $village_uid; + } + + $financeLogic->in($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); + $financeLogic->out($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + //队长获得 + if ($brigade_uid > 0) { + $financeLogic->other_arr['vip_uid'] = $brigade_uid; + } + $financeLogic->in($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); + $financeLogic->out($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + //其他获得 + $financeLogic->other_arr['vip_uid'] = 0; + $financeLogic->in($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); + $financeLogic->out($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); } - $financeLogic->in($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], 0, 0,$order['pay_type']); - $financeLogic->out($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); - //队长获得 - if ($brigade_uid > 0) { - $financeLogic->other_arr['vip_uid'] = $brigade_uid; - } - $financeLogic->in($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], 0, 0,$order['pay_type']); - $financeLogic->out($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); - //其他获得 - $financeLogic->other_arr['vip_uid'] = 0; - $financeLogic->in($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], 0,0, $order['pay_type']); - $financeLogic->out($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); } + $fees=bcsub($order['pay_price'], $count_frees, 2); //供应链订单获得 - $financeLogic->in($transaction_id, bcsub($order['pay_price'], $count_frees, 2), OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0,0, $order['pay_type']); - $financeLogic->out($transaction_id, $count_frees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); - // } + if ($fees > 0) { + $financeLogic->in($transaction_id,$fees , OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); + $financeLogic->out($transaction_id, $fees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + + } +// } $financeLogic->save(); // } }