fix: 企微 API 通过代理绕过 IP 白名单限制,补充错误日志

- 新增 WECHAT_API_BASE_URL 配置项,支持企微 API 代理转发
- _send_message 增加 API 错误日志(errcode + errmsg)
- _get_access_token 增加失败日志
- handle_text 不再为空,返回菜单引导提示
- 防重入触发时通知用户等待时间
- menu.py API 调用统一使用配置化的 base URL

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-12 08:43:03 +08:00
parent 103de16a8f
commit 18f415b363
5 changed files with 37 additions and 6 deletions
+3 -3
View File
@@ -71,7 +71,7 @@ class MenuManager:
if not token:
return False
url = "https://qyapi.weixin.qq.com/cgi-bin/menu/create"
url = f"{settings.wechat_api_base_url}/cgi-bin/menu/create"
params = {"access_token": token, "agentid": int(settings.wechat_agent_id)}
async with httpx.AsyncClient(timeout=15) as client:
@@ -88,7 +88,7 @@ class MenuManager:
if not token:
return False
url = "https://qyapi.weixin.qq.com/cgi-bin/menu/delete"
url = f"{settings.wechat_api_base_url}/cgi-bin/menu/delete"
params = {"access_token": token, "agentid": int(settings.wechat_agent_id)}
async with httpx.AsyncClient(timeout=15) as client:
@@ -101,7 +101,7 @@ class MenuManager:
if not token:
return None
url = "https://qyapi.weixin.qq.com/cgi-bin/menu/get"
url = f"{settings.wechat_api_base_url}/cgi-bin/menu/get"
params = {"access_token": token, "agentid": int(settings.wechat_agent_id)}
async with httpx.AsyncClient(timeout=15) as client: