fix(pricing): 预种定价API常量同步 — 3566→1887, /5→/10, 正式认种15831不变

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 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-03 01:56:21 -08:00
parent 1e31d6d863
commit d7f7d7082d
3 changed files with 12 additions and 13 deletions

View File

@ -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<TreePricingConfigResponse> {
// 允许负数(降价对冲),但总价不能低于 0
const BASE_PRICE = 15831;
if (BASE_PRICE + newSupplement < 0) {
throw new Error(`调价金额不能低于 -${BASE_PRICE},否则总价为负`);
}

View File

@ -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,

View File

@ -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<String, dynamic> 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,