diff --git a/app/api/service/Notify.php b/app/api/service/Notify.php index 738e9ca6..c8ae9229 100644 --- a/app/api/service/Notify.php +++ b/app/api/service/Notify.php @@ -68,7 +68,6 @@ class Notify */ public function wechatV3(): string { - Db::table('yoshop_wx_server')->insertGetId(['content' => '进入v3', 'created_at' => date('Y-m-d H:i:s')]); try { // 通过微信支付v3平台证书序号 获取支付模板 $wechatpaySerial = \request()->header('wechatpay-serial'); @@ -133,7 +132,6 @@ class Notify */ private function orderPaySucces(PaymentTradeModel $tradeInfo, array $paymentData) { - Db::table('yoshop_wx_server')->insertGetId(['content' => '第一步', 'created_at' => date('Y-m-d H:i:s')]); // 记录日志 Log::append('Notify-orderPaySucces', [ 'orderType' => OrderTypeEnum::data()[$tradeInfo['order_type']]['name'], @@ -170,6 +168,7 @@ class Notify // 订单支付成功业务处理 (开通会员、分销商) if ($tradeInfo['order_type'] == OrderTypeEnum::MEMBER || $tradeInfo['order_type'] == OrderTypeEnum::DEALER) { Db::table('yoshop_wx_server')->insertGetId(['content' => '进入异步通知开始处理会员分销业务', 'created_at' => date('Y-m-d H:i:s')]); + Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($tradeInfo), 'created_at' => date('Y-m-d H:i:s')]); $service = new identity\PaySuccess(); $service->setOrderNo($tradeInfo['order_no']) ->setMethod($tradeInfo['pay_method']) diff --git a/app/api/service/identity/PaySuccess.php b/app/api/service/identity/PaySuccess.php index 404331c5..26a7610b 100644 --- a/app/api/service/identity/PaySuccess.php +++ b/app/api/service/identity/PaySuccess.php @@ -28,6 +28,7 @@ use app\common\library\Log; use app\common\service\BaseService; use app\store\model\dealer\User; use cores\exception\BaseException; +use think\facade\Db; /** * 余额充值订单支付成功服务类 @@ -126,12 +127,16 @@ class PaySuccess extends BaseService */ public function handle(): bool { + Db::table('yoshop_wx_server')->insertGetId(['content' => '开始处理业务', 'created_at' => date('Y-m-d H:i:s')]); // 验证当前参数是否合法 $this->verifyParameters(); + Db::table('yoshop_wx_server')->insertGetId(['content' => '数据合法', 'created_at' => date('Y-m-d H:i:s')]); // 当前订单开启并发锁 $this->lockUp(); + Db::table('yoshop_wx_server')->insertGetId(['content' => '准备修改订单', 'created_at' => date('Y-m-d H:i:s')]); // 验证当前订单是否允许支付 if ($this->checkOrderStatusOnPay()) { + Db::table('yoshop_wx_server')->insertGetId(['content' => '修改订单开始', 'created_at' => date('Y-m-d H:i:s')]); // 更新订单状态为已付款 $this->updatePayStatus(); } @@ -184,10 +189,12 @@ class PaySuccess extends BaseService Log::append('PaySuccess --updatePayStatus', ['title' => '订单已付款事件']); // 当前订单信息 $orderInfo = $this->getOrderInfo(); + Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($orderInfo), 'created_at' => date('Y-m-d H:i:s')]); // 事务处理 $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']); // 记录订单支付信息