From 257bac7edc866b1265078051eeb1600cdc5d737c Mon Sep 17 00:00:00 2001 From: CMHopeSunshine <277073121@qq.com> Date: Mon, 14 Mar 2022 09:26:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Djson=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hoshino/modules/Genshin_Paimon/util.py | 15 ++++++++------- hoshino/modules/myb_exchange/__init__.py | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/hoshino/modules/Genshin_Paimon/util.py b/hoshino/modules/Genshin_Paimon/util.py index 1a2578d..f951914 100644 --- a/hoshino/modules/Genshin_Paimon/util.py +++ b/hoshino/modules/Genshin_Paimon/util.py @@ -13,7 +13,7 @@ import datetime import functools import inspect -user_cookies = { +user_cookies_example = { "通用": [ { "cookie": "", @@ -24,20 +24,21 @@ user_cookies = { "no": 2 } ], - "私人":{ - - } - + "私人":{} + } +user_cookies = {} def load_data(): path = os.path.join(os.path.dirname(__file__), 'user_data','user_cookies.json') if not os.path.exists(path): with open(path,'w',encoding='UTF-8') as f: - json.dump(user_cookies,f,ensure_ascii=False) + json.dump(user_cookies_example,f,ensure_ascii=False) else: try: with open(path, encoding='utf8') as f: - user_cookies = json.load(f) + data = json.load(f) + for k, v in data.items(): + user_cookies[k] = v except: traceback.print_exc() diff --git a/hoshino/modules/myb_exchange/__init__.py b/hoshino/modules/myb_exchange/__init__.py index f2f3547..fc59030 100644 --- a/hoshino/modules/myb_exchange/__init__.py +++ b/hoshino/modules/myb_exchange/__init__.py @@ -17,7 +17,7 @@ def load_data(): path = os.path.join(os.path.dirname(__file__), 'myb_info.json') if not os.path.exists(path): with open(path,'w',encoding='UTF-8') as f: - json.dump(user_cookies,f,ensure_ascii=False) + json.dump(myb_info,f,ensure_ascii=False) else: try: with open(path, encoding='utf8') as f: