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的时候 //先处理金额大的再处理剩余的 /**** 把所有的金额改为正的再加一条后再加***/