diff --git a/developer_apps.php b/developer_apps.php index f042b12..561685f 100644 --- a/developer_apps.php +++ b/developer_apps.php @@ -143,6 +143,25 @@ $resultApps = $conn->query($sqlApps);
...
+ prepare($tagSql); + $tagStmt->bind_param('i', $app['id']); + $tagStmt->execute(); + $tagResult = $tagStmt->get_result(); + $tags = []; + while ($tag = $tagResult->fetch_assoc()) { + $tags[] = htmlspecialchars($tag['name']); + } + $tagStmt->close(); + + // 获取应用适用平台 + $platforms = json_decode($app['platforms'], true); + + echo '标签: '. implode(', ', $tags) . '
'; + echo '平台: '. implode(', ', $platforms) . '
'; + ?>
评分: /5
diff --git a/index.php b/index.php
index 6ca3deb..98ced7b 100644
--- a/index.php
+++ b/index.php
@@ -177,7 +177,7 @@ $announcement = $announcementResult && $announcementResult->num_rows > 0 ? $anno
// 基于标签推荐应用
if (!empty($tagIds)) {
$placeholders = implode(',', array_fill(0, count($tagIds), '?'));
- $recommendSql = "SELECT a.id, a.name, a.description, a.age_rating, AVG(r.rating) as avg_rating
+ $recommendSql = "SELECT a.id, a.name, a.description, a.age_rating, a.platforms, AVG(r.rating) as avg_rating
FROM apps a
LEFT JOIN reviews r ON a.id = r.app_id
JOIN app_tags at ON a.id = at.app_id
@@ -213,6 +213,23 @@ $announcement = $announcementResult && $announcementResult->num_rows > 0 ? $anno
echo ' '. substr(htmlspecialchars($row['description']), 0, 100) . '... 标签: '. implode(', ', $tags) . ' 平台: '. implode(', ', $platforms) . ' 评分: '. round($row['avg_rating'] ?? 0, 1) . '/5 '. substr($row['description'], 0, 100) . '... 标签: '. implode(', ', $tags) . ' 平台: '. implode(', ', $platforms) . ' 评分: '. round($row['avg_rating'], 1) . '/5 ... 评分: /5'. htmlspecialchars($row['name']) . '
';
echo ''. $row['name'] . '
';
echo '
';
+ $platforms = $platforms ?? [];
+ echo ' 平台: '. implode(', ', $platforms) . '
';
+ echo ' 评分: '. round($row['avg_rating'], 1) . '/5
';
+ echo '';
+ ?>
查看详情