Remove legacy test script and enhance main application with WeChat server and menu management features. Added commands for starting the WeChat callback server and managing WeChat menus, along with necessary imports and error handling. Updated requirements to include Flask for the WeChat server functionality.

This commit is contained in:
2026-01-08 15:16:42 +08:00
parent 317dbf3c58
commit a8108d9afd
25 changed files with 3089 additions and 152 deletions
+46
View File
@@ -0,0 +1,46 @@
#!/usr/bin/env python3
"""
企业微信回调服务器启动脚本
"""
import sys
import os
# 添加项目路径
sys.path.insert(0, os.path.dirname(__file__))
try:
from gx_gp_monitor.wechat.callback_server import get_callback_server
from gx_gp_monitor.core.config_manager import load_config
from gx_gp_monitor.core.logger import get_logger
logger = get_logger(__name__)
def main():
"""启动企业微信回调服务器"""
# 加载配置
config = load_config()
# 获取回调服务器
callback_server = get_callback_server()
# 启动服务器
host = '0.0.0.0'
port = 18001
debug = config.debug if config else False
logger.info(f"启动企业微信回调服务器: {host}:{port}")
print(f"启动企业微信回调服务器: {host}:{port}")
print("回调地址: /api/v1/wechat/callback")
callback_server.run(host=host, port=port, debug=debug)
if __name__ == "__main__":
main()
except ImportError as e:
print(f"导入失败: {e}", file=sys.stderr)
print("请确保已安装所有依赖: pip install -r gx_gp_monitor/requirements.txt", file=sys.stderr)
sys.exit(1)
except Exception as e:
print(f"启动失败: {e}", file=sys.stderr)
sys.exit(1)