# Phase 2 — 计划与当前状态 > 版本:v3.0 | 日期:2026-04-20 | 状态:实现准备就绪 > 关联提交:c894e7018(模板渲染)、1b0ac3276(精简 footer) > 关联文档:`docs/VR_GOODS_CONFIG_SPEC.md`(v3.0 JSON 格式,已确认) --- ## ⚠️ v3.0 重大变更摘要 - `vr_goods_config` 包含完整 `rooms[]` 快照,不再查 `vr_seat_templates` 表 - `spec_base_id_map` 不入库,GetGoodsViewData 动态从 `goods_spec_base.extends->seat_key` 构建 - `selected_sections` 改为数组格式 `["A","B"]`(不是对象) 完整规格见 `docs/VR_GOODS_CONFIG_SPEC.md`。 --- ## 一、Phase 2 当前状态 ### ✅ 已完成 | 任务 | 提交 | 说明 | |------|------|------| | 模板渲染 | c894e7018 | PHP ModuleInclude,渲染正常 | | 票务专用 footer | 1b0ac3276 | 精简 footer | ### ⚠️ 实现准备就绪(待动手) | 任务 | 说明 | 依赖 | |------|------|------| | BatchGenerate 写入 extends | 存储 seat_key 到 goods_spec_base.extends | VR_GOODS_CONFIG_SPEC.md 已确认 | | GetGoodsViewData 重写 | 动态构建 spec_base_id_map + 适配 selected_sections | 同上 | | ticket_detail.html JS 更新 | seatKey 格式改为 roomId_rowLabel_colNum | 同上 | ### ❌ 未开始 | 任务 | |------| | 核销 API | | 后台 4 控制器联调 | | AdminGoodsSaveHandle selected_sections 透传确认 | --- ## 二、vr_goods_config v3.0 结构(已确认) ```json { "version": 1.0, "template_id": 4, "selected_rooms": ["room_id_xxx"], "selected_sections": ["A", "B"], "sessions": [{ "start": "15:00", "end": "16:59" }], "venue": { "name": "...", "address": "...", "location": {}, "images": [] }, "rooms": [{ "id": "room_id_xxx", "name": "...", "map": [...], "sections": [...], "seats": {...} }] } ``` 详细字段说明见 `docs/VR_GOODS_CONFIG_SPEC.md` 第一章。 --- ## 三、spec_base_id_map 解决方案(已确认) ### 断路根因 BatchGenerate 生成 GoodsSpecBase.id 后,从未写入 spec_base_id_map。前端用 `roomId_row_col` 格式查,存储端从未按此格式写入。 ### 解决方案:使用 goods_spec_base.extends ``` BatchGenerate 写入时: extends.seat_key = "room_id_rowLabel_colNum" (无 MD5) GetGoodsViewData 读取时: 遍历 goods_spec_base(inventory > 0) → 解析 extends.seat_key → 构建 spec_base_id_map[key] = id 前端 submit() 时: seatKey = seat.roomId + '_' + seat.rowLabel + '_' + seat.colNum specBaseId = spec_base_id_map[seatKey] ``` 详见 `docs/VR_GOODS_CONFIG_SPEC.md` 第三章。 --- ## 四、下一步工作(实现顺序) ### Step 1:BatchGenerate 写入 extends ```php // SeatSkuService::BatchGenerate() 中,insertGetId 前: $extends = json_encode([ 'seat_key' => $roomId . '_' . $rowLabel . '_' . $col ], JSON_UNESCAPED_UNICODE); // insertGetId 中加入: 'extends' => $extends, ``` ### Step 2:GetGoodsViewData 重写 ```php // 1. 读取 vr_goods_config[0] // 2. 直接透传 rooms[] / sessions[] / selected_sections / venue // 3. 动态构建 spec_base_id_map(从 goods_spec_base.extends) // 4. 生成 goods_spec_data(场次+最低价聚合) // 5. 返回 { vr_seat_template, goods_spec_data, goods_config } ``` ### Step 3:ticket_detail.html JS ```javascript // seatKey 格式改为带 roomId: var seatKey = seat.roomId + '_' + seat.rowLabel + '_' + seat.colNum; // 例:"room_id_1776341371905_A_3" var specBaseId = self.specBaseIdMap[seatKey] || 0; ``` --- ## 五、模板渲染当前状态 | 项目 | 状态 | |------|------| | 模板渲染 | ✅ 正常 | | 票务 footer | ✅ 已精简 | | 场次显示 | ❌ 待 GetGoodsViewData 重写 | | 座位图渲染 | ❌ 待 GetGoodsViewData + JS 更新 | | 已售座位标记 | ❌ 待 loadSoldSeats() 实现 |