feat(Admin): SeatTemplateSave 时为无 id 的 room 生成 UUID

兜底逻辑:在保存场馆模板时,遍历 rooms,
若 room.id 为空则用 time()+mt_rand 生成唯一 UUID。
不修改已有数据的读取逻辑(读取端已有 room_N 兼容兜底)。
council/ProductManager
Council 2026-04-20 12:58:19 +08:00
parent 8a33e7fa29
commit 1244adfaae
1 changed files with 8 additions and 0 deletions

View File

@ -666,6 +666,14 @@ class Admin extends Common
return DataReturn('放映室名称不能为空', -1); return DataReturn('放映室名称不能为空', -1);
} }
// 生成 room.id兜底保证每个房间有唯一 id支持前端按 id 引用)
if (empty($room['id'])) {
$room['id'] = sprintf('%08x-%04x-%04x-%04x-%04x%08x',
time(), mt_rand(0, 0xffff), mt_rand(0, 0xffff),
mt_rand(0, 0x3fff) | 0x8000,
mt_rand(0, 0xffff), mt_rand(0, 0xffffffff));
}
// --- 自动补全 seats 字典,解决 'A' 未定义报错 --- // --- 自动补全 seats 字典,解决 'A' 未定义报错 ---
$room['seats'] = []; $room['seats'] = [];
if (!empty($room['sections']) && is_array($room['sections'])) { if (!empty($room['sections']) && is_array($room['sections'])) {