diff --git a/E093F984D9FDB988C9F20A2EE554657D.png b/E093F984D9FDB988C9F20A2EE554657D.png new file mode 100644 index 0000000..59c1c4f Binary files /dev/null and b/E093F984D9FDB988C9F20A2EE554657D.png differ diff --git a/developer/dashboard.php b/developer/dashboard.php index 6006ce8..5580e0a 100644 --- a/developer/dashboard.php +++ b/developer/dashboard.php @@ -63,7 +63,8 @@ if (!($conn instanceof mysqli)) { font-family: Arial, sans-serif; background-color: #f4f4f4; margin: 0; - padding: 20px; + /* 操了原来问题出现在这里 */ + /* padding: 20px; */ } .page-transition { animation: fadeIn 0.5s ease-in-out; diff --git a/developer/profile.php b/developer/profile.php index 07231d8..5101663 100644 --- a/developer/profile.php +++ b/developer/profile.php @@ -198,6 +198,7 @@ if (!($conn instanceof mysqli)) { + - + + + - - @@ -346,26 +399,6 @@ if (!($conn instanceof mysqli)) {
- @@ -486,7 +556,19 @@ if (!($conn instanceof mysqli)) {
+
+ +
+
@@ -585,5 +667,8 @@ if (!($conn instanceof mysqli)) {
+ + + \ No newline at end of file diff --git a/developer/version_control.php b/developer/version_control.php index d9b9fae..aa0daab 100644 --- a/developer/version_control.php +++ b/developer/version_control.php @@ -38,6 +38,7 @@ $platforms = json_decode($app['platforms'], true); $success = ''; $error = ''; + // 处理版本上传请求 if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['upload_version'])) { // 验证版本信息 @@ -45,7 +46,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['upload_version'])) { $error = '版本号和安装包不能为空'; } else { // 处理App文件上传 - $uploadDir = '../files/'; + $uploadDir = __DIR__ . '/../files/'; if (!is_dir($uploadDir)) { mkdir($uploadDir, 0755, true); } @@ -64,10 +65,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['upload_version'])) { $error = '版本保存失败,请稍后再试'; unlink($targetPath); // 清理已上传文件 } else { - $verStmt->bind_param("isss", $appId, $version, $changelog, $targetPath); + $verStmt->bind_param("isss", $appId, $version, $changelog, $fileName); if ($verStmt->execute()) { - // 更新应用表中的最新版本 // 更新应用表中的最新版本 $updateAppSql = "UPDATE apps SET version = ? WHERE id = ?"; $updStmt = $conn->prepare($updateAppSql); @@ -99,7 +99,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['version_id'])) { // 检查是否有新文件上传 if (!empty($_FILES['new_app_file']['name'])) { - $uploadDir = '../files/'; + $uploadDir = __DIR__ . '/../files/'; if (!is_dir($uploadDir)) { mkdir($uploadDir, 0755, true); } @@ -120,7 +120,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['version_id'])) { $oldPathResult = $getOldPathStmt->get_result(); if ($oldPathResult->num_rows > 0) { $oldPathRow = $oldPathResult->fetch_assoc(); - $oldFilePath = $oldPathRow['file_path']; + $oldFileName = $oldPathRow['file_path']; + $oldFilePath = $uploadDir . $oldFileName; if (file_exists($oldFilePath)) { unlink($oldFilePath); } @@ -134,7 +135,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['version_id'])) { $error = '版本修改失败,请稍后再试'; unlink($newFilePath); } else { - $updateVersionStmt->bind_param("sssi", $version, $changelog, $newFilePath, $versionId); + $updateVersionStmt->bind_param("sssi", $version, $changelog, $fileName, $versionId); if ($updateVersionStmt->execute()) { $success = '版本修改成功'; } else { @@ -167,13 +168,30 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['version_id'])) { // 处理版本删除请求 if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['delete_version'])) { $versionId = $_POST['version_id']; - $filePath = $_POST['file_path']; + $uploadDir = __DIR__ . '/../files/'; - // 删除文件 - if (file_exists($filePath)) { - if (!unlink($filePath)) { - log_error("文件删除失败: " . $filePath, __FILE__, __LINE__); - $error = '版本删除失败,请稍后再试'; + // 获取文件路径 + $getFilePathSql = "SELECT file_path FROM app_versions WHERE id = ?"; + $getFileStmt = $conn->prepare($getFilePathSql); + if (!$getFileStmt) { + log_error("获取文件路径查询准备失败: " . $conn->error, __FILE__, __LINE__); + $error = '版本删除失败,请稍后再试'; + } else { + $getFileStmt->bind_param("i", $versionId); + $getFileStmt->execute(); + $fileResult = $getFileStmt->get_result(); + if ($fileResult->num_rows > 0) { + $fileRow = $fileResult->fetch_assoc(); + $fileName = $fileRow['file_path']; + $filePath = $uploadDir . $fileName; + + // 删除文件 + if (file_exists($filePath)) { + if (!unlink($filePath)) { + log_error("文件删除失败: " . $filePath, __FILE__, __LINE__); + $error = '版本删除失败,请稍后再试'; + } + } } } @@ -326,7 +344,7 @@ if (!$verStmt) { 下载 修改 - 删除 + 删除 当前版本 @@ -401,11 +419,10 @@ if (!$verStmt) { }); } - function confirmDelete(versionId, filePath) { + function confirmDelete(versionId) { const formData = new FormData(); formData.append('delete_version', 'true'); formData.append('version_id', versionId); - formData.append('file_path', filePath); fetch('version_control.php', { method: 'POST', body: formData }) .then(response => response.text()) diff --git a/favicon.ico b/favicon.ico deleted file mode 100644 index 02c2922..0000000 Binary files a/favicon.ico and /dev/null differ diff --git a/favicon.jpeg b/favicon.jpeg index 07eb466..163809a 100644 Binary files a/favicon.jpeg and b/favicon.jpeg differ diff --git a/favicon.svg b/favicon.svg index ad6e06e..32009f5 100644 --- a/favicon.svg +++ b/favicon.svg @@ -1,2166 +1,360 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pyqt5fluentdesign/__pycache__/app_detail_window.cpython-312.pyc b/pyqt5fluentdesign/__pycache__/app_detail_window.cpython-312.pyc new file mode 100644 index 0000000..5db1fcf Binary files /dev/null and b/pyqt5fluentdesign/__pycache__/app_detail_window.cpython-312.pyc differ diff --git a/pyqt5fluentdesign/__pycache__/leonapp_gui.cpython-312.pyc b/pyqt5fluentdesign/__pycache__/leonapp_gui.cpython-312.pyc deleted file mode 100644 index 254c6d9..0000000 Binary files a/pyqt5fluentdesign/__pycache__/leonapp_gui.cpython-312.pyc and /dev/null differ diff --git a/pyqt5fluentdesign/app_detail_window.py b/pyqt5fluentdesign/app_detail_window.py new file mode 100644 index 0000000..d302db1 --- /dev/null +++ b/pyqt5fluentdesign/app_detail_window.py @@ -0,0 +1,142 @@ +from PyQt5.QtWidgets import (QMainWindow, QWidget, QVBoxLayout, QHBoxLayout, QLabel, + QPushButton, QTextEdit, QGroupBox, QFormLayout, QScrollArea) +from PyQt5.QtCore import Qt +from qfluentwidgets import (InfoBar, InfoBarPosition, TitleLabel, SubtitleLabel, + PrimaryPushButton, PushButton) +import json + +class AppDetailWindow(QMainWindow): + def __init__(self, api_client, app_id, parent=None): + super().__init__(parent) + self.api_client = api_client + self.app_id = app_id + self.parent_window = parent + + # 设置窗口属性 + self.setWindowTitle("应用详情") + self.resize(800, 600) + + # 创建中心部件 + self.central_widget = QWidget() + self.setCentralWidget(self.central_widget) + + # 创建主布局 + self.main_layout = QVBoxLayout(self.central_widget) + + # 创建标题区域 + self.title_layout = QHBoxLayout() + self.title_label = TitleLabel("应用详情") + self.close_button = PushButton("关闭") + self.close_button.clicked.connect(self.close) + + self.title_layout.addWidget(self.title_label) + self.title_layout.addStretch() + self.title_layout.addWidget(self.close_button) + + # 创建滚动区域 + self.scroll_area = QScrollArea() + self.scroll_area.setWidgetResizable(True) + self.scroll_content = QWidget() + self.scroll_layout = QVBoxLayout(self.scroll_content) + + # 添加滚动区域到主布局 + self.scroll_area.setWidget(self.scroll_content) + + # 将标题区域和滚动区域添加到主布局 + self.main_layout.addLayout(self.title_layout) + self.main_layout.addWidget(self.scroll_area) + + # 加载应用详情 + self.load_app_detail() + + def load_app_detail(self): + """加载应用详情""" + try: + # 这里应该调用API获取应用详情 + # 暂时使用模拟数据 + app_data = { + "id": self.app_id, + "name": "示例应用", + "description": "这是一个示例应用,用于展示应用详情页面", + "developer_id": "1", + "developer_name": "示例开发者", + "status": "approved", + "version": "1.0.0", + "created_at": "2023-01-01 10:00:00" + } + + # 清空滚动区域 + for i in reversed(range(self.scroll_layout.count())): + widget = self.scroll_layout.itemAt(i).widget() + if widget is not None: + widget.setParent(None) + widget.deleteLater() + + # 显示应用基本信息 + self.display_app_info(app_data) + + # 显示应用描述 + self.display_app_description(app_data) + + # 显示操作按钮 + self.display_action_buttons() + + except Exception as e: + InfoBar.error( + title="错误", + content=f"加载应用详情失败: {str(e)}", + orient=Qt.Horizontal, + isClosable=True, + position=InfoBarPosition.TOP, + duration=3000, + parent=self + ) + + def display_app_info(self, app_data): + """显示应用基本信息""" + info_group = QGroupBox("基本信息") + info_layout = QFormLayout() + + # 设置表单布局标签对齐 + info_layout.setLabelAlignment(Qt.AlignRight | Qt.AlignVCenter) + + # 添加基本信息字段 + info_layout.addRow("应用ID:", QLabel(app_data.get("id", "--"))) + info_layout.addRow("应用名称:", QLabel(app_data.get("name", "--"))) + info_layout.addRow("开发者ID:", QLabel(app_data.get("developer_id", "--"))) + info_layout.addRow("开发者名称:", QLabel(app_data.get("developer_name", "--"))) + info_layout.addRow("应用状态:", QLabel(app_data.get("status", "--"))) + info_layout.addRow("当前版本:", QLabel(app_data.get("version", "--"))) + info_layout.addRow("创建时间:", QLabel(app_data.get("created_at", "--"))) + + info_group.setLayout(info_layout) + self.scroll_layout.addWidget(info_group) + + def display_app_description(self, app_data): + """显示应用描述""" + description_group = QGroupBox("应用描述") + description_layout = QVBoxLayout() + + description_text = QTextEdit() + description_text.setReadOnly(True) + description_text.setPlainText(app_data.get("description", "无描述信息")) + + description_layout.addWidget(description_text) + description_group.setLayout(description_layout) + self.scroll_layout.addWidget(description_group) + + def display_action_buttons(self): + """显示操作按钮""" + buttons_layout = QHBoxLayout() + buttons_layout.addStretch() + + refresh_button = PushButton("刷新") + refresh_button.clicked.connect(self.load_app_detail) + + buttons_layout.addWidget(refresh_button) + self.scroll_layout.addLayout(buttons_layout) + + def closeEvent(self, event): + """关闭窗口事件""" + # 如果需要在关闭时执行清理操作,可以在这里添加 + event.accept() \ No newline at end of file diff --git a/pyqt5fluentdesign/leonapp_gui.py b/pyqt5fluentdesign/leonapp_gui.py index 9217da3..46a9b24 100644 --- a/pyqt5fluentdesign/leonapp_gui.py +++ b/pyqt5fluentdesign/leonapp_gui.py @@ -240,7 +240,10 @@ class AppTab(QWidget): def show_app_detail(self, row, column): """显示应用详情""" app_id = self.table.item(row, 0).text() - self.parent().show_app_detail(app_id) + # 直接创建应用详情窗口,而不是通过父对象调用方法 + from app_detail_window import AppDetailWindow + detail_window = AppDetailWindow(self.api_client, app_id, self) + detail_window.show() def show_progress(self): """显示进度条"""