feat: 企微 API 代理 + 菜单部署修复

config.py:
- 新增 WECOM_API_BASE 环境变量 (默认 https://qyapi.weixin.qq.com)

wecom.py:
- 所有 API 调用改用 settings.WECOM_API_BASE (支持代理)
- 修复 _post_with_retry URL 拼接 bug (? vs &)
- 菜单名去掉 emoji (企微限制 16 字符)

api/wecom.py:
- setup-menu 端点菜单名修正

.env.example:
- 新增 WECOM_API_BASE 说明

当前 .env 配置: WECOM_API_BASE=https://api.v6ole.top
已验证: 通过代理获取 token , 菜单创建 

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-26 11:58:12 +08:00
parent da1f24c710
commit 1d2dacc3ab
4 changed files with 15 additions and 19 deletions
+2 -10
View File
@@ -141,16 +141,8 @@ async def test_message(
async def setup_menu(current_user: dict = Depends(require_director)):
"""Create the standard app menu (开始填报 + 绑定账号)."""
buttons = [
{
"type": "view",
"name": "📝 开始填报",
"url": "https://qj.dhdx.fun/m",
},
{
"type": "view",
"name": "🔗 绑定账号",
"url": "https://qj.dhdx.fun/bind-wechat",
},
{"type": "view", "name": "开始填报", "url": "https://qj.dhdx.fun/m"},
{"type": "view", "name": "绑定账号", "url": "https://qj.dhdx.fun/bind-wechat"},
]
success = await wecom_client.create_menu(buttons)
return {"success": success, "message": "菜单已部署" if success else "菜单创建失败"}