fix(AdminGoodsSaveHandle): save_thing_end 改为直接读 DB 而非 值拷贝
确保 template_snapshot 兜底逻辑在正确的数据上执行: 1. ShopXO save_thing_end 传入的 $data 是值拷贝,改用 Db::find() 直接从DB读 2. 加 json_last_error() 检查,防止损坏的 JSON 静默失败council/ProductManager
parent
3f06f36e50
commit
ca7bee5494
|
|
@ -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 读)
|
||||
|
|
|
|||
Loading…
Reference in New Issue