进一步完成

This commit is contained in:
2025-10-15 19:41:26 +08:00
parent 348a990f88
commit d715a5fcf0
5 changed files with 11 additions and 5 deletions

View File

@@ -155,7 +155,7 @@ if (!function_exists('replace_placeholder_keys')) {
if (!function_exists('replace_json_keys')) {
function replace_json_keys($originalJson, $mapJson)
function replace_json_keys($originalJson, $mapJson, $user)
{
$originalData = json_decode($originalJson, true);
$mapData = json_decode($mapJson, true);
@@ -168,6 +168,9 @@ if (!function_exists('replace_json_keys')) {
// 如果原始键在映射中存在,则替换为对应的新键;否则保留原键
$newKey = $reverseMap[$oldKey] ?? $oldKey;
$newData[$newKey] = $value;
if($newKey == 'username') {
$newData[$newKey] = $user['nick_name'];
}
}
$newJson = json_encode($newData, JSON_UNESCAPED_UNICODE);
return $newJson;