|
15 | 15 |
|
16 | 16 | import global_var as gl |
17 | 17 |
|
18 | | -MAIN_VERSION = '1.1.1' |
| 18 | +MAIN_VERSION = '1.1.2' |
19 | 19 | MYS_SALT = "PVeGWIZACpxXZ1ibMVJPi9inCY4Nd4y2" |
20 | 20 | MYS_SALT_TWO = "t0qEgfub6cvueAPgR5m9aQWWVciEer7v" |
21 | 21 | MYS_SALT_WEB = "yUZ3s0Sna1IrSNfk29Vo6vRapdOyqyhB" |
@@ -122,37 +122,49 @@ def check_update(): |
122 | 122 | if MAIN_VERSION == config_version: |
123 | 123 | print(f"当前程序版本为v{MAIN_VERSION}, 配置文件版本为v{config_version}") |
124 | 124 | # 远程检查更新 |
125 | | - check_url = "https://fastly.jsdelivr.net/gh/GOOD-AN/mys_exch_goods@latest/update_log.json" |
126 | | - check_info = requests.get(check_url, timeout=15).json() |
| 125 | + check_info = '' |
| 126 | + for check_update_url in gl.CHECK_UPDATE_URL_LIST: |
| 127 | + check_url = check_update_url + "/update_log.json" |
| 128 | + try: |
| 129 | + check_info = requests.get(check_url, timeout=15).json() |
| 130 | + break |
| 131 | + except requests.exceptions.ConnectionError: |
| 132 | + continue |
| 133 | + if not check_info: |
| 134 | + print("检查更新失败") |
| 135 | + return False |
127 | 136 | remote_least_version = check_info['least_version'].split('.') |
128 | 137 | local_version = MAIN_VERSION.split('.') |
129 | 138 | if compare_version(remote_least_version, local_version) == 1: |
130 | 139 | print("版本过低, 程序将停止运行") |
| 140 | + print("项目地址: https://github.com/GOOD-AN/mys_exch_goods") |
131 | 141 | time.sleep(3) |
132 | 142 | sys.exit() |
133 | 143 | remote_last_vesion = check_info['last_vesion'].split('.') |
134 | 144 | if compare_version(local_version, remote_last_vesion) == -1: |
135 | 145 | remote_update_log_list = check_info['update_log'] |
136 | 146 | print(f"当前程序版本为v{MAIN_VERSION}, 最新程序版本为v{check_info['last_vesion']}") |
137 | | - print("当前非最新版本,建议更新") |
| 147 | + print("当前非最新版本,建议更新\n") |
138 | 148 | print("更新概览: ") |
| 149 | + print("=" * 50) |
139 | 150 | for update_log in remote_update_log_list: |
140 | 151 | if compare_version(update_log['version'].split('.'), local_version) == 1: |
141 | | - print(f"版本: {update_log['version']}") |
| 152 | + print("版本: ", f"{update_log['version']}".center(12)) |
142 | 153 | print(f"更新时间: {update_log['update_time']}") |
143 | | - print(f"更新说明: {update_log['update_content']}") |
| 154 | + print(f"更新说明: {update_log['update_content'][0]}") |
| 155 | + for content in update_log['update_content'][1:]: |
| 156 | + print(content.rjust(20)) |
| 157 | + print("=" * 50) |
144 | 158 | print("项目地址: https://github.com/GOOD-AN/mys_exch_goods") |
145 | 159 | else: |
146 | 160 | print(f"当前程序版本为v{MAIN_VERSION}, 配置文件版本为v{config_version}, 版本不匹配可能带来运行问题, 建议更新") |
147 | 161 | print("项目地址: https://github.com/GOOD-AN/mys_exch_goods") |
148 | | - input("按回车键继续") |
149 | 162 | return None |
150 | 163 | except KeyboardInterrupt: |
151 | 164 | print("强制退出") |
152 | 165 | sys.exit() |
153 | 166 | except Exception as err: |
154 | 167 | print(f"检查更新失败, 原因为{err}, 错误行数为: {err.__traceback__.tb_lineno}") |
155 | | - input("按回车键继续") |
156 | 168 | return None |
157 | 169 |
|
158 | 170 |
|
|
0 commit comments