diff --git a/app/controller/wechatOpen.js b/app/controller/wechatOpen.js index 8e39fff..312fd0f 100644 --- a/app/controller/wechatOpen.js +++ b/app/controller/wechatOpen.js @@ -576,16 +576,13 @@ class WechatOpenController extends Controller { ctx.logger.warn(`[wechatOpen.events] 命中官方检测步骤2-公众号被动回复 appid=${appid} type=${detectAccountType(appid)}`); } else if (content.includes('QUERY_AUTH_CODE')) { // 微信全网发布检测场景(官方步骤3=公众号客服/步骤4=小程序客服):文本携带授权码 - // (QUERY_AUTH_CODE:)。双通道兜底: - // 1) 被动回复 _from_api(步骤4 文档未规定响应体,被动回复能让模拟粉丝直接收到消息); - // 2) 后台异步发送客服消息(含前缀/去前缀双发,官方要求走客服消息接口)。 + // (QUERY_AUTH_CODE:)。处理:响应体直接回空串(官方要求「5 秒内返回空串 + // 表明暂时不回复」),客服消息由后台异步发送(含前缀/去前缀双发)。 const authCode = content.replace('QUERY_AUTH_CODE:', '').trim(); const accountType = detectAccountType(appid); ctx.logger.warn(`[wechatOpen.events] 命中官方检测步骤3/4-客服消息回复 appid=${appid} type=${accountType} code=${authCode}`); - // 被动回复内容(官方文档字面口径:QUERY_AUTH_CODE: 后的实际值 + _from_api) - replyContent = `${authCode}_from_api`; - + // 官方要求:不被动回复,响应体回空串;客服消息流程放入后台异步执行 ctx.runInBackground(async () => { const client = new WechatOpenClient(ctx); let refreshToken = null; @@ -646,6 +643,9 @@ class WechatOpenController extends Controller { ctx.logger.error(`[wechatOpen.events] 客服消息发送异常: ${e.message}`); } }); + + // 响应体回空串(不被动回复,与 PHP 参考实现一致) + return EMPTY_REPLY; } else { replyContent = `收到您的消息:${content}\n我会尽快回复您!`; }