From a980eb7a1c8ca647cf2c95f55fd0730b7e5560aa Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Tue, 8 Jul 2025 19:21:54 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=BA=94=E7=94=A8=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E5=BA=94=E7=94=A8=E5=AE=A1=E6=A0=B8=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=92=8C=E6=97=A5=E5=BF=97=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在app_store.sql中添加应用审核状态字段 - 重构日志系统到单独文件并实现日志分级 - 改进开发者注册和上传应用的错误处理和日志记录 - 为应用详情页添加评价分页加载功能 - 更新SMTP配置并增强邮件发送调试能力 --- app.php | 119 ++++++++++++++++++++++++++++++++------- app_store.sql | 5 +- config.php | 23 +++----- developer/register.php | 62 ++++++++++++++++---- developer/upload_app.php | 49 +++++++++++++--- includes/logger.php | 56 ++++++++++++++++++ 6 files changed, 259 insertions(+), 55 deletions(-) create mode 100644 includes/logger.php diff --git a/app.php b/app.php index b6b9a91..aa9931c 100644 --- a/app.php +++ b/app.php @@ -28,6 +28,35 @@ if (!$app) { die("

错误:应用不存在

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

"); } +// 处理评价加载请求 +if (isset($_GET['action']) && $_GET['action'] === 'load_reviews') { + header('Content-Type: text/html; charset=UTF-8'); + while ($review = $resultReviews->fetch_assoc()) { +?> +
+
+ 评分: '; + for ($i = 1; $i <= 5; $i++) { + if ($i <= floor($rating)) { + echo ''; + } elseif ($i - $rating <= 0.5) { + echo ''; + } else { + echo ''; + } + } + echo '

'; + ?> +

评价时间:

+
+
+query($sqlVersions); @@ -36,8 +65,19 @@ $resultVersions = $conn->query($sqlVersions); $sqlImages = "SELECT * FROM app_images WHERE app_id = $appId"; $resultImages = $conn->query($sqlImages); +// 获取评价总数 +$sqlReviewCount = "SELECT COUNT(*) as total FROM reviews WHERE app_id = $appId"; +$resultReviewCount = $conn->query($sqlReviewCount); +$reviewCount = $resultReviewCount->fetch_assoc()['total']; + +// 分页参数 +$page = isset($_GET['page']) ? (int)$_GET['page'] : 1; +$limit = 10; +$offset = ($page - 1) * $limit; +$hasMore = ($page * $limit) < $reviewCount; + // 获取评价信息 -$sqlReviews = "SELECT * FROM reviews WHERE app_id = $appId ORDER BY created_at DESC"; +$sqlReviews = "SELECT * FROM reviews WHERE app_id = $appId ORDER BY created_at DESC LIMIT $limit OFFSET $offset"; $resultReviews = $conn->query($sqlReviews); // 获取评分分布 @@ -188,33 +228,72 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['rating'])) {

评价

- fetch_assoc()): ?> -
-
- 评分: '; - for ($i = 1; $i <= 5; $i++) { - if ($i <= floor($rating)) { - echo ''; - } elseif ($i - $rating <= 0.5) { - echo ''; - } else { - echo ''; +
+ fetch_assoc()): ?> +
+
+ 评分: '; + for ($i = 1; $i <= 5; $i++) { + if ($i <= floor($rating)) { + echo ''; + } elseif ($i - $rating <= 0.5) { + echo ''; + } else { + echo ''; + } } - } - echo '

'; - ?> -

评价时间:

+ echo '

'; + ?> +

评价时间:

+
-
- + +
+ + +

评分分布