fix(mining-admin): 解包mining-service响应信封,取response.data.data
mining-service返回 { success, data: { ... } } 格式,
mining-admin-service需要取 .data.data 而非 .data,
否则前端读到的是信封对象而非实际数据,导致 TypeError。
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
48720d1846
commit
7549b2b9a9
|
|
@ -47,7 +47,8 @@ export class SystemAccountsService {
|
||||||
);
|
);
|
||||||
|
|
||||||
const miningDataMap = new Map<string, MiningServiceSystemAccount>();
|
const miningDataMap = new Map<string, MiningServiceSystemAccount>();
|
||||||
for (const account of response.data.accounts) {
|
const body = response.data?.data ?? response.data;
|
||||||
|
for (const account of body.accounts) {
|
||||||
// 使用 accountType:regionCode 作为 key,与 contribution 表一致
|
// 使用 accountType:regionCode 作为 key,与 contribution 表一致
|
||||||
const key = account.regionCode
|
const key = account.regionCode
|
||||||
? `${account.accountType}:${account.regionCode}`
|
? `${account.accountType}:${account.regionCode}`
|
||||||
|
|
@ -321,7 +322,7 @@ export class SystemAccountsService {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return response.data;
|
return response.data?.data ?? response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.warn(
|
this.logger.warn(
|
||||||
`Failed to fetch system account mining records: ${error.message}`,
|
`Failed to fetch system account mining records: ${error.message}`,
|
||||||
|
|
@ -365,7 +366,7 @@ export class SystemAccountsService {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return response.data;
|
return response.data?.data ?? response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.warn(
|
this.logger.warn(
|
||||||
`Failed to fetch system account transactions: ${error.message}`,
|
`Failed to fetch system account transactions: ${error.message}`,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue