From f42f26c910a5ee717bb93db064f108831ae74747 Mon Sep 17 00:00:00 2001 From: liuwei Date: Tue, 22 Apr 2025 11:39:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E6=B3=A8=E6=95=B0=E6=8D=AE=E7=9B=91?= =?UTF-8?q?=E5=90=AC=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/contacts_db.py | 11 ++----- gewechat/client/get_token.py | 28 +++++++++++++--- main.py | 62 ++++++++++++++++++------------------ requirements.txt | 3 -- 4 files changed, 57 insertions(+), 47 deletions(-) diff --git a/db/contacts_db.py b/db/contacts_db.py index 6b2c798..5dc8b82 100644 --- a/db/contacts_db.py +++ b/db/contacts_db.py @@ -15,15 +15,8 @@ logger = logging.getLogger(__name__) class ContactsDBOperator: """微信联系人数据库操作类""" - def __init__(self, db_manager: Optional[DBConnectionManager] = None): - """初始化联系人数据库操作类 - - Args: - db_manager: 数据库连接管理器,如果为None则自动获取单例 - """ - self.db_manager = db_manager or DBConnectionManager.get_instance() - self._ensure_table_exists() - + def __init__(self, db_manager: DBConnectionManager): + super().__init__(db_manager) def _ensure_table_exists(self): """确保联系人表存在""" try: diff --git a/gewechat/client/get_token.py b/gewechat/client/get_token.py index b7af7d4..5fd8cda 100644 --- a/gewechat/client/get_token.py +++ b/gewechat/client/get_token.py @@ -1,10 +1,30 @@ +# import requests +# +# url = "/tools/getTokenId" +# +# payload={} +# headers = {} +# base_url="http://192.168.2.240:2531/v2/api" +# response = requests.request("POST", base_url+url, headers=headers, data=payload) +# +# print(response.text) +# +# + import requests +import json -url = "/tools/getTokenId" +url = "/login/logout" -payload={} -headers = {} base_url="http://192.168.2.240:2531/v2/api" -response = requests.request("POST", base_url+url, headers=headers, data=payload) +payload = json.dumps({ + "appId": "wx_3BC6eSHGE5xEm_hH3__7c" +}) +headers = { + 'X-GEWE-TOKEN': 'cb43f52db27e4a56bb6ec7da54373582', + 'Content-Type': 'application/json' +} + +response = requests.request("POST", base_url+url, headers=headers, data=payload) print(response.text) \ No newline at end of file diff --git a/main.py b/main.py index 153ab83..04f98cd 100644 --- a/main.py +++ b/main.py @@ -109,37 +109,37 @@ def main(chat_type: int): print(f"已将新的APP_ID: {app_id} 写入配置文件") # 同时更新当前配置对象中的APP_ID config.APP_ID = app_id - - # 创建机器人实例 - robot = Robot(config, app_id, client, chat_type) - robot.LOG.info(f"WeChatRobot gewechat 成功启动···") - - # # 注册Robot实例到callback模块 - # from gewechat.api.callback import register_robot - # register_robot(app_id, robot) - - # 机器人启动发送测试消息 - client.post_text(app_id, send_msg_wxid, "gewechat client 启动成功!") - - # 每天 8:30 发送新闻 - robot.onEveryTime("08:30", robot.news_baidu_report_auto) - - # epic - robot.onEveryTime("10:30", robot.send_epic_free_games) - - # message report 1:数据自动从redis 转到sqllite - robot.onEveryTime("02:30", robot.message_count_to_db) - # 从db中提取并发送给相关群 - robot.onEveryTime("09:30", robot.generate_and_send_ranking) - - # sehuatang - robot.onEveryTime("15:30", robot.generate_sehuatang_pdf) - - # 秀人网每天自动下载帖子 - robot.onEveryTime("01:30", robot.xiu_ren_download_task) - - # 秀人网每天自动发pdf - robot.onEveryTime("17:30", robot.xiu_ren_pdf_send) + # + # # 创建机器人实例 + # robot = Robot(config, app_id, client, chat_type) + # robot.LOG.info(f"WeChatRobot gewechat 成功启动···") + # + # # # 注册Robot实例到callback模块 + # # from gewechat.api.callback import register_robot + # # register_robot(app_id, robot) + # + # # 机器人启动发送测试消息 + # client.post_text(app_id, send_msg_wxid, "gewechat client 启动成功!") + # + # # 每天 8:30 发送新闻 + # robot.onEveryTime("08:30", robot.news_baidu_report_auto) + # + # # epic + # robot.onEveryTime("10:30", robot.send_epic_free_games) + # + # # message report 1:数据自动从redis 转到sqllite + # robot.onEveryTime("02:30", robot.message_count_to_db) + # # 从db中提取并发送给相关群 + # robot.onEveryTime("09:30", robot.generate_and_send_ranking) + # + # # sehuatang + # robot.onEveryTime("15:30", robot.generate_sehuatang_pdf) + # + # # 秀人网每天自动下载帖子 + # robot.onEveryTime("01:30", robot.xiu_ren_download_task) + # + # # 秀人网每天自动发pdf + # robot.onEveryTime("17:30", robot.xiu_ren_pdf_send) # 启动Dashboard服务器 dashboard_server = None diff --git a/requirements.txt b/requirements.txt index 9d7d6d9..e59f01a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -42,9 +42,6 @@ psutil~=6.1.1 numpy~=1.26.4 pywin32==306 -opencv-python~=4.11.0.86 -deepface~=0.0.93 -scikit-learn>=1.0.2 gewechat-client==0.1.5 fastapi~=0.115.12 uvicorn~=0.34.2 \ No newline at end of file