fix: Db::find() 全量查询 + fallback 到 params[data];同时加调试日志

council/ProductManager
Council 2026-04-20 12:25:02 +08:00
parent 0a2fd29d7c
commit 5dc9a98420
1 changed files with 7 additions and 3 deletions

View File

@ -57,9 +57,13 @@ class AdminGoodsSaveHandle
$goodsId = $params['goods_id'] ?? 0;
if ($goodsId > 0 && ($data['item_type'] ?? '') === 'ticket') {
// 直接从数据库读 vr_goods_config避免 $params['data'] 值拷贝的引用链问题)
$goodsRow = Db::name('Goods')->field('vr_goods_config')->find($goodsId);
$rawConfig = $goodsRow['vr_goods_config'] ?? '';
// 直接从数据库读 vr_goods_config全量查询不加 field 限制,避免 ThinkPHP 软删除过滤导致查不到)
$goodsRow = Db::name('Goods')->find($goodsId);
$rawConfig = is_array($goodsRow) ? ($goodsRow['vr_goods_config'] ?? '') : '';
// 如果 DB 里没有( goodsRow 为空或 vr_goods_config 字段为空fallback 到 params[data]
if (empty($rawConfig)) {
$rawConfig = $data['vr_goods_config'] ?? '';
}
// DEBUG: 记录关键值
$debugPath = defined('RUNTIME_PATH') ? RUNTIME_PATH . 'vr_debug.log' : '/tmp/vr_debug.log';