diff --git a/app.py b/app.py index 51f3814..af16b62 100644 --- a/app.py +++ b/app.py @@ -86,7 +86,7 @@ def fetch_and_save_contacts2(): #time.sleep(60*10) time.sleep(3600*1) -def auto_contacts_from_chatroom(): +def auto_add_contacts_from_chatrooms(): logger.info('自动从群添加好友') wxchat=gewe_chat.wxchat while True: @@ -105,14 +105,14 @@ def auto_contacts_from_chatroom(): status=r.get('status') # 启动线程处理登录信息 - thread = threading.Thread(target=process_add_contacts_from_groups, args=(wxchat,status, nickname, wxid, token_id, app_id)) + thread = threading.Thread(target=process_add_contacts_from_chatrooms, args=(wxchat,status, nickname, wxid, token_id, app_id)) thread.start() time.sleep(3) #time.sleep(60*10) time.sleep(3600*24) -def process_add_contacts_from_groups(wxchat:gewe_chat.GeWeChatCom,status, nickname, wxid, token_id, app_id): +def process_add_contacts_from_chatrooms(wxchat:gewe_chat.GeWeChatCom,status, nickname, wxid, token_id, app_id): if status == '1': c = wxchat.get_wxchat_config_from_cache(wxid) @@ -151,7 +151,7 @@ def start_wxchat_thread(): scan_wx_login_info() # 启动同步联系人线程 threading.Thread(target=fetch_and_save_contacts2).start() - threading.Thread(target=auto_contacts_from_chatroom).start() + threading.Thread(target=auto_add_contacts_from_chatrooms).start() diff --git a/wechat/gewe_chat.py b/wechat/gewe_chat.py index f356698..751b9c5 100644 --- a/wechat/gewe_chat.py +++ b/wechat/gewe_chat.py @@ -908,23 +908,6 @@ class GeWeChatCom: r=redis_helper.redis_helper.get_hash_field(hash_key,"data") return r - # def get_login_lock_from_cache(self,token_id)->bool: - # hash_key = f"__AI_OPS_WX__:LOGINLOCK:{token_id}" - # cache = redis_helper.redis_helper.get_hash_field(hash_key,"data") - # if cache: - # return True - # else: - # return False - - # def save_login_lock_to_cache(self,token_id,expire_time:int): - # hash_key = f"__AI_OPS_WX__:LOGINLOCK:{token_id}" - # redis_helper.redis_helper.set_hash(hash_key,{"data":str(uuid.uuid4())},expire_time) - - # def delete_login_lock_from_cache(self,token_id): - # hash_key = f"__AI_OPS_WX__:LOGINLOCK:{token_id}" - # redis_helper.redis_helper.delete_hash_field(hash_key,"data") - - def acquire_login_lock(self, token_id, expire_time=10): hash_key = f"__AI_OPS_WX__:LOGINLOCK:{token_id}" identifier=str(uuid.uuid4())