From 07d0888f23b03d112d08e23301f67d90cda7e0ee Mon Sep 17 00:00:00 2001 From: xucong <850806214@qq.com> Date: Thu, 19 Sep 2024 22:55:27 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=9C=AC=E5=9C=B0=E7=94=9F=E6=B4=BB=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E6=B7=BB=E5=8A=A0=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/PayLogic.php | 21 +++++++-------------- app/common/logic/PayNotifyLogic.php | 19 ++++++++++++++++--- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/app/api/logic/PayLogic.php b/app/api/logic/PayLogic.php index 6827ba31..8d9bb94e 100755 --- a/app/api/logic/PayLogic.php +++ b/app/api/logic/PayLogic.php @@ -700,7 +700,9 @@ class PayLogic extends Logic $dt['user_id'] = $user_id; $dt['order_no'] = $out_trade_no; $dt['pay_shop_type'] = 1; - $dt['remark'] = $post['remark']; + if( isset($post['remark'])){ + $dt['remark'] = $post['remark']; + } $r = Db::name("local_store_order")->save($dt); // 基本户 5% $dt1['lstore_id'] = $post['lid']; @@ -756,18 +758,6 @@ class PayLogic extends Logic return JsonServer::success('微信支付发起成功', $res, 1); } - public function cancelPay($post){ - $sku_num_msg = Db::name("local_store_goods_item") - ->where("id",$post['spec_item_id']) - ->find(); - if($sku_num_msg['stock'] < $post['buy_shop_num']){ - return JsonServer::error('库存不足'); - } - $sku_num_msg = Db::name("local_store_goods_item") - ->where("id",$post['spec_item_id']) - ->dec("stock",$post['buy_shop_num']) - ->update(); - } // 本地生活余额支付 public static function localBalance($user_id,$post){ $user_balance = User::where(['id' => $user_id])->value('user_money'); @@ -840,7 +830,10 @@ class PayLogic extends Logic $dt['user_id'] = $user_id; $dt['pay_shop_type'] = 1; $dt['state'] = 1; - $dt['remark'] = $post['remark']; + if( isset($post['remark'])){ + $dt['remark'] = $post['remark']; + } + $dt['order_no'] = $local_store_order_no; $r = Db::name("local_store_order")->save($dt); if (!$r) { diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index e8965c33..cbee8e4f 100755 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -252,7 +252,8 @@ class PayNotifyLogic $order['lstore_id']= $result['local_id']; $r = Db::name("local_pay")->where("id",$result['id'])->update($d); } - $order['id']= 0; + $order['id']= $result['id']; + $order['type']= 4; $order['order_amount']= $result['order_amount']; $order['order_sn']= $order_sn; $type = "local_pay"; @@ -407,13 +408,15 @@ class PayNotifyLogic $user->user_growth = ['inc', $order['give_growth']]; $user->total_recharge_amount = ['inc', $total_money]; $user->save(); + $remark = "余额充值"; //记录余额 - $total_money > 0 && AccountLogLogic::AccountRecord($user->id, $total_money, 1, AccountLog::recharge_money, '', $order['id'], $order_sn); + $total_money > 0 && AccountLogLogic::AccountRecord($user->id, $total_money, 1, AccountLog::recharge_money, $remark, $order['id'], $order_sn); //记录积分 $total_integral > 0 && AccountLogLogic::AccountRecord($user->id, $total_integral, 1, AccountLog::recharge_give_integral); //记录成长值 $order['give_growth'] > 0 && AccountLogLogic::AccountRecord($user->id, $order['give_growth'], 1, AccountLog::recharge_give_growth); $type = "balance_rechange"; + $order['type'] = 2; // 余额充值参与百亿补贴 self::recharge_billions($order, $order['user_id'],$type); } @@ -422,6 +425,16 @@ class PayNotifyLogic private static function recharge_billions($order, $user_id,$type="") { + if(isset($order['id'])){ + $check_order = Db::name("user_billions") + ->where("order_id",$order['id']) + ->where("type",$order['type']) + ->find(); + if($check_order != null){ + return true; + } + } + $user_subsidy = 2; // 自我补贴 $all_user_subsidy = 20; //全用户获取的比例 $user_start_num = 1; // 补贴前几位数量 @@ -443,7 +456,7 @@ class PayNotifyLogic $data['goods_num'] = 1; // 充值接口设置为1 $data['order_id'] = $order['id']; $data['dtime'] = date("Y-m-d H:i:s"); - $data['type'] = 2; // 类型是充值 + $data['type'] = $order['type']; // 类型是充值 $data['subsidy_price'] = round($order['order_amount'] * $user_subsidy / 100,8); $res = Db::name("user_billions")->save($data); $subsidy = $order['order_amount'] * $all_user_subsidy / 100;