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:
parent
8501cc34dc
commit
7c2d0b8b7f
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue