From b12e9b2ef6ceba0bbd220d9bf302b1f4de878acc Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Thu, 27 Jun 2024 18:51:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 8dc4245b5..98e90d31b 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -227,7 +227,7 @@ class PayNotifyLogic extends BaseLogic public static function addFlowLog($order) { //查询当前用户有无对应的充值的冻结金额 - if($order['uid'] >0 ){ + if($order['uid'] >0){ $query = UserSign::where([ 'uid'=>$order['uid'], 'type'=>1, @@ -256,10 +256,12 @@ class PayNotifyLogic extends BaseLogic ]; if($one['back_num'] >= $backPurchase){ + $data['number'] =$backPurchase; Db::name('user_sign_log')->insert($data); //总的减去采购款百分之十剩余的 - $wait = bcsub($one['back_num'],$backPurchase,2); + $wait = bcsub($one['back_num'],$backPurchase,2)??0; + if(empty($wait)){ UserSign::where('id',$one['id'])->update( [ @@ -269,12 +271,13 @@ class PayNotifyLogic extends BaseLogic ); }else{ //add - UserSign::where('id',$one['id'])->update([ + UserSign::where('id',$one['id'])->update( [ 'back_num'=>$wait ] - ]); + ); } + //并且加到对应的用户的采购款中 User::where('id',$order['uid'])->inc('purchase_funds',$wait)->update(); } @@ -293,7 +296,8 @@ class PayNotifyLogic extends BaseLogic User::where('id',$order['uid'])->inc('purchase_funds',$one['number'])->update(); } - }else{ + } + else{ //大于0的时候 //先处理金额大的再处理剩余的 /**** 把所有的金额改为正的再加一条后再加***/