Browse Source

群加好友规则

1257
H Vs 1 week ago
parent
commit
1da71777d7
1 changed files with 7 additions and 6 deletions
  1. +7
    -6
      tasks.py

+ 7
- 6
tasks.py View File

@@ -528,9 +528,10 @@ def scheduled_task_add_contacts_from_chatrooms_p2(self, redis_config, kafka_conf
def scheduled_task_add_contacts_from_chatrooms(self, redis_config, kafka_config, gewe_config): def scheduled_task_add_contacts_from_chatrooms(self, redis_config, kafka_config, gewe_config):


''' '''
关于群加好友的请求规则:一次30人,间隔2小时做1次,一天做3次,即最多90人/天。
关于群加好友的请求规则: 每个智能体一次最多30人,间隔2小时做1次,即最多90人/天。
加好友规则:每天处理次数、间隔时间(分钟)、每次加好友人数这3个参数都可以设置。目前默认只是上面的设置。 加好友规则:每天处理次数、间隔时间(分钟)、每次加好友人数这3个参数都可以设置。目前默认只是上面的设置。
''' '''

async def task(): async def task():
try: try:
now = datetime.now() now = datetime.now()
@@ -558,17 +559,17 @@ def scheduled_task_add_contacts_from_chatrooms(self, redis_config, kafka_config,
oneday_add_contacts_total=90 oneday_add_contacts_total=90
once_add_contacts_total=30 once_add_contacts_total=30
oneday_times=3
#oneday_times=3


if scheduled_task_add_contacts_from_chatrooms_config: if scheduled_task_add_contacts_from_chatrooms_config:
oneday_add_contacts_total=scheduled_task_add_contacts_from_chatrooms_config.get('oneDayAddContactsTotal',90) oneday_add_contacts_total=scheduled_task_add_contacts_from_chatrooms_config.get('oneDayAddContactsTotal',90)
once_add_contacts_total=scheduled_task_add_contacts_from_chatrooms_config.get('onceAddContactsTotal',30) once_add_contacts_total=scheduled_task_add_contacts_from_chatrooms_config.get('onceAddContactsTotal',30)
oneday_times=scheduled_task_add_contacts_from_chatrooms_config.get('oneDayTimes',3)
#oneday_times=scheduled_task_add_contacts_from_chatrooms_config.get('oneDayTimes',3)


cache_task_run_time_logs= await gewe_service.get_task_run_time_async('scheduled_task_add_contacts_from_chatrooms') cache_task_run_time_logs= await gewe_service.get_task_run_time_async('scheduled_task_add_contacts_from_chatrooms')
if len(cache_task_run_time_logs) == oneday_times:
logger.info(f"今日定时群成员定时添好友任务已达上限 {oneday_times} 次!")
return
# if len(cache_task_run_time_logs) == oneday_times:
# logger.info(f"今日定时群成员定时添好友任务已达上限 {oneday_times} 次!")
# return
if cache_task_run_time_logs: if cache_task_run_time_logs:
sorted_tasks = sorted(cache_task_run_time_logs, key=lambda x: x.get("runTime"), reverse=True) sorted_tasks = sorted(cache_task_run_time_logs, key=lambda x: x.get("runTime"), reverse=True)


Loading…
Cancel
Save