fix(referral): 团队预种总量排除自己的预种份数

TeamStatistics.teamPrePlantingPortions 包含用户自身的预种量,
但"团队预种"应只统计伞下成员。返回时减去 selfPrePlantingPortions。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-02 19:03:08 -08:00
parent b59d5bda2d
commit eb425b0f92
1 changed files with 7 additions and 3 deletions

View File

@ -50,7 +50,7 @@ export class TeamPrePlantingController {
type: 'object',
properties: {
selfPrePlantingPortions: { type: 'number', description: '个人预种份数' },
teamPrePlantingPortions: { type: 'number', description: '团队预种总量(含自己和所有下级' },
teamPrePlantingPortions: { type: 'number', description: '团队预种总量(不含自己,仅伞下成员' },
directReferrals: {
type: 'array',
items: {
@ -123,9 +123,13 @@ export class TeamPrePlantingController {
directReferralStats.sort((a, b) => b.selfPrePlantingPortions - a.selfPrePlantingPortions);
}
const selfPortions = myStats?.selfPrePlantingPortions ?? 0;
const teamPortions = myStats?.teamPrePlantingPortions ?? 0;
return {
selfPrePlantingPortions: myStats?.selfPrePlantingPortions ?? 0,
teamPrePlantingPortions: myStats?.teamPrePlantingPortions ?? 0,
selfPrePlantingPortions: selfPortions,
// 团队预种量不含自己,只统计伞下成员
teamPrePlantingPortions: teamPortions - selfPortions,
directReferrals: directReferralStats,
};
}