From d7f7d7082d29e021cc3f74d21c205dfda392fe7e Mon Sep 17 00:00:00 2001 From: hailin Date: Tue, 3 Mar 2026 01:56:21 -0800 Subject: [PATCH] =?UTF-8?q?fix(pricing):=20=E9=A2=84=E7=A7=8D=E5=AE=9A?= =?UTF-8?q?=E4=BB=B7API=E5=B8=B8=E9=87=8F=E5=90=8C=E6=AD=A5=20=E2=80=94=20?= =?UTF-8?q?3566=E2=86=921887,=20/5=E2=86=92/10,=20=E6=AD=A3=E5=BC=8F?= =?UTF-8?q?=E8=AE=A4=E7=A7=8D15831=E4=B8=8D=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit admin-service tree-pricing.service.ts: - BASE_PORTION_PRICE: 3566 → 1887 - supplement 除数: /5 → /PORTIONS_PER_TREE(10) - BASE_PRICE 保持 15831(正式认种价格不变) - 移除 updateSupplement 中重复声明的 BASE_PRICE 局部变量 planting-service tree-pricing-admin.client.ts: - fallback basePortionPrice/totalPortionPrice: 3566 → 1887 mobile-app tree_pricing_service.dart: - 修正上次commit误改的 basePrice/totalPrice fallback: 18870 → 15831 - basePortionPrice/totalPortionPrice 保持 1887 Co-Authored-By: Claude Opus 4.6 --- .../admin-service/src/pricing/tree-pricing.service.ts | 11 +++++------ .../external/tree-pricing-admin.client.ts | 4 ++-- .../lib/core/services/tree_pricing_service.dart | 10 +++++----- 3 files changed, 12 insertions(+), 13 deletions(-) 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,