fix(app_detail_window): 修复开发者信息显示和下载链接获取逻辑

修复开发者信息显示问题,增加错误处理和备用数据源
优化下载链接获取逻辑,增加API调用和错误处理
This commit is contained in:
2025-09-25 20:53:13 +08:00
parent c6141a8cb3
commit 57e8fc877a
195 changed files with 37 additions and 4752 deletions

4
.gitignore vendored
View File

@@ -10,7 +10,11 @@ images/
# 忽略日志文件
logs/
/pyqt5fluentdesign/output/
/pyqt5fluentdesign/logs/
# 忽略Windows系统文件
Thumbs.db
.DS_Store
config.php
APP Store.zip

Binary file not shown.

View File

@@ -454,16 +454,23 @@ class AppDetailWindow(QMainWindow):
info_grid_layout.setColumnStretch(1, 1)
# 添加基本信息字段,对开发者信息进行特殊处理
print(app_data)
developer_id = app_data.get('developer_id')
print(developer_id)
result2 = self.api_client.make_request('getdeveloperinfo', {'id': developer_id})
result2 = result2["data"]
print(result2)
developer_name = result2.get("username")
print(developer_name)
if not developer_name:
developer_name = result2.get("username")
developer_name = "未知开发者"
if developer_id and developer_id != "0":
# 尝试通过API获取开发者名称增加错误处理
try:
result2 = self.api_client.make_request('getdeveloperinfo', {'id': developer_id})
if isinstance(result2, dict) and 'success' in result2 and result2['success'] and 'data' in result2:
developer_name = result2["data"].get("username", "未知开发者")
except Exception as e:
# API调用失败尝试从本地数据获取
if 'developer_name' in app_data and app_data['developer_name']:
developer_name = app_data['developer_name']
elif 'developer' in app_data and app_data['developer']:
developer_name = app_data['developer']
elif 'developer_email' in app_data and app_data['developer_email']:
developer_name = app_data['developer_email']
info_items = [
("应用ID", app_data.get("id", "--")),
@@ -674,18 +681,30 @@ class AppDetailWindow(QMainWindow):
parent=self
)
# 获取下载链接(使用应用数据中的直链下载地址)
# 1. 首先尝试从应用数据中获取直接下载链接
download_url = self.app_data.get('direct_download_url')
# 如果没有直接下载链接,尝试使用备用的download_url字段
# 2. 如果没有直接下载链接尝试使用备用的download_url字段
if not download_url:
download_url = self.app_data.get('download_url')
# 如果仍然没有下载链接,显示错误信息
# 3. 如果仍然没有下载链接,尝试通过API获取下载链接
if not download_url:
try:
# 使用app_id通过API获取下载链接
app_id = self.app_data.get('id')
if app_id:
download_result = self.api_client.make_request('getdownloadlink', {'id': app_id})
if isinstance(download_result, dict) and 'success' in download_result and download_result['success']:
download_url = download_result.get('data')
except Exception as e:
print(f"获取下载链接API调用失败: {str(e)}")
# 4. 如果仍然没有下载链接,显示错误信息
if not download_url:
InfoBar.error(
title="错误",
content="无法获取应用的下载链接,请稍后重试。",
content="无法获取应用的下载链接,请稍后重试。\n可能原因API返回数据中缺少下载链接字段。",
orient=Qt.Horizontal,
isClosable=True,
position=InfoBarPosition.TOP,

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More