From 7c2d0b8b7f9925b6115b3eb51851ca1ec9b8c141 Mon Sep 17 00:00:00 2001 From: hailin Date: Tue, 23 Dec 2025 07:09:31 -0800 Subject: [PATCH] =?UTF-8?q?fix(authorization):=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8D=87=E7=BA=A7=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?totalTeamPlantingCount=E5=B7=B2=E6=98=AF=E4=BC=9E=E4=B8=8B?= =?UTF-8?q?=E8=AE=A4=E7=A7=8D=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit referral-service 返回的 totalTeamPlantingCount 已经是不含自己的伞下认种数, 无需再减去 selfPlantingCount。更新注释说明。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../kafka/event-consumer.controller.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/backend/services/authorization-service/src/infrastructure/kafka/event-consumer.controller.ts b/backend/services/authorization-service/src/infrastructure/kafka/event-consumer.controller.ts index 15edbed7..457f61be 100644 --- a/backend/services/authorization-service/src/infrastructure/kafka/event-consumer.controller.ts +++ b/backend/services/authorization-service/src/infrastructure/kafka/event-consumer.controller.ts @@ -531,6 +531,7 @@ export class EventConsumerController { /** * 检查单个省团队是否可以升级为省区域 * 业务规则:省团队本人伞下认种数(不含自己)达到5万棵时自动升级 + * 注意:referral-service 返回的 totalTeamPlantingCount 已经是不含自己的伞下认种数 */ private async checkAuthProvinceUpgrade(authProvince: AuthorizationRole): Promise { 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 { 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 }