From a93be1be3880ef9894f7258b367eda380edb45f4 Mon Sep 17 00:00:00 2001 From: H Vs Date: Wed, 2 Apr 2025 11:36:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BE=A4=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tasks.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tasks.py b/tasks.py index 7e8e273..3000c4a 100644 --- a/tasks.py +++ b/tasks.py @@ -202,6 +202,10 @@ def scheduled_task_sync_wx_info(self, redis_config, kafka_config, gewe_config): def scheduled_task_add_contacts_from_chatrooms(self, redis_config, kafka_config, gewe_config): async def task(): try: + now = datetime.datetime.now() + if now.hour < 8: + logger.info(f"定时群成员定时添好友任务不启动,当前时间为 {now.strftime('%Y-%m-%d %H:%M:%S')},早于8点") + return logger.info('定时群成员定时添好友任务开始') redis_service = RedisService() await redis_service.init(**redis_config) @@ -250,7 +254,7 @@ def scheduled_task_add_contacts_from_chatrooms(self, redis_config, kafka_config, contact_wxids_set = set(contact_wxids) # for admin_wxid in admin_wxids: # contact_wxids_set.add(admin_wxid) - contact_wxids_set.update(admin_wxids) + contact_wxids_set.update(set(admin_wxids)) if chatroom_owner_wxid is not None: contact_wxids_set.add(chatroom_owner_wxid)