|
@@ -558,22 +558,40 @@ def read_cfg():
|
|
|
|
|
|
|
|
|
def write_Dailycfg(config):
|
|
|
- with open('daily.json', 'w') as config_file:
|
|
|
- json.dump(config, config_file, indent=4)
|
|
|
+ try:
|
|
|
+ config_manager = MinIOConfigManager()
|
|
|
+ localCfg_name = task_getComputerName() + '_daily'
|
|
|
+ config_manager.set_config(localCfg_name, config)
|
|
|
+ except Exception as e:
|
|
|
+ print("写入minIO错误, 尝试写入本地")
|
|
|
+ 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
|
|
|
+ config_manager = MinIOConfigManager()
|
|
|
+ localCfg_name = task_getComputerName() + '_daily'
|
|
|
+ localCfg = config_manager.get_config(localCfg_name)
|
|
|
+ config = json.loads(localCfg)
|
|
|
+ return config
|
|
|
+ except Exception as e:
|
|
|
+ print("读取minIO错误, 尝试读取本地")
|
|
|
+ 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):
|