diff --git a/data.json b/data.json index 7d2bd0a..f0886e4 100644 --- a/data.json +++ b/data.json @@ -1,10 +1,10 @@ { - "class": "123", - "lat": "123", - "lng": "123", - "acc": "123", - "time": 123, - "cookie": "123", + "class": "75717", + "lat": "23.21", + "lng": "112.49", + "acc": "5.7", + "time": 60, + "cookie": "wxid=ollOC0St_f4yM2Fl5a-ERD_WdH3Q$1713787685$57ae26b15c100b18666d5256b6a751c7; s=q2gGIHSmw5ke0Bdk41BvvJfdj4GM7jxFF4PRiWKg; remember_student_59ba36addc2b2f9401580f014c7f58ea4e30989d=2100368%7CC7i0ngsrbffKy1b7EPRRPAbvg2vdPjaa93f6WbnwFp6lHJP4vZ4zPKfMFJgL%7C; Hm_lvt_362de400d3fe4117e8e3513a52c0da9d=1713207421,1713295547,1713728251,1713787687; Hm_lpvt_362de400d3fe4117e8e3513a52c0da9d=1713787691", "scheduletime": "", "pushplus": "123" } \ No newline at end of file diff --git a/main.py b/main.py index c9971af..c98ddf2 100644 --- a/main.py +++ b/main.py @@ -81,21 +81,22 @@ with open('data.json', 'r') as file: print("----------配置通知(可选)----------") if (json_data['pushplus'] == "123"): token = input("请输入pushplus推送密钥,不需要请留空:") - + if(token!=""): # 1. 读取JSON文件 # JSON文件路径 - file_name = "data.json" - file_path = os.path.join(current_directory, file_name) - with open(file_path, "r") as file: - data = json.load(file) + file_name = "data.json" + file_path = os.path.join(current_directory, file_name) + with open(file_path, "r") as file: + data = json.load(file) # 2. 修改数据 - data["pushplus"] = token + data["pushplus"] = token # 3. 写回JSON文件 - with open(file_path, "w") as file: - json.dump(data, file, indent=4) + with open(file_path, "w") as file: + json.dump(data, file, indent=4) + + print("数据已保存到" + current_directory + "下的data.json中。") - print("数据已保存到" + current_directory + "下的data.json中。") else: token = json_data['pushplus'] # input("请输入pushplus密钥:") print("----------信息----------")