|
@@ -211,30 +211,37 @@ def add_auto_task(isMaxCollect, isJina, isSimple = False, isAddStrengh = False,
|
|
|
while not event.is_set():
|
|
|
isLoginTask = True
|
|
|
fight_big_monster_times = 0
|
|
|
- config = read_cfg()
|
|
|
+ config = read_Dailycfg()
|
|
|
+ print("config", config)
|
|
|
+
|
|
|
if check_daily_config(config):
|
|
|
today = datetime.now().strftime('%Y-%m-%d')
|
|
|
- isLoginTask = config['daily'][today]["login_task"]
|
|
|
- fight_big_monster_times = int(config['daily'][today]["fight_big_monster_times"])
|
|
|
+ print("today", today)
|
|
|
+ isLoginTask = bool(config['daily'][today]["login_task"])
|
|
|
+ fight_big_monster_times = int(config['daily'][today]["fight_bigMonster_times"])
|
|
|
else:
|
|
|
set_login_task(config, False)
|
|
|
set_fight_big_monster_times(config, 0)
|
|
|
clean_old_daily_configs(config)
|
|
|
isLoginTask = False
|
|
|
fight_big_monster_times = 0
|
|
|
- write_cfg(config)
|
|
|
- send_status(f"isLoginTask:{isLoginTask}, fight_big_monster_times:{fight_big_monster_times}")
|
|
|
+ write_Dailycfg(config)
|
|
|
|
|
|
+ print("111")
|
|
|
+ send_status(f"isLoginTask:{isLoginTask}, fight_big_monster_times:{fight_big_monster_times}")
|
|
|
+ print("222")
|
|
|
|
|
|
if not isLoginTask:
|
|
|
task_queue.appendleft(task_checkMaster())
|
|
|
set_login_task(config, True)
|
|
|
- write_cfg(config)
|
|
|
-
|
|
|
+ write_Dailycfg(config)
|
|
|
+ print("333")
|
|
|
+
|
|
|
if isDailyConfig and fight_big_monster_times < 10:
|
|
|
task_queue.appendleft(task_fightMonster(isAddStrengh, True, isSimple))
|
|
|
set_fight_big_monster_times(config, fight_big_monster_times + 1)
|
|
|
- write_cfg(config)
|
|
|
+ write_Dailycfg(config)
|
|
|
+
|
|
|
|
|
|
|
|
|
task_queue.appendleft(task_information())
|
|
@@ -303,14 +310,23 @@ daily_config = {
|
|
|
}
|
|
|
|
|
|
def check_daily_config(config):
|
|
|
+
|
|
|
today = datetime.now().strftime('%Y-%m-%d') # 获取当前日期
|
|
|
+ print(f"Today: {today}") # 打印当前日期
|
|
|
+ print(f"Config: {config}") # 打印传入的配置
|
|
|
+
|
|
|
if "daily" not in config:
|
|
|
- config["daily"] = {}
|
|
|
- return False
|
|
|
+ print("Daily key not found, creating it.") # 调试信息
|
|
|
+ config["daily"] = {}
|
|
|
+ return False
|
|
|
+
|
|
|
if today not in config["daily"]:
|
|
|
+ print(f"Today's config not found: {today}") # 调试信息
|
|
|
return False
|
|
|
else:
|
|
|
+ print(f"Today's config found: {today}") # 调试信息
|
|
|
return True
|
|
|
+
|
|
|
|
|
|
# 修改或添加 "login_task" 的值
|
|
|
def set_login_task(config, value):
|
|
@@ -360,6 +376,24 @@ def read_cfg():
|
|
|
except json.JSONDecodeError:
|
|
|
print("配置文件格式错误,请检查文件内容是否为有效的 JSON。")
|
|
|
return None
|
|
|
+
|
|
|
+def write_Dailycfg(config):
|
|
|
+ with open('daily.json', 'w') as config_file:
|
|
|
+ json.dump(config, config_file, indent=4)
|
|
|
+def read_Dailycfg():
|
|
|
+ try:
|
|
|
+ with open('daily.json', 'r') as config_file:
|
|
|
+ config = json.load(config_file)
|
|
|
+ return config
|
|
|
+ except FileNotFoundError:
|
|
|
+ print("配置文件不存在,请检查文件路径。")
|
|
|
+ return None
|
|
|
+ except PermissionError:
|
|
|
+ print("没有权限读取配置文件。")
|
|
|
+ return None
|
|
|
+ except json.JSONDecodeError:
|
|
|
+ print("配置文件格式错误,请检查文件内容是否为有效的 JSON。")
|
|
|
+ return None
|
|
|
|
|
|
@socketio.on('begin_auto')
|
|
|
def handle_auto(data):
|