fix(订单中台): 修复自定义表单标题映射循环变量覆盖缓存凭证键

This commit is contained in:
From-wh 2026-10-21 11:44:56 +08:00 committed by 吴昊天
parent 0aea3f94c7
commit 61f7006a44

View File

@ -1231,8 +1231,9 @@ class CenterOrderController
$detailExtend = $handler->getDetailExtend($productId);
$productCustomForm = $detailExtend['custom_form'] ?? [];
$fieldTitleMap = [];
foreach ($productCustomForm as $key => $item) {
$fieldTitleMap['custom_field_' . $key] = $item['title'] ?? ('自定义字段' . ($key + 1));
// 循环变量不得使用 $key:外层 $key 是订单确认缓存凭证,覆盖后 consumeOrderCache 会因类型错误崩溃
foreach ($productCustomForm as $fieldKey => $fieldItem) {
$fieldTitleMap['custom_field_' . $fieldKey] = $fieldItem['title'] ?? ('自定义字段' . ($fieldKey + 1));
}
$structured = [];
foreach ($submittedCustomForm as $field => $value) {