diff --git a/backend/services/admin-service/src/pricing/tree-pricing.service.ts b/backend/services/admin-service/src/pricing/tree-pricing.service.ts index db9ae627..2f7e1bcd 100644 --- a/backend/services/admin-service/src/pricing/tree-pricing.service.ts +++ b/backend/services/admin-service/src/pricing/tree-pricing.service.ts @@ -2,8 +2,9 @@ import { Injectable, Logger } from '@nestjs/common'; import { PrismaService } from '../infrastructure/persistence/prisma/prisma.service'; /** 基础价常量 */ -const BASE_PRICE = 15831; -const BASE_PORTION_PRICE = 3566; // 预种基础价:9项 floor(整棵树/5) 取整 + 余额归总部 +const BASE_PRICE = 15831; // 正式认种基础价(不变) +const BASE_PORTION_PRICE = 1887; // 预种基础价 [2026-03-01 调整] 9项 floor(18870/10) 取整 + 总部吸收余额 +const PORTIONS_PER_TREE = 10; // [2026-03-01 调整] 5 → 10 份/棵 export interface TreePricingConfigResponse { basePrice: number; @@ -52,9 +53,8 @@ export class TreePricingService { } const totalPrice = BASE_PRICE + config.currentSupplement; - // 预种价格 = 基础预种价(3566) + floor(加价部分/5) - // 注意:3566 不是 15831/5,而是各权益项 floor(amount/5) 之和 + 总部吸收余额 - const totalPortionPrice = BASE_PORTION_PRICE + Math.floor(config.currentSupplement / 5); + // 预种价格 = 基础预种价(1887) + floor(加价部分/10) + const totalPortionPrice = BASE_PORTION_PRICE + Math.floor(config.currentSupplement / PORTIONS_PER_TREE); return { basePrice: BASE_PRICE, basePortionPrice: BASE_PORTION_PRICE, @@ -80,7 +80,6 @@ export class TreePricingService { operatorId: string, ): Promise { // 允许负数(降价对冲),但总价不能低于 0 - const BASE_PRICE = 15831; if (BASE_PRICE + newSupplement < 0) { throw new Error(`调价金额不能低于 -${BASE_PRICE},否则总价为负`); } diff --git a/backend/services/planting-service/src/infrastructure/external/tree-pricing-admin.client.ts b/backend/services/planting-service/src/infrastructure/external/tree-pricing-admin.client.ts index 0bb76c15..a2b7a8e2 100644 --- a/backend/services/planting-service/src/infrastructure/external/tree-pricing-admin.client.ts +++ b/backend/services/planting-service/src/infrastructure/external/tree-pricing-admin.client.ts @@ -48,10 +48,10 @@ export class TreePricingAdminClient { // 安全降级:加价为 0,不影响现有业务 return { basePrice: 15831, - basePortionPrice: 3566, + basePortionPrice: 1887, currentSupplement: 0, totalPrice: 15831, - totalPortionPrice: 3566, + totalPortionPrice: 1887, autoIncreaseEnabled: false, autoIncreaseAmount: 0, autoIncreaseIntervalDays: 0, diff --git a/frontend/mobile-app/lib/core/services/tree_pricing_service.dart b/frontend/mobile-app/lib/core/services/tree_pricing_service.dart index 293272df..28403ad0 100644 --- a/frontend/mobile-app/lib/core/services/tree_pricing_service.dart +++ b/frontend/mobile-app/lib/core/services/tree_pricing_service.dart @@ -7,7 +7,7 @@ import '../network/api_client.dart'; /// - 正式认种总价 = basePrice + currentSupplement /// - 预种总价 = totalPrice / 10(取整) class TreePricingConfig { - /// 正式认种基础价(固定 18870) + /// 正式认种基础价(固定 15831) final int basePrice; /// 预种基础价(固定 1887) @@ -48,10 +48,10 @@ class TreePricingConfig { factory TreePricingConfig.fromJson(Map json) { return TreePricingConfig( - basePrice: json['basePrice'] ?? 18870, + basePrice: json['basePrice'] ?? 15831, basePortionPrice: json['basePortionPrice'] ?? 1887, currentSupplement: json['currentSupplement'] ?? 0, - totalPrice: json['totalPrice'] ?? 18870, + totalPrice: json['totalPrice'] ?? 15831, totalPortionPrice: json['totalPortionPrice'] ?? 1887, autoIncreaseEnabled: json['autoIncreaseEnabled'] ?? false, autoIncreaseAmount: json['autoIncreaseAmount'] ?? 0, @@ -65,10 +65,10 @@ class TreePricingConfig { /// 默认配置(supplement=0,与原硬编码价格一致) factory TreePricingConfig.defaultConfig() { return TreePricingConfig( - basePrice: 18870, + basePrice: 15831, basePortionPrice: 1887, currentSupplement: 0, - totalPrice: 18870, + totalPrice: 15831, totalPortionPrice: 1887, autoIncreaseEnabled: false, autoIncreaseAmount: 0,