feat(pre-planting): 预种权益流水备注添加[预种]前缀
wallet-service 新增 prePlantingPrefix 私有方法, 当 FundAllocationItem.metadata.source === 'PRE_PLANTING' 时, 在流水 memo 中添加 "[预种] " 前缀,使用户可区分预种与普通认种权益。 仅影响 pre-planting 新增的分配流水,不修改任何普通认种 memo。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1d0e4352df
commit
d9c238702e
|
|
@ -283,6 +283,7 @@ export class InternalPrePlantingController {
|
||||||
targetId: e.recipientAccountSequence,
|
targetId: e.recipientAccountSequence,
|
||||||
allocationType: e.rightType,
|
allocationType: e.rightType,
|
||||||
amount: Number(e.usdtAmount),
|
amount: Number(e.usdtAmount),
|
||||||
|
metadata: { source: 'PRE_PLANTING' },
|
||||||
})),
|
})),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,8 @@ export class PrePlantingRewardService {
|
||||||
targetId: a.recipientAccountSequence,
|
targetId: a.recipientAccountSequence,
|
||||||
allocationType: a.rightType,
|
allocationType: a.rightType,
|
||||||
amount: a.amount,
|
amount: a.amount,
|
||||||
|
// source 标识供 wallet-service 在流水备注中加"[预种]"前缀,与普通认种权益区分
|
||||||
|
metadata: { source: 'PRE_PLANTING' },
|
||||||
})),
|
})),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1038,6 +1038,15 @@ export class WalletApplicationService {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [新增] 预种来源备注前缀
|
||||||
|
* 当 metadata.source === 'PRE_PLANTING' 时返回 "[预种] ",否则返回空字符串。
|
||||||
|
* 只影响预种权益流水,不修改普通认种的任何备注。
|
||||||
|
*/
|
||||||
|
private prePlantingPrefix(allocation: FundAllocationItem): string {
|
||||||
|
return allocation.metadata?.source === 'PRE_PLANTING' ? '[预种] ' : '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查分配是否已存在(幂等性检查)
|
* 检查分配是否已存在(幂等性检查)
|
||||||
* 通过查询流水表判断该订单+账户+分配类型是否已处理
|
* 通过查询流水表判断该订单+账户+分配类型是否已处理
|
||||||
|
|
@ -1117,7 +1126,7 @@ export class WalletApplicationService {
|
||||||
entryType: LedgerEntryType.REWARD_TO_SETTLEABLE,
|
entryType: LedgerEntryType.REWARD_TO_SETTLEABLE,
|
||||||
amount,
|
amount,
|
||||||
refOrderId: orderId,
|
refOrderId: orderId,
|
||||||
memo: `${allocation.allocationType} allocation (direct settleable)`,
|
memo: `${this.prePlantingPrefix(allocation)}${allocation.allocationType} allocation (direct settleable)`,
|
||||||
payloadJson: {
|
payloadJson: {
|
||||||
allocationType: allocation.allocationType,
|
allocationType: allocation.allocationType,
|
||||||
metadata: allocation.metadata,
|
metadata: allocation.metadata,
|
||||||
|
|
@ -1156,7 +1165,7 @@ export class WalletApplicationService {
|
||||||
entryType: LedgerEntryType.REWARD_PENDING,
|
entryType: LedgerEntryType.REWARD_PENDING,
|
||||||
amount,
|
amount,
|
||||||
refOrderId: orderId,
|
refOrderId: orderId,
|
||||||
memo: `${allocation.allocationType} allocation`,
|
memo: `${this.prePlantingPrefix(allocation)}${allocation.allocationType} allocation`,
|
||||||
payloadJson: {
|
payloadJson: {
|
||||||
allocationType: allocation.allocationType,
|
allocationType: allocation.allocationType,
|
||||||
expireAt: expireAt.toISOString(),
|
expireAt: expireAt.toISOString(),
|
||||||
|
|
@ -1220,8 +1229,8 @@ export class WalletApplicationService {
|
||||||
amount,
|
amount,
|
||||||
refOrderId: orderId,
|
refOrderId: orderId,
|
||||||
memo: isUserAccount
|
memo: isUserAccount
|
||||||
? `${allocation.allocationType} - community authorization allocation (settleable)`
|
? `${this.prePlantingPrefix(allocation)}${allocation.allocationType} - community authorization allocation (settleable)`
|
||||||
: `${allocation.allocationType} - headquarters community allocation (settleable)`,
|
: `${this.prePlantingPrefix(allocation)}${allocation.allocationType} - headquarters community allocation (settleable)`,
|
||||||
payloadJson: {
|
payloadJson: {
|
||||||
allocationType: allocation.allocationType,
|
allocationType: allocation.allocationType,
|
||||||
metadata: allocation.metadata,
|
metadata: allocation.metadata,
|
||||||
|
|
@ -1283,7 +1292,7 @@ export class WalletApplicationService {
|
||||||
entryType: LedgerEntryType.REWARD_TO_SETTLEABLE,
|
entryType: LedgerEntryType.REWARD_TO_SETTLEABLE,
|
||||||
amount,
|
amount,
|
||||||
refOrderId: orderId,
|
refOrderId: orderId,
|
||||||
memo: `${allocation.allocationType} - region account allocation (settleable)`,
|
memo: `${this.prePlantingPrefix(allocation)}${allocation.allocationType} - region account allocation (settleable)`,
|
||||||
payloadJson: {
|
payloadJson: {
|
||||||
allocationType: allocation.allocationType,
|
allocationType: allocation.allocationType,
|
||||||
metadata: allocation.metadata,
|
metadata: allocation.metadata,
|
||||||
|
|
@ -1343,7 +1352,7 @@ export class WalletApplicationService {
|
||||||
entryType: LedgerEntryType.SYSTEM_ALLOCATION,
|
entryType: LedgerEntryType.SYSTEM_ALLOCATION,
|
||||||
amount,
|
amount,
|
||||||
refOrderId: orderId,
|
refOrderId: orderId,
|
||||||
memo: `${allocation.allocationType} - system account allocation`,
|
memo: `${this.prePlantingPrefix(allocation)}${allocation.allocationType} - system account allocation`,
|
||||||
payloadJson: {
|
payloadJson: {
|
||||||
allocationType: allocation.allocationType,
|
allocationType: allocation.allocationType,
|
||||||
metadata: allocation.metadata,
|
metadata: allocation.metadata,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue