v9: 观影对齐 MovieLog —— 瀑布流/影院管理/评价评论/起止时间
- events 起止时间精确到秒(starts_at DATE→DATETIME + ends_at),_datetime.php 复用 - 影院独立成表(cinemas,地方/名称/地址/主题色 + 50 色板),movie_details 归一为 cinema_id - 评价模型 MovieLog 同款:movie_reviews 每账号每片一条(1-10 分+正文+感受 key), movie_review_comments 两级平铺评论(回复的回复规范化到顶层、跨评价回复拦截) - 感受目录迁到 MovieReview::CATALOG(12 种,Emoji 11.0 老码位) - 观影列表改瀑布流(CSS grid 海报墙),详情页五大块 + 灯箱 + 评价区 - 升级路径:v8 老数据自动归一(影院三段按 (family,place,name) 去重建行、 评价回填、中文感受反查英文 key),回填全部幂等;老库补 cinema_id 列+索引+外键 - 修三 bug:建表顺序(cinemas 必须在 movie_details 前,否则全新安装 1215)、 layout 导航用键名当路由(影院链接指向 r=cinemas)、 _datetime.php 分钟循环变量 $m 覆盖宿主模板的观影记录(编辑页简介/备注回填被清空)
This commit is contained in:
+43
-60
@@ -2,24 +2,31 @@
|
||||
/**
|
||||
* 观影表单(新增 / 编辑,一张表单两用 —— 与 people/form 同一思路)。
|
||||
*
|
||||
* 字段分三块:看什么(片名/日期/评分/感受)、跟谁(同行的人)、在哪看(影院三段),
|
||||
* 再加自由文本(简介/观后感/备注)。海报与票根是 free 槽位(v8):
|
||||
* 不进裁剪器、整图等比缩进框内,所以这里不放裁剪框,只放普通文件控件。
|
||||
* v9 变化:观影时间改为「开始 / 结束」两个秒级时刻(_datetime.php 控件,
|
||||
* 服务端 read_dt_input 取值);评分与观后感**移出表单** —— 搬到详情页的
|
||||
* 「评价与评论」区(MovieLog 同款:每账号一条评价,谁都能评);影院改为
|
||||
* 下拉选择已有影院 + 可选「新建影院」行内三段。
|
||||
*
|
||||
* 现场照片只在**新增**时提供多选;编辑时在详情页里逐张补/删 ——
|
||||
* 一次改一处的表单,比一个巨型表单不容易出错。
|
||||
* 海报与票根是 free 槽位(v8):不进裁剪器、整图等比缩进框内,普通文件控件即可。
|
||||
* 现场照片只在**新增**时提供多选;编辑时在详情页里逐张补/删。
|
||||
*/
|
||||
$isEdit = !empty($m['id']);
|
||||
|
||||
// 回填:校验失败重画时用用户刚提交的值(old()),否则用库里的值
|
||||
// 时间回填:校验失败重画时优先用 old() 里的分字段重组(否则用户刚选的时刻会丢);
|
||||
// 正常进编辑页时用库里的值。
|
||||
$dtFromOld = static function (string $name, ?string $dbValue): ?string {
|
||||
$date = trim((string)old($name . '_date', ''));
|
||||
if ($date !== '') {
|
||||
return sprintf('%s %02d:%02d:%02d', $date,
|
||||
(int)old($name . '_hour', 0), (int)old($name . '_minute', 0), (int)old($name . '_second', 0));
|
||||
}
|
||||
return ($dbValue !== null && $dbValue !== '') ? $dbValue : null;
|
||||
};
|
||||
$dtStart = $dtFromOld('starts_at', $m['starts_at'] ?? null);
|
||||
$dtEnd = $dtFromOld('ends_at', $m['ends_at'] ?? null);
|
||||
$selCinema = (int)old('cinema_id', $m['cinema_id'] ?? 0);
|
||||
$curAttendees = array_map('intval', array_column($m['attendees'] ?? [], 'id'));
|
||||
$curFeelings = [];
|
||||
if (!empty($m['feelings'])) {
|
||||
$curFeelings = json_decode((string)$m['feelings'], true) ?: [];
|
||||
}
|
||||
$selAttendees = array_map('intval', (array)old('attendees', $curAttendees));
|
||||
$selFeelings = (array)old('feelings', $curFeelings);
|
||||
$rtVal = old('rating', $m['rating'] ?? '');
|
||||
?>
|
||||
<div class="page-head">
|
||||
<h1><?= $isEdit ? '编辑观影记录' : '记一场电影' ?></h1>
|
||||
@@ -41,34 +48,34 @@ $rtVal = old('rating', $m['rating'] ?? '');
|
||||
<?php if (!empty($errors['title'])): ?><span class="err"><?= e($errors['title']) ?></span><?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="starts_at">观影日期</label>
|
||||
<input class="input" id="starts_at" name="starts_at" type="date"
|
||||
value="<?= e(old('starts_at', $m['starts_at'] ?? '')) ?>">
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="rating">评分(1-10)</label>
|
||||
<select class="select" id="rating" name="rating">
|
||||
<option value="">不评</option>
|
||||
<?php for ($i = 10; $i >= 1; $i--): ?>
|
||||
<option value="<?= $i ?>" <?= (string)$rtVal === (string)$i ? 'selected' : '' ?>><?= $i ?></option>
|
||||
<?php endfor; ?>
|
||||
</select>
|
||||
<div class="field full">
|
||||
<label <?= $isEdit ? '' : 'for="starts_at_date"' ?>>开始时间(精确到秒)</label>
|
||||
<?php $dtName = 'starts_at'; $dtValue = $dtStart; $dtId = 'starts_at_date';
|
||||
require __DIR__ . '/../_datetime.php'; ?>
|
||||
<?php if (!empty($errors['starts_at'])): ?><span class="err"><?= e($errors['starts_at']) ?></span><?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="field full">
|
||||
<label>观后感受</label>
|
||||
<div class="feel-grid">
|
||||
<?php foreach (\App\Movie::FEELINGS as $f): ?>
|
||||
<label class="feel-item">
|
||||
<input type="checkbox" name="feelings[]" value="<?= e($f) ?>"
|
||||
<?= in_array($f, $selFeelings, true) ? 'checked' : '' ?>>
|
||||
<span><?= e($f) ?></span>
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
<label>结束时间(散场,可不填)</label>
|
||||
<?php $dtName = 'ends_at'; $dtValue = $dtEnd; $dtId = '';
|
||||
require __DIR__ . '/../_datetime.php'; ?>
|
||||
<?php if (!empty($errors['ends_at'])): ?><span class="err"><?= e($errors['ends_at']) ?></span><?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="field full">
|
||||
<label for="cinema_id">影院</label>
|
||||
<div class="cinema-select-row">
|
||||
<select class="select" id="cinema_id" name="cinema_id">
|
||||
<option value="0">不记录影院</option>
|
||||
<?php foreach ($cinemas as $c): ?>
|
||||
<option value="<?= (int)$c['id'] ?>" <?= $selCinema === (int)$c['id'] ? 'selected' : '' ?>>
|
||||
<?= e(trim(((string)($c['place'] ?? '') !== '' ? $c['place'] . ' · ' : '') . $c['name'])) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<a class="btn btn-ghost btn-sm" href="<?= e(url('movies/cinemas')) ?>">管理影院</a>
|
||||
</div>
|
||||
<span class="tip">MovieLog 里记的英文标签(warm / excited…)搬过来时已经翻成中文。</span>
|
||||
<span class="tip">想记一家还没录过的影院?先去「管理影院」里添加,回来这里就能选。</span>
|
||||
</div>
|
||||
|
||||
<div class="field full">
|
||||
@@ -88,36 +95,12 @@ $rtVal = old('rating', $m['rating'] ?? '');
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="cinema_place">影院 · 城市/商圈</label>
|
||||
<input class="input" id="cinema_place" name="cinema_place"
|
||||
value="<?= e(old('cinema_place', $m['cinema_place'] ?? '')) ?>" placeholder="如:青岛 · 崂山区">
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="cinema_name">影院 · 名字</label>
|
||||
<input class="input" id="cinema_name" name="cinema_name"
|
||||
value="<?= e(old('cinema_name', $m['cinema_name'] ?? '')) ?>" placeholder="如:万达影城 CBD 店">
|
||||
</div>
|
||||
|
||||
<div class="field full">
|
||||
<label for="cinema_address">影院 · 地址</label>
|
||||
<input class="input" id="cinema_address" name="cinema_address"
|
||||
value="<?= e(old('cinema_address', $m['cinema_address'] ?? '')) ?>">
|
||||
</div>
|
||||
|
||||
<div class="field full">
|
||||
<label for="info">简介</label>
|
||||
<textarea class="input" id="info" name="info" rows="3"
|
||||
placeholder="剧情简介(可选)"><?= e(old('info', $m['info'] ?? '')) ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="field full">
|
||||
<label for="review">观后感</label>
|
||||
<textarea class="input" id="review" name="review" rows="4"
|
||||
placeholder="看完想记下来的话"><?= e(old('review', $m['review'] ?? '')) ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="field full">
|
||||
<label for="note">备注</label>
|
||||
<textarea class="input" id="note" name="note" rows="2"><?= e(old('note', $m['note'] ?? '')) ?></textarea>
|
||||
|
||||
Reference in New Issue
Block a user