fix(wechat): events URL 验证不再因 appid 无授权记录而拒绝(首次配置/全网发布检测场景兼容,仍按组件 Token 验签回显)
This commit is contained in:
parent
7238621025
commit
a49a878b5f
@ -430,7 +430,9 @@ class WechatOpenController extends Controller {
|
||||
|
||||
/**
|
||||
* 验证事件推送服务器 URL(参考 PHP verifyEventUrl)。
|
||||
* 对应授权方须已在 wms_wechat_app 登记;签名使用第三方平台(组件)Token 校验。
|
||||
* 签名使用第三方平台(组件)Token 校验(与 /Authorization 的 URL 验证一致)。
|
||||
* appid 记录不存在时不阻断验证:首次配置服务器地址、微信全网发布检测等场景下,
|
||||
* 微信会先发 echostr 验证 URL,此时可能尚无授权记录,仍按组件 Token 验签回显。
|
||||
* @param {string} appid 授权方 AppID。
|
||||
* @param {string} signature 微信回传签名。
|
||||
* @param {string} timestamp 时间戳。
|
||||
@ -441,11 +443,10 @@ class WechatOpenController extends Controller {
|
||||
async verifyEventUrl(appid, signature, timestamp, nonce, echostr) {
|
||||
const { ctx, app } = this;
|
||||
|
||||
// 对应小程序须已授权登记
|
||||
// 对应小程序应已授权登记;未登记仅告警,不阻断 URL 验证
|
||||
const record = await app.model.WechatApp.findOne({ where: { appid } });
|
||||
if (!record) {
|
||||
ctx.logger.error(`[wechatOpen.events] URL 验证失败:appid 未登记 appid=${appid}`);
|
||||
return 'appid not found';
|
||||
ctx.logger.warn(`[wechatOpen.events] URL 验证:appid 尚无授权记录(首次配置或检测场景),仍按组件 Token 验签 appid=${appid}`);
|
||||
}
|
||||
|
||||
const config = app.config.wechatOpen || {};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user