进一步完成
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user