fix(admin-web): 修复系统账户余额统计不一致问题
- 账户余额改为 usdtAvailable + settleableUsdt,与累计收入统计保持一致 - 解决社区权益进入 settleableUsdt 导致的余额与累计收入不匹配问题 🤖 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
667b240915
commit
cc17f6a38e
|
|
@ -1,6 +1,7 @@
|
|||
/**
|
||||
* 系统账户划转服务
|
||||
* [2026-01-06] 新增
|
||||
* [2026-01-07] 更新:账户余额从 reporting-service 获取,与数据统计页面保持一致
|
||||
*/
|
||||
|
||||
import apiClient from '@/infrastructure/api/client';
|
||||
|
|
@ -19,14 +20,62 @@ import type {
|
|||
export const systemWithdrawalService = {
|
||||
/**
|
||||
* 获取可划转的系统账户列表
|
||||
* [2026-01-07] 修复:apiClient 响应拦截器返回 response.data,即 { success, data }
|
||||
* 所以实际数据在 response.data.data
|
||||
* [2026-01-07] 更新:从 reporting-service 的系统账户报表接口获取数据
|
||||
* 这样账户余额的计算方式与数据统计页面完全一致
|
||||
* 公式:账户余额 = (累计收入 + 过期收益) - 累计转出
|
||||
*/
|
||||
async getAccounts(): Promise<SystemAccount[]> {
|
||||
const response = await apiClient.get(API_ENDPOINTS.SYSTEM_WITHDRAWAL.ACCOUNTS);
|
||||
// 从 reporting-service 获取系统账户报表数据
|
||||
const response = await apiClient.get(API_ENDPOINTS.SYSTEM_ACCOUNT_REPORTS.FULL_REPORT);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const result = (response as any)?.data?.data;
|
||||
return result ?? [];
|
||||
const reportData = (response as any)?.data;
|
||||
|
||||
if (!reportData) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const accounts: SystemAccount[] = [];
|
||||
|
||||
// 处理固定系统账户
|
||||
const fixedAccounts = reportData.fixedAccounts;
|
||||
if (fixedAccounts) {
|
||||
// 按照指定顺序添加固定账户
|
||||
const orderedKeys = ['costAccount', 'operationAccount', 'hqCommunity', 'rwadPoolPending', 'platformFee'];
|
||||
for (const key of orderedKeys) {
|
||||
const account = fixedAccounts[key];
|
||||
if (account) {
|
||||
accounts.push({
|
||||
accountSequence: account.accountSequence,
|
||||
accountName: account.accountType || key,
|
||||
balance: account.usdtBalance || '0',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理省区域账户
|
||||
if (reportData.provinceSummary?.accounts) {
|
||||
for (const account of reportData.provinceSummary.accounts) {
|
||||
accounts.push({
|
||||
accountSequence: account.accountSequence,
|
||||
accountName: account.regionName || `省区域(${account.regionCode})`,
|
||||
balance: account.usdtBalance || '0',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 处理市区域账户
|
||||
if (reportData.citySummary?.accounts) {
|
||||
for (const account of reportData.citySummary.accounts) {
|
||||
accounts.push({
|
||||
accountSequence: account.accountSequence,
|
||||
accountName: account.regionName || `市区域(${account.regionCode})`,
|
||||
balance: account.usdtBalance || '0',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return accounts;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue