fix(reward-service): 修复与 wallet-service 的接口字段不匹配
修复 allocateFunds 接口: - targetType: 使用 USER/SYSTEM 而不是 rightType - targetId: 使用 accountSequence 而不是 userId - allocationType: 新增字段,存储 rightType - hashpowerPercent: 新增字段,传递算力百分比 🤖 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
d94badfa53
commit
518667e88e
|
|
@ -55,10 +55,13 @@ export class RewardApplicationService {
|
|||
const rewards = await this.rewardCalculationService.calculateRewards(params);
|
||||
|
||||
// 2. 调用 wallet-service 执行真正的资金分配
|
||||
// 字段映射:targetType=USER/SYSTEM, targetId=accountSequence, allocationType=rightType
|
||||
const allocations = rewards.map(reward => ({
|
||||
targetType: reward.rewardSource.rightType,
|
||||
targetType: reward.accountSequence.startsWith('S') ? 'SYSTEM' : 'USER',
|
||||
targetId: reward.accountSequence, // 使用 accountSequence 而不是 userId
|
||||
allocationType: reward.rewardSource.rightType,
|
||||
amount: reward.usdtAmount.amount,
|
||||
targetAccountId: `USER:${reward.userId}`,
|
||||
hashpowerPercent: reward.hashpowerAmount.value > 0 ? reward.hashpowerAmount.value : undefined,
|
||||
metadata: {
|
||||
rightType: reward.rewardSource.rightType,
|
||||
sourceOrderNo: params.sourceOrderNo,
|
||||
|
|
|
|||
|
|
@ -10,9 +10,17 @@ export interface SwapResult {
|
|||
}
|
||||
|
||||
export interface FundAllocationItem {
|
||||
targetType: string;
|
||||
// 目标类型: USER 或 SYSTEM
|
||||
targetType: 'USER' | 'SYSTEM';
|
||||
// 目标ID: accountSequence (如 D2512120001 或 S0000000001)
|
||||
targetId: string;
|
||||
// 分配类型 (如 COST_FEE, SHARE_RIGHT 等)
|
||||
allocationType: string;
|
||||
// 金额 (USDT)
|
||||
amount: number;
|
||||
targetAccountId: string;
|
||||
// 算力百分比(可选)
|
||||
hashpowerPercent?: number;
|
||||
// 元数据
|
||||
metadata?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue