From 50d5518f5d2330d10f2ba19de120f9034736fb9b Mon Sep 17 00:00:00 2001 From: wang hou sheng <76928547+wanghousheng@users.noreply.github.com> Date: Sun, 21 Apr 2024 14:18:54 +0800 Subject: [PATCH] 1 --- app/api/service/identity/PaySuccess.php | 27 +++++++++++++++---------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/app/api/service/identity/PaySuccess.php b/app/api/service/identity/PaySuccess.php index 26a7610b..b3244adf 100644 --- a/app/api/service/identity/PaySuccess.php +++ b/app/api/service/identity/PaySuccess.php @@ -190,18 +190,21 @@ class PaySuccess extends BaseService // 当前订单信息 $orderInfo = $this->getOrderInfo(); Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($orderInfo), 'created_at' => date('Y-m-d H:i:s')]); + // 更新订单状态 + $this->updateOrderStatus(); + Db::table('yoshop_wx_server')->insertGetId(['content' => '修改订单开始11111', 'created_at' => date('Y-m-d H:i:s')]); + // 累积用户总消费金额 + UserModel::setIncPayMoney($orderInfo['user_id'], (float)$orderInfo['pay_price']); + Db::table('yoshop_wx_server')->insertGetId(['content' => '设置消费金额', 'created_at' => date('Y-m-d H:i:s')]); + // 记录订单支付信息 + $this->updatePayInfo(); + Db::table('yoshop_wx_server')->insertGetId(['content' => '修改第三方订单信息', 'created_at' => date('Y-m-d H:i:s')]); + //更改会员角色 + $this->activate(); // 事务处理 - $this->orderModel()->transaction(function () use ($orderInfo) { - // 更新订单状态 - $this->updateOrderStatus(); - Db::table('yoshop_wx_server')->insertGetId(['content' => '修改订单开始11111', 'created_at' => date('Y-m-d H:i:s')]); - // 累积用户总消费金额 - UserModel::setIncPayMoney($orderInfo['user_id'], (float)$orderInfo['pay_price']); - // 记录订单支付信息 - $this->updatePayInfo(); - //更改会员角色 - $this->activate(); - }); +// $this->orderModel()->transaction(function () use ($orderInfo) { +// +// }); } @@ -229,6 +232,7 @@ class PaySuccess extends BaseService } // 将第三方交易记录更新为已支付状态 if (in_array($this->method, [PaymentMethodEnum::WECHAT, PaymentMethodEnum::ALIPAY])) { + Db::table('yoshop_wx_server')->insertGetId(['content' => '微信支付开始', 'created_at' => date('Y-m-d H:i:s')]); $this->updateTradeRecord(); } } @@ -238,6 +242,7 @@ class PaySuccess extends BaseService */ private function updateTradeRecord() { + Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($this->paymentData), 'created_at' => date('Y-m-d H:i:s')]); if ($this->tradeId && !empty($this->paymentData)) { PaymentTradeModel::updateToPaySuccess($this->tradeId, $this->paymentData['tradeNo']); }