|
|
@@ -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): |
|
|
|
|
|
|
|
''' |
|
|
|
关于群加好友的请求规则:一次30人,间隔2小时做1次,一天做3次,即最多90人/天。 |
|
|
|
关于群加好友的请求规则: 每个智能体一次最多30人,间隔2小时做1次,即最多90人/天。 |
|
|
|
加好友规则:每天处理次数、间隔时间(分钟)、每次加好友人数这3个参数都可以设置。目前默认只是上面的设置。 |
|
|
|
''' |
|
|
|
|
|
|
|
async def task(): |
|
|
|
try: |
|
|
|
now = datetime.now() |
|
|
@@ -558,17 +559,17 @@ def scheduled_task_add_contacts_from_chatrooms(self, redis_config, kafka_config, |
|
|
|
|
|
|
|
oneday_add_contacts_total=90 |
|
|
|
once_add_contacts_total=30 |
|
|
|
oneday_times=3 |
|
|
|
#oneday_times=3 |
|
|
|
|
|
|
|
if scheduled_task_add_contacts_from_chatrooms_config: |
|
|
|
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) |
|
|
|
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') |
|
|
|
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: |
|
|
|
sorted_tasks = sorted(cache_task_run_time_logs, key=lambda x: x.get("runTime"), reverse=True) |
|
|
|