feat(应用展示): 在多个页面添加应用标签和平台信息展示
在开发者应用、标签和应用列表页面中,添加了应用标签和平台信息的展示功能。修改了SQL查询以包含platforms字段,并添加了获取标签的查询逻辑,将信息显示在卡片组件中,提升用户体验。
This commit is contained in:
@@ -143,6 +143,25 @@ $resultApps = $conn->query($sqlApps);
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><?php echo htmlspecialchars($app['name']); ?></h5>
|
||||
<p class="card-text"><?php echo htmlspecialchars(substr($app['description'], 0, 100)); ?>...</p>
|
||||
<?php
|
||||
// 获取应用标签
|
||||
$tagSql = "SELECT t.name FROM tags t JOIN app_tags at ON t.id = at.tag_id WHERE at.app_id = ?";
|
||||
$tagStmt = $conn->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 '<p class="card-text">标签: '. implode(', ', $tags) . '</p>';
|
||||
echo '<p class="card-text">平台: '. implode(', ', $platforms) . '</p>';
|
||||
?>
|
||||
<p class="card-text">
|
||||
<small class="text-muted">
|
||||
评分: <?php echo round($app['avg_rating'] ?? 0, 1); ?>/5
|
||||
|
||||
Reference in New Issue
Block a user