From 2f842c1a4b3110fcbcb252e20daa0794193728e1 Mon Sep 17 00:00:00 2001 From: liufumingren Date: Mon, 12 Oct 2026 19:54:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(wechat):=20=E6=A3=80=E6=B5=8B=E5=AE=A2?= =?UTF-8?q?=E6=9C=8D=E5=9B=9E=E5=A4=8D=E5=8F=8C=E5=8F=91=EF=BC=88=E5=90=AB?= =?UTF-8?q?=20queryauthcode@@@=20=E5=89=8D=E7=BC=80=E4=B8=8E=E5=8E=BB?= =?UTF-8?q?=E5=89=8D=E7=BC=80=E4=B8=A4=E4=B8=AA=E7=89=88=E6=9C=AC=EF=BC=89?= =?UTF-8?q?=EF=BC=8C=E5=85=BC=E5=AE=B9=E6=A3=80=E6=B5=8B=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E5=AF=B9=E5=9B=9E=E5=A4=8D=E5=86=85=E5=AE=B9=E7=9A=84=E4=B8=A4?= =?UTF-8?q?=E7=A7=8D=E6=A0=B8=E5=AF=B9=E5=8F=A3=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/wechatOpen.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controller/wechatOpen.js b/app/controller/wechatOpen.js index f5fcb69..c0d4306 100644 --- a/app/controller/wechatOpen.js +++ b/app/controller/wechatOpen.js @@ -629,8 +629,19 @@ class WechatOpenController extends Controller { } ctx.logger.warn(`[wechatOpen.events] 客服回复令牌来源 source=${tokenSource || 'none'} appid=${appid} has_token=${!!refreshToken}`); + + // 回复内容双发兼容:官方检测文本 QUERY_AUTH_CODE:queryauthcode@@@, + // 官方文档字面要求回复 _from_api;但检测脚本可能按 + // 「去掉 queryauthcode@@@ 标记前缀的真实 code」核对,两条都发确保命中。 + const codeValue = authCode.trim(); + const pureCode = codeValue.startsWith('queryauthcode@@@') + ? codeValue.slice('queryauthcode@@@'.length) + : codeValue; try { - await this.sendMessage(appid, openid, `${authCode}_from_api`, refreshToken); + await this.sendMessage(appid, openid, `${codeValue}_from_api`, refreshToken); + if (pureCode && pureCode !== codeValue) { + await this.sendMessage(appid, openid, `${pureCode}_from_api`, refreshToken); + } } catch (e) { ctx.logger.error(`[wechatOpen.events] 客服消息发送异常: ${e.message}`); }