Skip to content

Commit d0e79a0

Browse files
committed
更新..11/5
1 parent b62e4d6 commit d0e79a0

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

FBver/FBver.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
from tkinter.ttk import Progressbar
1212
import tkinter as tk
1313

14+
from PyQt5.QtWidgets import QApplication
15+
1416
from FB_win import win_main
1517
# headers = {
1618
# "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
@@ -194,14 +196,19 @@ async def check_version():
194196
return version, remote_version
195197

196198
def version_ver():
199+
# 确保只有一个QApplication实例
200+
app = QApplication.instance()
201+
if app is None:
202+
app = QApplication(sys.argv)
203+
197204
loop = asyncio.new_event_loop()
198205
asyncio.set_event_loop(loop)
199206
version, remote_version = loop.run_until_complete(check_version())
200-
print(version,remote_version)
207+
print(version, remote_version)
208+
201209
if remote_version > version:
202210
install_new_version_thread(version, remote_version)
203211
else:
204-
# 使用授权验证来启动主程序
205212
from authorization import verify_and_run
206213
verify_and_run(version, 1)
207214
if __name__ == "__main__":

FBver/authorization.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,18 @@ def check_authorization():
165165
FROM UserData
166166
WHERE PCCoded = ? \
167167
"""
168+
update = """
169+
UPDATE UserData
170+
SET UseCount = UseCount + 1
171+
WHERE PCCoded = ? \
172+
"""
168173
cursor.execute(query, (machine_code,))
169174
results = cursor.fetchall()
170175

171176
if results:
177+
# 更新UseCount
178+
cursor.execute(update, (machine_code,))
179+
conn.commit()
172180
for row in results:
173181
PCCoded = row[0]
174182
installDate = row[1]

0 commit comments

Comments
 (0)