Răsfoiți Sursa

fix(wechatpay): 解决微信支付通知服务中的探测流量异常处理

- 修复了探测流量时抛出异常缺少HTTP状态码的问题
- 添加了400状态码返回以正确响应探测请求
- 保持了原有的探测流量识别逻辑不变
runphp 1 zi în urmă
părinte
comite
139ef77d4c
1 a modificat fișierele cu 1 adăugiri și 1 ștergeri
  1. 1 1
      src/Service/NotifyService.php

+ 1 - 1
src/Service/NotifyService.php

@@ -43,7 +43,7 @@ class NotifyService
         if (!$verifiedStatus) {
             // 签名值中的 WECHATPAY/SIGNTEST/ 前缀快速判断是否为探测流量
             if (str_starts_with($signature, 'WECHATPAY/SIGNTEST/')) {
-                throw_logic_exception('The signature is a probe traffic.');
+                throw_logic_exception(msg:'The signature is a probe traffic.',httpCode: 400);
             } else {
                 Log::warning('The signature is invalid. timestamp={timestamp} nonce={nonce} inBody={inBody} signature={signature} serial={serial}', [
                     'timestamp' => $timestamp,