H Vs преди 1 месец
родител
ревизия
6b90a66094
променени са 3 файла, в които са добавени 5 реда и са изтрити 6 реда
  1. +2
    -2
      app.py
  2. +0
    -2
      resources/login_resources.py
  3. +3
    -2
      resources/messages_resource.py

+ 2
- 2
app.py Целия файл

@@ -204,7 +204,7 @@ def background_wxchat_thread():
lock_identifier = str(time.time()) # 使用时间戳作为唯一标识

# 尝试获取分布式锁
if redis_helper.redis_helper.acquire_lock(lock_name, timeout=60):
if redis_helper.redis_helper.acquire_lock(lock_name, timeout=10):
try:
logger.info("分布式锁已成功获取")
# 启动任务
@@ -460,7 +460,7 @@ class WechatThreadManager:
def sync_contacts_threads_processer(self,wxid, token_id, app_id):
ret,msg,contacts_list = self.wxchat.fetch_contacts_list(token_id, app_id)
if ret==200:
friend_wxids = [c for c in contacts_list['friends'] if c not in ['fmessage', 'medianote','weixin','weixingongzhong']] # 可以调整截取范围
friend_wxids = [c for c in contacts_list['friends'] if c not in ['fmessage', 'medianote','weixin','weixingongzhong','tmessage']] # 可以调整截取范围
print(f'{wxid}的好友数量 {len(friend_wxids)}')
cache=self.wxchat.get_contacts_brief_from_cache(wxid)
cache_wxids = [c.get('userName') for c in cache]


+ 0
- 2
resources/login_resources.py Целия файл

@@ -107,8 +107,6 @@ class GetLoginWxQRCodeResource(Resource):
return jsonify(data)




def waitting_login_result(wxchat:gewe_chat.GeWeChatCom, token_id, app_id,region_id, agent_token_id,hash_key, uuid,start_time):
agent_tel=hash_key.split(":")[-1]
try:


+ 3
- 2
resources/messages_resource.py Целия файл

@@ -18,7 +18,7 @@ from voice import audio_convert
timeout_duration = 8.0


WX_BACKLIST=['fmessage', 'medianote','weixin','weixingongzhong']
WX_BACKLIST=['fmessage', 'medianote','weixin','weixingongzhong','tmessage']
class MessagesResource(Resource):
def __init__(self):
self.parser = reqparse.RequestParser()
@@ -386,6 +386,7 @@ def handle_text(token_id,app_id, wxid,msg_data,from_wxid, to_wxid):
timeout_duration,
lambda:check_timeout(task_thread, token_id, wxid,app_id, callback_to_user)
)
timeout_timer.daemon=True
timeout_timer.start()

# 等待任务线程完成
@@ -937,7 +938,7 @@ def handle_mod_contacts(token_id,app_id,wxid,msg_data):
#friend_wxids.remove('fmessage')
#friend_wxids.remove('weixin')

friend_wxids = [c for c in contacts_list['friends'] if c not in ['fmessage', 'medianote','weixin','weixingongzhong']] # 可以调整截取范围
friend_wxids = [c for c in contacts_list['friends'] if c not in ['fmessage', 'medianote','weixin','weixingongzhong','tmessage']] # 可以调整截取范围
print(f'{wxid}的好友数量 {len(friend_wxids)}')
gewe_chat.wxchat.save_contacts_brief_to_cache(token_id, app_id, wxid, friend_wxids)


Loading…
Отказ
Запис