关注数据监听。

This commit is contained in:
liuwei
2025-04-22 11:39:29 +08:00
parent a62bb61901
commit f42f26c910
4 changed files with 57 additions and 47 deletions

View File

@@ -15,15 +15,8 @@ logger = logging.getLogger(__name__)
class ContactsDBOperator: class ContactsDBOperator:
"""微信联系人数据库操作类""" """微信联系人数据库操作类"""
def __init__(self, db_manager: Optional[DBConnectionManager] = None): def __init__(self, db_manager: DBConnectionManager):
"""初始化联系人数据库操作类 super().__init__(db_manager)
Args:
db_manager: 数据库连接管理器如果为None则自动获取单例
"""
self.db_manager = db_manager or DBConnectionManager.get_instance()
self._ensure_table_exists()
def _ensure_table_exists(self): def _ensure_table_exists(self):
"""确保联系人表存在""" """确保联系人表存在"""
try: try:

View File

@@ -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 requests
import json
url = "/tools/getTokenId" url = "/login/logout"
payload={}
headers = {}
base_url="http://192.168.2.240:2531/v2/api" 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) print(response.text)

62
main.py
View File

@@ -109,37 +109,37 @@ def main(chat_type: int):
print(f"已将新的APP_ID: {app_id} 写入配置文件") print(f"已将新的APP_ID: {app_id} 写入配置文件")
# 同时更新当前配置对象中的APP_ID # 同时更新当前配置对象中的APP_ID
config.APP_ID = app_id config.APP_ID = app_id
#
# 创建机器人实例 # # 创建机器人实例
robot = Robot(config, app_id, client, chat_type) # robot = Robot(config, app_id, client, chat_type)
robot.LOG.info(f"WeChatRobot gewechat 成功启动···") # robot.LOG.info(f"WeChatRobot gewechat 成功启动···")
#
# # 注册Robot实例到callback模块 # # # 注册Robot实例到callback模块
# from gewechat.api.callback import register_robot # # from gewechat.api.callback import register_robot
# register_robot(app_id, robot) # # register_robot(app_id, robot)
#
# 机器人启动发送测试消息 # # 机器人启动发送测试消息
client.post_text(app_id, send_msg_wxid, "gewechat client 启动成功!") # client.post_text(app_id, send_msg_wxid, "gewechat client 启动成功!")
#
# 每天 8:30 发送新闻 # # 每天 8:30 发送新闻
robot.onEveryTime("08:30", robot.news_baidu_report_auto) # robot.onEveryTime("08:30", robot.news_baidu_report_auto)
#
# epic # # epic
robot.onEveryTime("10:30", robot.send_epic_free_games) # robot.onEveryTime("10:30", robot.send_epic_free_games)
#
# message report 1:数据自动从redis 转到sqllite # # message report 1:数据自动从redis 转到sqllite
robot.onEveryTime("02:30", robot.message_count_to_db) # robot.onEveryTime("02:30", robot.message_count_to_db)
# 从db中提取并发送给相关群 # # 从db中提取并发送给相关群
robot.onEveryTime("09:30", robot.generate_and_send_ranking) # robot.onEveryTime("09:30", robot.generate_and_send_ranking)
#
# sehuatang # # sehuatang
robot.onEveryTime("15:30", robot.generate_sehuatang_pdf) # robot.onEveryTime("15:30", robot.generate_sehuatang_pdf)
#
# 秀人网每天自动下载帖子 # # 秀人网每天自动下载帖子
robot.onEveryTime("01:30", robot.xiu_ren_download_task) # robot.onEveryTime("01:30", robot.xiu_ren_download_task)
#
# 秀人网每天自动发pdf # # 秀人网每天自动发pdf
robot.onEveryTime("17:30", robot.xiu_ren_pdf_send) # robot.onEveryTime("17:30", robot.xiu_ren_pdf_send)
# 启动Dashboard服务器 # 启动Dashboard服务器
dashboard_server = None dashboard_server = None

View File

@@ -42,9 +42,6 @@ psutil~=6.1.1
numpy~=1.26.4 numpy~=1.26.4
pywin32==306 pywin32==306
opencv-python~=4.11.0.86
deepface~=0.0.93
scikit-learn>=1.0.2
gewechat-client==0.1.5 gewechat-client==0.1.5
fastapi~=0.115.12 fastapi~=0.115.12
uvicorn~=0.34.2 uvicorn~=0.34.2