bea288e414
== 已部署上线 (9项) == - 代办事项真实数据源集成 (企微审批API 8bug修复链) - H5/坐席端 Logo样式统一+绿色背景 - 视频引导页修复 (localStorage key v2) - 坐席端 v9 Vue版本修复 (ElMessage._context) - 截图按钮 v10 修复 (getDisplayMedia user gesture) - 扫码样式恢复+H5扫码登录跳转修复 - H5截图快捷键提示 == 代码完成待部署 (3项) == - 知识迭代3Bug修复 (#8 POST端点/#7 MERGE幂等/#6 过期检查) - 会议室预定-小鱼易联终端 (40文件, 40/40测试通过) - IT资产升级审批推送 (asset_service.py) == 需求文档 (2项) == - 坐席端AI辅助消息框-PRD (4项新功能确认) - 坐席端布局优化建议 v2.0 (7天计划) == 新增文档 == - 日报-2026-07-11.md - 知识迭代Bug修复报告-20260711.md - 会议室预定-部署指南.md - CHANGELOG.md 更新 == 测试 == - test_todo_integration.py: 40/40 - test_meetingroom.py: 40/40 - test_bugfix_ki_suggestions.py: 21/21
61 lines
2.2 KiB
Python
61 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Verify WeCom contact sync works after IP whitelist configuration."""
|
|
import httpx
|
|
import json
|
|
|
|
CORP_ID = "wwa8c87970b2011f41"
|
|
CONTACT_SECRET = "BM6iosc3gKnPqkEXmsQN3ErJUpfO-whfMUN646eezB8"
|
|
|
|
# Step 1: Get contact access token
|
|
print("=" * 60)
|
|
print("Step 1: Get contact access token")
|
|
resp = httpx.get(f"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={CORP_ID}&corpsecret={CONTACT_SECRET}", timeout=10)
|
|
token_data = resp.json()
|
|
print(f" errcode: {token_data.get('errcode')}")
|
|
print(f" errmsg: {token_data.get('errmsg')}")
|
|
|
|
if 'access_token' not in token_data:
|
|
print(" FAILED: No access token returned")
|
|
exit(1)
|
|
|
|
token = token_data['access_token']
|
|
print(f" access_token: {token[:30]}...")
|
|
|
|
# Step 2: Get department list
|
|
print("\n" + "=" * 60)
|
|
print("Step 2: Get department list")
|
|
resp2 = httpx.get(f"https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token={token}", timeout=10)
|
|
dept_data = resp2.json()
|
|
print(f" errcode: {dept_data.get('errcode')}")
|
|
print(f" errmsg: {dept_data.get('errmsg')}")
|
|
departments = dept_data.get('department', [])
|
|
print(f" department count: {len(departments)}")
|
|
if departments:
|
|
print(f" first 5 departments:")
|
|
for d in departments[:5]:
|
|
print(f" - id={d.get('id')}, name={d.get('name')}, parentid={d.get('parentid')}")
|
|
|
|
# Step 3: Get members of root department (id=1)
|
|
print("\n" + "=" * 60)
|
|
print("Step 3: Get members of root department (id=1)")
|
|
resp3 = httpx.get(f"https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token={token}&department_id=1&fetch_child=1", timeout=15)
|
|
user_data = resp3.json()
|
|
print(f" errcode: {user_data.get('errcode')}")
|
|
print(f" errmsg: {user_data.get('errmsg')}")
|
|
users = user_data.get('userlist', [])
|
|
print(f" user count: {len(users)}")
|
|
if users:
|
|
print(f" first 3 users:")
|
|
for u in users[:3]:
|
|
print(f" - userid={u.get('userid')}, name={u.get('name')}, department={u.get('department')}")
|
|
|
|
print("\n" + "=" * 60)
|
|
print("SUMMARY:")
|
|
print(f" Token: OK")
|
|
print(f" Departments: {len(departments)}")
|
|
print(f" Users: {len(users)}")
|
|
if dept_data.get('errcode') == 0 and len(departments) > 0:
|
|
print(" RESULT: SUCCESS - Contact sync is working!")
|
|
else:
|
|
print(" RESULT: STILL FAILING")
|