[patch] 优化版本管理显示 与 更新提示(修改表名信息)
This commit is contained in:
@@ -167,7 +167,7 @@ class DatabaseVersionManager:
|
|||||||
try:
|
try:
|
||||||
cursor = self.conn.cursor()
|
cursor = self.conn.cursor()
|
||||||
cursor.execute("""
|
cursor.execute("""
|
||||||
SELECT version FROM web_version_history
|
SELECT version FROM web_versionhistory
|
||||||
WHERE type = '水滴智能通讯插件' AND is_delete = FALSE
|
WHERE type = '水滴智能通讯插件' AND is_delete = FALSE
|
||||||
ORDER BY release_time DESC LIMIT 1
|
ORDER BY release_time DESC LIMIT 1
|
||||||
""")
|
""")
|
||||||
@@ -211,7 +211,7 @@ class DatabaseVersionManager:
|
|||||||
try:
|
try:
|
||||||
cursor = self.conn.cursor()
|
cursor = self.conn.cursor()
|
||||||
cursor.execute("""
|
cursor.execute("""
|
||||||
SELECT version FROM web_version_history
|
SELECT version FROM web_versionhistory
|
||||||
WHERE content LIKE %s AND type = '水滴智能通讯插件'
|
WHERE content LIKE %s AND type = '水滴智能通讯插件'
|
||||||
ORDER BY release_time DESC LIMIT 1
|
ORDER BY release_time DESC LIMIT 1
|
||||||
""", (f'%{commit_id}%',))
|
""", (f'%{commit_id}%',))
|
||||||
@@ -241,7 +241,7 @@ class DatabaseVersionManager:
|
|||||||
|
|
||||||
cursor = self.conn.cursor()
|
cursor = self.conn.cursor()
|
||||||
cursor.execute("""
|
cursor.execute("""
|
||||||
INSERT INTO web_version_history
|
INSERT INTO web_versionhistory
|
||||||
(id, version, type, content, download_url, release_time, is_delete)
|
(id, version, type, content, download_url, release_time, is_delete)
|
||||||
VALUES (%s, %s, %s, %s, %s, %s, %s)
|
VALUES (%s, %s, %s, %s, %s, %s, %s)
|
||||||
""", (
|
""", (
|
||||||
@@ -258,6 +258,9 @@ class DatabaseVersionManager:
|
|||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
logger.info(f"✅ 版本记录已保存到数据库 (ID: {record_id})")
|
logger.info(f"✅ 版本记录已保存到数据库 (ID: {record_id})")
|
||||||
|
logger.info(f" 📦 版本: {version_record['version']}")
|
||||||
|
logger.info(f" 🔗 下载地址: {version_record.get('download_url', '')}")
|
||||||
|
logger.info(f" 📝 内容: {version_record['content'][:50]}...")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
22
main.py
22
main.py
@@ -725,20 +725,36 @@ class LoginWindow(QMainWindow):
|
|||||||
QMessageBox.Yes | QMessageBox.No,
|
QMessageBox.Yes | QMessageBox.No,
|
||||||
QMessageBox.Yes
|
QMessageBox.Yes
|
||||||
)
|
)
|
||||||
|
|
||||||
if reply == QMessageBox.Yes:
|
if reply == QMessageBox.Yes:
|
||||||
self.trigger_update(download_url)
|
self.trigger_update(download_url, latest_version)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.add_log(f"❌ 显示更新通知失败: {e}", "ERROR")
|
self.add_log(f"❌ 显示更新通知失败: {e}", "ERROR")
|
||||||
|
import traceback
|
||||||
|
self.add_log(f"详细错误: {traceback.format_exc()}", "ERROR")
|
||||||
|
|
||||||
def trigger_update(self, download_url):
|
def trigger_update(self, download_url, latest_version):
|
||||||
"""触发更新下载"""
|
"""触发更新下载"""
|
||||||
import webbrowser
|
import webbrowser
|
||||||
try:
|
try:
|
||||||
|
# 检查下载地址是否有效
|
||||||
|
if not download_url or download_url.strip() == "":
|
||||||
|
self.add_log("⚠️ 下载地址为空,无法打开更新页面", "WARNING")
|
||||||
|
QMessageBox.warning(
|
||||||
|
self,
|
||||||
|
"下载地址缺失",
|
||||||
|
f"版本 {latest_version} 的下载地址暂未配置。\n\n请联系管理员或稍后再试。",
|
||||||
|
QMessageBox.Ok
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
|
self.add_log(f"📂 打开下载页面: {download_url}", "INFO")
|
||||||
webbrowser.open(download_url)
|
webbrowser.open(download_url)
|
||||||
self.add_log("✅ 已打开更新下载页面", "SUCCESS")
|
self.add_log("✅ 已打开更新下载页面", "SUCCESS")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.add_log(f"❌ 打开下载页面失败: {e}", "ERROR")
|
self.add_log(f"❌ 打开下载页面失败: {e}", "ERROR")
|
||||||
|
import traceback
|
||||||
|
self.add_log(f"详细错误: {traceback.format_exc()}", "ERROR")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
Reference in New Issue
Block a user