From 5d2719c8f7fd8d357341145caa3a32c23d8ebb8f Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Thu, 27 Jun 2024 18:00:04 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B4=B9=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E5=8A=A0=E5=85=91=E6=8D=A2=E5=88=B8=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 1dc074f92..0d00a6857 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -349,10 +349,6 @@ class PayNotifyLogic extends BaseLogic } - - - - } @@ -794,8 +790,7 @@ class PayNotifyLogic extends BaseLogic $order['pay_price'] = bcsub($order['pay_price'], $vipFrozenAmount, 2); self::dealVipAmount($order, $order['pay_type']); } - if($order['total_price'] > 500 && $order['pay_type'] !=18 - && $order['pay_type'] !=3){ + if($order['total_price'] >= 500 ){ $user_number = bcmul($order['pay_price'], '0.10', 2); $sing = [ 'uid' => $order['uid'], From bc6855fc7c3cfa5856e4fa77412d08b669ee8b8d Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Thu, 27 Jun 2024 18:23:00 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E5=86=BB=E7=BB=93=E5=85=91=E6=8D=A2=E5=88=B8=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 117 +++++++++++++--------------- 1 file changed, 52 insertions(+), 65 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 0d00a6857..311be253b 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -206,6 +206,7 @@ class PayNotifyLogic extends BaseLogic OrderLogic::writeOff($params); } self::dealProductLog($order); + self::addFlowLog($order); // if($order['shipping_type'] == 3){ // self::descStock($order['id']); // } @@ -220,9 +221,9 @@ class PayNotifyLogic extends BaseLogic { //查询当前用户有无对应的充值的冻结金额 if($order['uid'] >0 ){ - $query = VipFlow::where([ + $query = UserSign::where([ 'user_id'=>$order['uid'], - 'type'=>2, + 'type'=>1, 'status'=>0 ]); $query1 = clone $query; @@ -234,30 +235,27 @@ class PayNotifyLogic extends BaseLogic if($count == 1){ //存在拆单子否 //少了就冻结减去这个对应的金额 - $one = VipFlow::where([ + $one = UserSign::where([ 'user_id'=>$order['uid'], - 'type'=>2, + 'type'=>1, 'status'=>0 ])->find(); $data = [ - 'vip_flow_id'=>$one['id'], - 'order_id' => $order['id'], - 'order_sn' => $order['order_id'], - 'user_id' => $order['uid'], - 'pay_type' => $pay_type ?? 1, - 'status' => 1, - 'type' => 1, + 'uid' => $order['uid'], + 'order_id' => $order['order_id'], + 'title' => '充值获得冻结兑换券', + 'financial_pm' => 1, 'store_id' => $order['store_id'], - 'staff_id' => $order['staff_id'], - 'create_time' => time() + 'type' => 1, ]; + if($one['back_num'] >= $backPurchase){ $data['number'] =$backPurchase; - Db::name('la_vip_flow_log')->insert($data); + Db::name('user_sign_log')->insert($data); //总的减去采购款百分之十剩余的 $wait = bcsub($one['back_num'],$backPurchase,2); if(empty($wait)){ - VipFlow::where('id',$one['id'])->update( + UserSign::where('id',$one['id'])->update( [ 'back_num'=>0, 'status'=>1 @@ -265,7 +263,7 @@ class PayNotifyLogic extends BaseLogic ); }else{ //add - VipFlow::where('id',$one['id'])->update([ + UserSign::where('id',$one['id'])->update([ [ 'back_num'=>$wait ] @@ -273,12 +271,13 @@ class PayNotifyLogic extends BaseLogic } //并且加到对应的用户的采购款中 User::where('id',$order['uid'])->inc('purchase_funds',$wait)->update(); - }else{ + } + else{ //对比采购款支付的多少 多了就拿冻结金额即可 $data['number'] =$one['number']; //都存到对应的log日志 - Db::name('la_vip_flow_log')->insert($data); - VipFlow::where('id',$one['id'])->update( + Db::name('user_sign_log')->insert($data); + UserSign::where('id',$one['id'])->update( [ 'back_num'=>0, 'status'=>1 @@ -292,56 +291,46 @@ class PayNotifyLogic extends BaseLogic //大于0的时候 //先处理金额大的再处理剩余的 /**** 把所有的金额改为正的再加一条后再加***/ - VipFlow::where([ + UserSign::where([ 'user_id'=>$order['uid'], - 'type'=>2, + 'type'=>1, 'status'=>0 ])->update([ 'status'=>1, - 'remark'=>json_encode($ids) + 'title'=>json_encode($ids) ]); if ($check >= $backPurchase) { //补一条待解冻的 -// $data = [ -// 'order_id' => $order['id'], -// 'transaction_id' => $transaction_id ?? 0, -// 'order_sn' => $order['order_id'], -// 'user_id' => $order['uid'], -// 'number' => $total_vip, -// 'back_num' => $total_vip, -// 'pay_type' => $pay_type ?? 1, -// 'status' => 0, -// 'type' => 1, -// 'store_id' => $order['store_id'], -// 'staff_id' => $order['staff_id'], -// 'create_time' => time() -// ]; -// Db::name('vip_flow')->insert($data); + $left = bcsub($check,$backPurchase,2); + if($left > 0){ + $data = [ + 'uid' => $order['uid'], + 'order_id' => $order['order_id'], + 'title' => '补冻结兑换券', + 'financial_pm' => 0, + 'store_id' => $order['store_id'], + 'type' => 1, + ]; + $data['number'] =$check; + Db::name('user_sign')->insert($data); + } + User::where('id',$order['uid'])->inc('purchase_funds',$backPurchase)->update();//add }else{ //log $data = [ - 'vip_flow_id'=>0, - 'remark'=>$ids, - 'order_id' => $order['id'], - 'order_sn' => $order['order_id'], - 'user_id' => $order['uid'], - 'pay_type' => $pay_type ?? 1, - 'status' => 1, - 'type' => 1, + 'uid' => $order['uid'], + 'order_id' => $order['order_id'], + 'title' => '充值获得冻结兑换券', + 'financial_pm' => 1, 'store_id' => $order['store_id'], - 'staff_id' => $order['staff_id'], - 'create_time' => time() + 'type' => 1, ]; $data['number'] =$check; - Db::name('la_vip_flow_log')->insert($data); + Db::name('user_sign_log')->insert($data); User::where('id',$order['uid'])->inc('purchase_funds',$check)->update();//add } - - - - } } @@ -349,7 +338,7 @@ class PayNotifyLogic extends BaseLogic } - + return true; } /** @@ -594,21 +583,19 @@ class PayNotifyLogic extends BaseLogic public static function dealRechargeFrozen($order) { $total_vip = bcmul($order['price'],0.1,2); - $data = [ - 'order_id' => $order['id'], - 'transaction_id' => $transaction_id ?? 0, - 'order_sn' => $order['order_id'], - 'user_id' => $order['uid'], + $user_sing = new UserSign(); + $sing = [ + 'uid' => $order['uid'], + 'order_id' => $order['order_id'], + 'title' => '充值获得冻结兑换券', + 'financial_pm' => 1, + 'store_id' => $order['store_id'], + 'type' => 1, 'number' => $total_vip, 'back_num' => $total_vip, - 'pay_type' => $pay_type ?? 1, - 'status' => 0, - 'type' => 1, - 'store_id' => $order['store_id'], - 'staff_id' => $order['staff_id'], - 'create_time' => time() ]; - Db::name('vip_flow')->insert($data); + $user_sing->save($sing); + return true; } From a2b6431813eef2ab1195be7599dfc8c67aadf99f Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Thu, 27 Jun 2024 18:29:34 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=9B=9E=E8=B0=83=E8=A1=A8=E5=AD=97=E6=AE=B5?= 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 311be253b..68780e46a 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -222,7 +222,7 @@ class PayNotifyLogic extends BaseLogic //查询当前用户有无对应的充值的冻结金额 if($order['uid'] >0 ){ $query = UserSign::where([ - 'user_id'=>$order['uid'], + 'uid'=>$order['uid'], 'type'=>1, 'status'=>0 ]); @@ -236,7 +236,7 @@ class PayNotifyLogic extends BaseLogic //存在拆单子否 //少了就冻结减去这个对应的金额 $one = UserSign::where([ - 'user_id'=>$order['uid'], + 'uid'=>$order['uid'], 'type'=>1, 'status'=>0 ])->find(); @@ -292,7 +292,7 @@ class PayNotifyLogic extends BaseLogic //先处理金额大的再处理剩余的 /**** 把所有的金额改为正的再加一条后再加***/ UserSign::where([ - 'user_id'=>$order['uid'], + 'uid'=>$order['uid'], 'type'=>1, 'status'=>0 ])->update([ From 7d775aa4bf734f8c8a8278f894fa90616d7516c6 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Thu, 27 Jun 2024 18:34:33 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 68780e46a..8dc4245b5 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -206,7 +206,14 @@ class PayNotifyLogic extends BaseLogic OrderLogic::writeOff($params); } self::dealProductLog($order); - self::addFlowLog($order); + $count = UserSign::where([ + 'uid'=>$order['uid'], + 'type'=>1, + 'status'=>0 + ])->count(); + if($count){ + self::addFlowLog($order); + } // if($order['shipping_type'] == 3){ // self::descStock($order['id']); // } @@ -245,7 +252,6 @@ class PayNotifyLogic extends BaseLogic 'order_id' => $order['order_id'], 'title' => '充值获得冻结兑换券', 'financial_pm' => 1, - 'store_id' => $order['store_id'], 'type' => 1, ]; @@ -308,7 +314,6 @@ class PayNotifyLogic extends BaseLogic 'order_id' => $order['order_id'], 'title' => '补冻结兑换券', 'financial_pm' => 0, - 'store_id' => $order['store_id'], 'type' => 1, ]; $data['number'] =$check; @@ -323,7 +328,6 @@ class PayNotifyLogic extends BaseLogic 'order_id' => $order['order_id'], 'title' => '充值获得冻结兑换券', 'financial_pm' => 1, - 'store_id' => $order['store_id'], 'type' => 1, ]; $data['number'] =$check;