Skip to content

Commit

Permalink
feat: 支持映射转换返回结构中的值
Browse files Browse the repository at this point in the history
  • Loading branch information
jiannei committed Mar 10, 2022
1 parent 8894257 commit 012d611
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,11 @@ protected function formatDataFields(array $responseData, array $dataFieldsConfig

$alias = $fieldConfig['alias'] ?? $field;
$show = $fieldConfig['show'] ?? true;
$map = $fieldConfig['map'] ?? null;
unset($responseData[$field]);

if ($show) {
$responseData[$alias] = $value;
$responseData[$alias] = $map[$value] ?? $value;
}
}

Expand Down

0 comments on commit 012d611

Please sign in to comment.