fix(AdminGoodsSaveHandle): save_thing_end 改为直接读 DB 而非 值拷贝

确保 template_snapshot 兜底逻辑在正确的数据上执行:
1. ShopXO save_thing_end 传入的 $data 是值拷贝,改用 Db::find() 直接从DB读
2. 加 json_last_error() 检查,防止损坏的 JSON 静默失败
council/ProductManager
Council 2026-04-20 11:28:34 +08:00
parent 3f06f36e50
commit ca7bee5494
1 changed files with 6 additions and 1 deletions

View File

@ -57,9 +57,14 @@ class AdminGoodsSaveHandle
$goodsId = $params['goods_id'] ?? 0;
if ($goodsId > 0 && ($data['item_type'] ?? '') === 'ticket') {
$rawConfig = $data['vr_goods_config'] ?? '';
// 直接从数据库读 vr_goods_config避免 $params['data'] 值拷贝的引用链问题)
$goodsRow = Db::name('Goods')->field('vr_goods_config')->find($goodsId);
$rawConfig = $goodsRow['vr_goods_config'] ?? '';
if (!empty($rawConfig)) {
$configs = json_decode($rawConfig, true);
if (json_last_error() !== JSON_ERROR_NONE) {
$configs = null;
}
if (is_array($configs) && !empty($configs)) {
// 0) 填充 template_snapshot前端没传、或 rooms 为空时兜底从 vr_seat_templates 读)