From b4b96a444b2fc174ced91a792ef40e448edc70ea Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Tue, 8 Jul 2025 12:40:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E8=80=85=E7=A4=BE=E4=BA=A4=E9=93=BE=E6=8E=A5=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=92=8C=E7=AE=A1=E7=90=86=E5=91=98=E7=B3=BB=E7=BB=9F=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在developers表中添加social_links字段用于存储开发者社交链接 - 新增开发者个人资料编辑页面(profile.php) - 在开发者应用页面展示社交链接 - 新增管理员系统信息页面(system_info.php)用于管理上传文件 - 更新导航菜单添加相关功能入口 - 修复平台图标显示问题并优化Font Awesome引用方式 --- admin/index.php | 3 + admin/system_info.php | 194 ++++++++++++++++++++++++++++++++++++++++ app.php | 14 +-- app_store.sql | 4 + app_store_update.sql | 3 + developer/dashboard.php | 13 +-- developer/profile.php | 189 ++++++++++++++++++++++++++++++++++++++ developer_apps.php | 25 +++++- 8 files changed, 431 insertions(+), 14 deletions(-) create mode 100644 admin/system_info.php create mode 100644 app_store_update.sql create mode 100644 developer/profile.php diff --git a/admin/index.php b/admin/index.php index c2d1b28..c4e1ec1 100644 --- a/admin/index.php +++ b/admin/index.php @@ -80,6 +80,9 @@ if (!$resultApps) { + diff --git a/admin/system_info.php b/admin/system_info.php new file mode 100644 index 0000000..ff7e427 --- /dev/null +++ b/admin/system_info.php @@ -0,0 +1,194 @@ + $file, + 'size' => $file_size, + 'type' => strpos($dir, 'images') !== false ? '图片' : '文件' + ]; + } + } + } + } + } + + return $uploaded_files; +} + +$uploaded_files = get_uploaded_files_info(); +?> + + + + + + 系统信息 - 上传文件列表 + + + + + + + + + +
+
+

上传文件信息

+ + + + + + + + + + + + + + + + + + + +
文件名大小
KB
+ +

上传图片信息

