Files

41 lines
1.6 KiB
PHP
Raw Permalink Normal View History

<?php
/**
* 首页卡片 · 观影(v62 新增)。
*
* 数据来自 `HomeCards::moviesData()`(最近 8 条,只查卡片要用的那几列 ——
* 不用 Movie::all():那个会顺带查同行人与影评统计,卡片上都不显示)。
*
* @var array $cardData['movies'] 每项含 id/title/starts_at/poster_key/cinema_name
*/
$mvRows = (array)($cardData['movies'] ?? []);
?>
<div class="hc-body">
<?php if (!$mvRows): ?>
<p class="empty-hint">还没有观影记录。</p>
<?php else: ?>
<ul class="hc-mv-list">
<?php foreach ($mvRows as $m): ?>
<li class="hc-mv">
<a class="hc-mv-poster" href="<?= e(url('movies/show', ['id' => (int)$m['id']])) ?>">
<?php if (!empty($m['poster_key'])): ?>
<img src="<?= e(media_url((string)$m['poster_key'])) ?>" alt="" loading="lazy">
<?php else: ?>
<span class="hc-mv-ph" aria-hidden="true">🎬</span>
<?php endif; ?>
</a>
<div class="hc-mv-main">
<a class="hc-mv-t" href="<?= e(url('movies/show', ['id' => (int)$m['id']])) ?>"
title="<?= e((string)$m['title']) ?>"><?= e((string)$m['title']) ?></a>
<span class="small muted">
<?= e(substr((string)($m['starts_at'] ?? ''), 0, 10)) ?>
<?php if (trim((string)($m['cinema_name'] ?? '')) !== ''): ?>
· <?= e((string)$m['cinema_name']) ?>
<?php endif; ?>
</span>
</div>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>