fix(authorization-service): 修复 identity-service 响应解析
- 处理 TransformInterceptor 包装的响应格式 { success, data }
- 正确提取 data 字段中的用户信息
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
136c831922
commit
b04dd1f234
|
|
@ -54,13 +54,15 @@ export class IdentityServiceClient implements OnModuleInit {
|
||||||
try {
|
try {
|
||||||
this.logger.debug(`[HTTP] POST /internal/users/batch - ${accountSequences.length} users`);
|
this.logger.debug(`[HTTP] POST /internal/users/batch - ${accountSequences.length} users`);
|
||||||
|
|
||||||
const response = await this.httpClient.post<UserInfo[]>(
|
const response = await this.httpClient.post<{ success: boolean; data: UserInfo[] }>(
|
||||||
`/api/v1/internal/users/batch`,
|
`/api/v1/internal/users/batch`,
|
||||||
{ accountSequences },
|
{ accountSequences },
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.data && Array.isArray(response.data)) {
|
// identity-service 使用 TransformInterceptor 包装响应为 { success, data }
|
||||||
for (const user of response.data) {
|
const users = response.data?.data || response.data;
|
||||||
|
if (users && Array.isArray(users)) {
|
||||||
|
for (const user of users) {
|
||||||
result.set(user.accountSequence, user);
|
result.set(user.accountSequence, user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue