feat(wallet-service): 新增分享权益池账户S0000000005

- 新增 S0000000005 分享权益池系统账户 (user_id = -5)
- 修改 reward-service: 无推荐人的分享权益(500 USDT/棵)进入分享权益池
- 与总部社区账户(S0000000001)分离,便于单独追踪无推荐人的分享权益

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-13 18:53:21 -08:00
parent 947e81b58d
commit b705c6aa91
2 changed files with 19 additions and 5 deletions

View File

@ -59,6 +59,9 @@ const OPERATION_FEE_ACCOUNT_ID = BigInt(3);
// RWAD 1号底池账户ID (需要在系统初始化时创建)
const RWAD_POOL_ACCOUNT_ID = BigInt(4);
// 分享权益池账户ID (无推荐人时分享权益进入此账户)
const SHARE_RIGHT_POOL_USER_ID = BigInt(-5);
@Injectable()
export class RewardCalculationService {
private readonly logger = new Logger(RewardCalculationService.name);
@ -370,15 +373,15 @@ export class RewardCalculationService {
})];
}
} else {
// 无推荐人,进总部社区
this.logger.debug(`[calculateShareRights] no referrer -> HEADQUARTERS`);
// 无推荐人,进分享权益池 (S0000000005)
this.logger.debug(`[calculateShareRights] no referrer -> SHARE_RIGHT_POOL (S0000000005)`);
return [RewardLedgerEntry.createSettleable({
userId: HEADQUARTERS_COMMUNITY_USER_ID,
accountSequence: 'S0000000001',
userId: SHARE_RIGHT_POOL_USER_ID,
accountSequence: 'S0000000005',
rewardSource,
usdtAmount,
hashpowerAmount: hashpower,
memo: '分享权益:无推荐人,进总部社区',
memo: '分享权益:无推荐人,进分享权益池',
})];
}
}

View File

@ -0,0 +1,11 @@
-- Add share right pool account for users without referrers
-- When a user plants a tree but has no inviter, the 500 USDT share right
-- goes to this dedicated pool instead of the headquarters community account
-- S0000000005: 分享权益池 (Share Right Pool)
-- Receives: 无推荐人用户的分享权益 500 USDT per tree
INSERT INTO "wallet_accounts" (
"account_sequence", "user_id", "status", "created_at", "updated_at"
) VALUES (
'S0000000005', -5, 'ACTIVE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP
) ON CONFLICT ("account_sequence") DO NOTHING;