From 379a72ecd35b2a2afd27d7c0338beb173b46ed77 Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Wed, 9 Jul 2025 14:38:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E7=8A=B6=E6=80=81=E6=A3=80=E6=9F=A5=E5=92=8C?= =?UTF-8?q?=E4=BD=BF=E7=94=A8SweetAlert=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在app.php中添加应用审核状态检查,未通过审核时显示提示弹窗 - 引入SweetAlert2库用于统一弹窗样式 - 修改登录逻辑支持邮箱/用户名两种登录方式 - 修复profile.php中的表单标签错误 - 在数据库中添加is_approved字段标记应用审核状态 - 添加项目规则文档规定统一使用SweetAlert弹窗 --- .trae/rules/project_rules.md | 1 + app.php | 21 +++++++++++++++++++++ app_store.sql | 1 + developer/login.php | 16 ++++++++-------- developer/profile.php | 4 +--- 5 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 .trae/rules/project_rules.md diff --git a/.trae/rules/project_rules.md b/.trae/rules/project_rules.md new file mode 100644 index 0000000..cc1782e --- /dev/null +++ b/.trae/rules/project_rules.md @@ -0,0 +1 @@ +弹窗都用Sweet Alert弹窗 \ No newline at end of file diff --git a/app.php b/app.php index 8ff12dc..2ccab49 100644 --- a/app.php +++ b/app.php @@ -28,6 +28,24 @@ if (!$app) { die("

错误:应用不存在

找不到ID为 $appId 的应用。请检查ID是否正确。

"); } +// 检查应用审核状态 +if ($app['status'] != 'approved') { + echo ''; +} + // 处理评价加载请求 if (isset($_GET['action']) && $_GET['action'] === 'load_reviews') { header('Content-Type: text/html; charset=UTF-8'); @@ -118,6 +136,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['rating'])) { + + + diff --git a/app_store.sql b/app_store.sql index 9473a14..467cb11 100644 --- a/app_store.sql +++ b/app_store.sql @@ -14,6 +14,7 @@ CREATE TABLE IF NOT EXISTS apps ( changelog TEXT NOT NULL, file_path VARCHAR(255) NOT NULL, status ENUM('pending', 'approved', 'rejected') DEFAULT 'pending', + is_approved TINYINT(1) DEFAULT 0 COMMENT '应用是否已审核', developer_email VARCHAR(255) NOT NULL ); diff --git a/developer/login.php b/developer/login.php index a4e459e..e6f2a54 100644 --- a/developer/login.php +++ b/developer/login.php @@ -41,23 +41,23 @@ if (isset($_GET['register_success']) && $_GET['register_success'] == 1) { } if ($_SERVER['REQUEST_METHOD'] === 'POST') { - $email = trim($_POST['email']); + $loginId = trim($_POST['login_id']); $password = $_POST['password']; - if (empty($email) || empty($password)) { - $error = '邮箱和密码不能为空'; + if (empty($loginId) || empty($password)) { + $error = '邮箱/用户名和密码不能为空'; } else { // 检查数据库连接是否为 MySQLi 对象 if (!($conn instanceof mysqli)) { log_error('数据库连接错误: 连接不是MySQLi实例', __FILE__, __LINE__); $error = '数据库连接错误,请检查配置'; } else { - $stmt = $conn->prepare('SELECT id, username, password FROM developers WHERE email = ?'); + $stmt = $conn->prepare('SELECT id, username, password FROM developers WHERE email = ? OR username = ?'); if (!$stmt) { log_error('登录查询准备失败: ' . $conn->error, __FILE__, __LINE__); $error = '登录时发生错误,请稍后再试'; } else { - $stmt->bind_param('s', $email); + $stmt->bind_param('ss', $loginId, $loginId); if (!$stmt->execute()) { log_error('登录查询执行失败: ' . $stmt->error, __FILE__, __LINE__); $error = '登录时发生错误,请稍后再试'; @@ -70,7 +70,7 @@ if (!($conn instanceof mysqli)) { header('Location: dashboard.php'); exit; } else { - $error = '邮箱或密码错误'; + $error = '邮箱/用户名或密码错误'; } } } @@ -104,8 +104,8 @@ if (!($conn instanceof mysqli)) {
- - + +
diff --git a/developer/profile.php b/developer/profile.php index c1b301b..b3c4f7e 100644 --- a/developer/profile.php +++ b/developer/profile.php @@ -167,9 +167,7 @@ if (!($conn instanceof mysqli)) {
- - ?>" required> - +