diff options
author | Kyomotoi <[email protected]> | 2022-02-09 14:58:03 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2022-02-09 14:58:03 +0800 |
commit | 2c3027c85018dc7aa123b87b5b5144eb1cc67c65 (patch) | |
tree | 08ef02618397ee364a5c2d4c0734fda5e2ae2d1a | |
parent | f0f38c8de7b6bea553a9469481064fbe6b41c3aa (diff) | |
download | ATRI-2c3027c85018dc7aa123b87b5b5144eb1cc67c65.tar.gz ATRI-2c3027c85018dc7aa123b87b5b5144eb1cc67c65.tar.bz2 ATRI-2c3027c85018dc7aa123b87b5b5144eb1cc67c65.zip |
🐛 修复数据重复写入 感谢:@leinlin
-rw-r--r-- | ATRI/plugins/manage/data_source.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ATRI/plugins/manage/data_source.py b/ATRI/plugins/manage/data_source.py index 6b1f26f..d4f3b3c 100644 --- a/ATRI/plugins/manage/data_source.py +++ b/ATRI/plugins/manage/data_source.py @@ -169,7 +169,11 @@ class Manage(Service): except BaseException: return False else: + if user_id in temp_list: + return True + temp_list.append(user_id) + data["disable_user"] = temp_list ServiceTools().save_service(data, service) return True @@ -182,17 +186,21 @@ class Manage(Service): """ try: data = ServiceTools().load_service(service) - except BaseException: + except: return False temp_list: list = data.get("disable_group", list()) if is_enabled: try: temp_list.remove(group_id) - except BaseException: + except: return False else: + if group_id in temp_list: + return True + temp_list.append(group_id) + data["disable_group"] = temp_list ServiceTools().save_service(data, service) return True @@ -208,7 +216,7 @@ class Manage(Service): try: data = json.loads(path.read_bytes()) - except BaseException: + except: data = dict() return data |