diff --git a/src/main/java/cn/van333/wxsend/business/service/WeComApplicationTextPushService.java b/src/main/java/cn/van333/wxsend/business/service/WeComApplicationTextPushService.java index 7cf86eb..6848512 100644 --- a/src/main/java/cn/van333/wxsend/business/service/WeComApplicationTextPushService.java +++ b/src/main/java/cn/van333/wxsend/business/service/WeComApplicationTextPushService.java @@ -75,7 +75,12 @@ public class WeComApplicationTextPushService { String fishAid = StrUtil.trimToEmpty(goofishAgentId); if (StrUtil.isNotBlank(defAid) && rid.equals(defAid)) { if (StrUtil.isBlank(corpSecret)) { - throw new IllegalStateException("未配置 qywx.app.secret(与 agentId 对应)"); + String hint = ""; + if (StrUtil.isNotBlank(goofishSecret)) { + hint = "(已配置的是 goofishSecret,对应 AgentId " + fishAid + ";当前回调/推送为 " + + defAid + ",须在 wxSend 配置 qywx.app.secret 或环境变量 QYWX_APP_SECRET)"; + } + throw new IllegalStateException("未配置 qywx.app.secret(与 agentId 对应)" + hint); } sendTextWithAgent(toUser, content, defAid, corpSecret); return; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index f5e19aa..88c00d7 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -82,8 +82,8 @@ qywx: app: corpId: "ww929e7d6493c6336e" agentId: "1000012" - # 与 agentId 对应的应用 Secret(企微后台应用管理),用于 access_token + message/send - secret: "" + # 与 agentId 对应的应用 Secret(企微后台 → 应用管理 → Secret),用于 gettoken + message/send + secret: "ou35xJbpYvTAMMD0fcbTw9wsfVArETj0cR5plEfD-Ns" # 闲鱼订单通知自建应用:POST /wx/send/goofish(corpid 仍用上面 corpId) # 生产建议仅通过环境变量注入,勿将真实 Secret 提交仓库 goofishAgentId: "1000013"