Closed jayleco closed 4 years ago
该错误日志时间对应的的nginx日志信息
[31/Jul/2020:20:14:17 +0800] "GET http://wx.hahaha.vip/api/user/myorder?paid_at%3D1%26page%3D1 HTTP/1.1" 200 94 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:57.0) Gecko/20100101 Firefox/57.0"
[31/Jul/2020:20:44:37 +0800] "GET http://wx.hahaha.vip/api/wechat-pay/notify/buy-vip HTTP/1.1" 500 593659 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:57.0) Gecko/20100101 Firefox/57.0"
[31/Jul/2020:20:58:23 +0800] "GET /home?pid=124025598570 HTTP/1.1" 302 1398 "-" "Mozilla/5.0 (Linux; Android 9; ANE-AL00 Build/HUAWEIANE-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36 MMWEBID/1988 MicroMessenger/7.0.17.1720(0x27001137) Process/tools WeChat/arm64 NetType/WIFI Language/zh_CN ABI/arm64"
一般来讲,支付回调接口是公开的,也就可能存在黑客故意模拟微信推送请求来尝试攻击,所以你可以在逻辑里加日志,一旦有报错,记录请求的 XML 用于验证。
启动swoole 后,
Invalid request XML. 这个错误 ` try {
$message = XML::parse(strval($this->app['request']->getContent()));
} catch (\Throwable $e) {
throw new Exception('Invalid request XML: '.$e->getMessage(), 400);
}
if (!is_array($message) || empty($message)) {
throw new Exception('Invalid request XML.', 400);
}
`
这个地方抛异常,解析不了
laravel 中修改后,就可以了 ` $message = XML::parse(strval(request()->getContent()));
`
非 fpm 模式请自行解决哈
vic091 notifications@github.com于2020年10月23日 周五上午7:27写道:
启动swoole 后,` try {
$message = XML::parse(strval($this->app['request']->getContent())); } catch (\Throwable $e) { throw new Exception('Invalid request XML: '.$e->getMessage(), 400); }`
这个地方抛异常,解析不了
— You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub https://github.com/overtrue/wechat/issues/1909#issuecomment-714816187, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALHOYBKMVDHF667GTS4UP3SMC5VRANCNFSM4PRCWEOQ .
$request = ApplicationContext::getContainer()->get(RequestInterface::class); $message = XML::parse(strval($request->getBody()));
我用的环境
问题及现象
使用easywechat支付什么的都很正常,但是我今天看了下日志发现有很多easywechat的报错,日志内容如下: