Pārlūkot izejas kodu

fix(wechatpay): 修复异步请求错误处理中的变量作用域问题

- 在 otherwise 回调中添加 use($args) 以正确访问参数变量
- 确保错误日志记录能够正常输出完整的调试信息
- 解决了因变量作用域导致的错误处理异常问题
runphp 3 nedēļas atpakaļ
vecāks
revīzija
2c68e2715c
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      src/Trait/HandleAsyncRequestTrait.php

+ 1 - 1
src/Trait/HandleAsyncRequestTrait.php

@@ -23,7 +23,7 @@ trait HandleAsyncRequestTrait
                 Log::debug('微信支付异步回调返回数据:' . $response->getBody());
                 return json_decode((string)$response->getBody());
             })
-            ->otherwise(function ($e) {
+            ->otherwise(function ($e) use ($args) {
                 if ($e instanceof RequestException && $e->hasResponse()) {
                     $content = $e->getResponse()->getBody()->getContents();
                     Log::error('微信支付异步回调错误:message={message} content={content} args={args}', [