fix(authorization): 修正自动升级逻辑,totalTeamPlantingCount已是伞下认种数

referral-service 返回的 totalTeamPlantingCount 已经是不含自己的伞下认种数,
无需再减去 selfPlantingCount。更新注释说明。

🤖 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-23 07:09:31 -08:00
parent 8501cc34dc
commit 7c2d0b8b7f
1 changed files with 8 additions and 6 deletions

View File

@ -531,6 +531,7 @@ export class EventConsumerController {
/**
*
* 5
* referral-service totalTeamPlantingCount
*/
private async checkAuthProvinceUpgrade(authProvince: AuthorizationRole): Promise<void> {
const accountSequence = authProvince.userId.accountSequence
@ -544,12 +545,12 @@ export class EventConsumerController {
return
}
// 伞下认种数 = 团队总认种数 - 自己认种数
const subordinateCount = teamStats.totalTeamPlantingCount - teamStats.selfPlantingCount
// totalTeamPlantingCount 已经是伞下认种数(不含自己)
const subordinateCount = teamStats.totalTeamPlantingCount
// 2. 检查伞下认种数是否达到省区域升级阈值5万棵
if (subordinateCount < EventConsumerController.PROVINCE_UPGRADE_THRESHOLD) {
this.logger.debug(`[TEAM-AUTO-UPGRADE] Auth province ${accountSequence} has subordinate count ${subordinateCount} (total=${teamStats.totalTeamPlantingCount}, self=${teamStats.selfPlantingCount}), not reaching ${EventConsumerController.PROVINCE_UPGRADE_THRESHOLD} threshold`)
this.logger.debug(`[TEAM-AUTO-UPGRADE] Auth province ${accountSequence} has subordinate count ${subordinateCount}, not reaching ${EventConsumerController.PROVINCE_UPGRADE_THRESHOLD} threshold`)
return
}
@ -621,6 +622,7 @@ export class EventConsumerController {
/**
*
* 1
* referral-service totalTeamPlantingCount
*/
private async checkAuthCityUpgrade(authCity: AuthorizationRole): Promise<void> {
const accountSequence = authCity.userId.accountSequence
@ -634,12 +636,12 @@ export class EventConsumerController {
return
}
// 伞下认种数 = 团队总认种数 - 自己认种数
const subordinateCount = teamStats.totalTeamPlantingCount - teamStats.selfPlantingCount
// totalTeamPlantingCount 已经是伞下认种数(不含自己)
const subordinateCount = teamStats.totalTeamPlantingCount
// 2. 检查伞下认种数是否达到市区域升级阈值1万棵
if (subordinateCount < EventConsumerController.CITY_UPGRADE_THRESHOLD) {
this.logger.debug(`[TEAM-AUTO-UPGRADE] Auth city ${accountSequence} has subordinate count ${subordinateCount} (total=${teamStats.totalTeamPlantingCount}, self=${teamStats.selfPlantingCount}), not reaching ${EventConsumerController.CITY_UPGRADE_THRESHOLD} threshold`)
this.logger.debug(`[TEAM-AUTO-UPGRADE] Auth city ${accountSequence} has subordinate count ${subordinateCount}, not reaching ${EventConsumerController.CITY_UPGRADE_THRESHOLD} threshold`)
return
}