+ + + + + + + + + + + + + + + + + + + +
文件名大小
KB
+ + +
+
+ + + + + + + + \ No newline at end of file diff --git a/app.php b/app.php index dd8e658..b6b9a91 100644 --- a/app.php +++ b/app.php @@ -65,7 +65,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['rating'])) { - + @@ -116,11 +116,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['rating'])) {

适用平台: '', - 'Mac' => '', - 'Linux' => '', - 'Android' => '', - 'iOS' => '' + 'windows' => '', + 'macos' => '', + 'linux' => '', + 'android' => '', + 'ios' => '' ]; $platformMap = [ 'android' => 'Android', @@ -134,7 +134,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['rating'])) { $platformTexts = []; foreach ($platforms as $platform) { - $icon = $platformIcons[ucfirst($platform)] ?? ''; + $icon = $platformIcons[strtolower($platform)] ?? ''; $readableName = $platformMap[strtolower($platform)] ?? ucfirst($platform); $platformTexts[] = $icon . ' ' . $readableName; } diff --git a/app_store.sql b/app_store.sql index 79da58b..29a570a 100644 --- a/app_store.sql +++ b/app_store.sql @@ -198,6 +198,10 @@ EXECUTE stmt; DEALLOCATE PREPARE stmt; SET @exist_fk = (SELECT COUNT(*) FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'apps' AND COLUMN_NAME = 'developer_id' AND CONSTRAINT_NAME = 'fk_apps_developers'); + +-- 添加 social_links 字段到 developers 表 +ALTER TABLE developers +ADD COLUMN social_links VARCHAR(255) DEFAULT '' AFTER password; SET @sql = IF(@exist_fk = 0, 'ALTER TABLE apps ADD CONSTRAINT fk_apps_developers FOREIGN KEY (developer_id) REFERENCES developers(id) ON DELETE SET NULL', 'SELECT 1'); PREPARE stmt FROM @sql; EXECUTE stmt; diff --git a/app_store_update.sql b/app_store_update.sql new file mode 100644 index 0000000..78502ca --- /dev/null +++ b/app_store_update.sql @@ -0,0 +1,3 @@ +-- 添加 social_links 字段到 developers 表 +ALTER TABLE developers +ADD COLUMN social_links VARCHAR(255) DEFAULT '' AFTER password; \ No newline at end of file diff --git a/developer/dashboard.php b/developer/dashboard.php index fe089c1..ceca2a4 100644 --- a/developer/dashboard.php +++ b/developer/dashboard.php @@ -145,11 +145,14 @@ if (!($conn instanceof mysqli)) { 应用仪表盘

- + 上传应用 + + + diff --git a/developer/profile.php b/developer/profile.php new file mode 100644 index 0000000..c1b301b --- /dev/null +++ b/developer/profile.php @@ -0,0 +1,189 @@ +prepare('SELECT username, email, social_links FROM developers WHERE id = ?'); + if (!$stmt) { + log_error('获取开发者信息查询准备失败: ' . $conn->error, __FILE__, __LINE__); + $error = '获取开发者信息时发生错误,请稍后再试'; + } else { + $stmt->bind_param('i', $developerId); + if (!$stmt->execute()) { + log_error('获取开发者信息查询执行失败: ' . $stmt->error, __FILE__, __LINE__); + $error = '获取开发者信息时发生错误,请稍后再试'; + } else { + $result = $stmt->get_result(); + $developer = $result->fetch_assoc(); + } + } + + // 处理表单提交 + if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $newUsername = trim($_POST['username']); + $newEmail = trim($_POST['email']); + $newPassword = $_POST['password']; + $newSocialLinks = trim($_POST['social_links']); + + // 更新用户名和邮箱 + $stmt = $conn->prepare('UPDATE developers SET username = ?, email = ?, social_links = ? WHERE id = ?'); + if (!$stmt) { + log_error('更新开发者信息查询准备失败: ' . $conn->error, __FILE__, __LINE__); + $error = '更新信息时发生错误,请稍后再试'; + } else { + $stmt->bind_param('sssi', $newUsername, $newEmail, $newSocialLinks, $developerId); + if (!$stmt->execute()) { + log_error('更新开发者信息查询执行失败: ' . $stmt->error, __FILE__, __LINE__); + $error = '更新信息时发生错误,请稍后再试'; + } else { + // 更新密码 + if (!empty($newPassword)) { + $hashedPassword = password_hash($newPassword, PASSWORD_DEFAULT); + $stmt = $conn->prepare('UPDATE developers SET password = ? WHERE id = ?'); + if (!$stmt) { + log_error('更新密码查询准备失败: ' . $conn->error, __FILE__, __LINE__); + $error = '更新密码时发生错误,请稍后再试'; + } else { + $stmt->bind_param('si', $hashedPassword, $developerId); + if (!$stmt->execute()) { + log_error('更新密码查询执行失败: ' . $stmt->error, __FILE__, __LINE__); + $error = '更新密码时发生错误,请稍后再试'; + } + } + } + if (empty($error)) { + $success = '信息更新成功'; + $_SESSION['developer_username'] = $newUsername; + // 重新获取开发者信息 + $stmt = $conn->prepare('SELECT username, email, social_links FROM developers WHERE id = ?'); + if ($stmt) { + $stmt->bind_param('i', $developerId); + if ($stmt->execute()) { + $result = $stmt->get_result(); + $developer = $result->fetch_assoc(); + } + } + } + } + } + } +} +?> + + + + + + + 开发者信息 - <?php echo APP_STORE_NAME; ?> + + + + + + + + + + +
+ +
+ + +
+ + +

开发者信息

+
+
+ + +
+ + ?>" required> +
+
+ + +
+
+ + +
+
+ + +
+ + + + + diff --git a/developer_apps.php b/developer_apps.php index a500e0c..ce857a7 100644 --- a/developer_apps.php +++ b/developer_apps.php @@ -11,7 +11,7 @@ if (!isset($_GET['id']) || !is_numeric($_GET['id'])) { $developerId = intval($_GET['id']); // 获取开发者信息 -$sqlDeveloper = "SELECT username FROM developers WHERE id = $developerId"; +$sqlDeveloper = "SELECT username, social_links FROM developers WHERE id = $developerId"; $resultDeveloper = $conn->query($sqlDeveloper); $developer = $resultDeveloper->fetch_assoc(); @@ -40,7 +40,7 @@ $resultApps = $conn->query($sqlApps); - + @@ -96,6 +96,27 @@ $resultApps = $conn->query($sqlApps);

的应用


+ +
+
开发者链接
+
+ + + + + + +
+
+ num_rows > 0): ?>