Files
junhong_cmp_fiber/openspec/changes/archive/2026-03-05-fix-tiered-commission-tier-fields/tasks.md
huang b52cb9a078
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m27s
fix: 修复梯度佣金档位字段缺失,补全授权接口响应字段及强充有效状态
- OneTimeCommissionTierDTO 补充 operator 字段映射
- GrantCommissionTierItem 补充 dimension/stat_scope 字段(从全局配置合并)
- 系列授权列表/详情补充强充锁定状态和强充金额的有效值计算
- 同步 OpenSpec 主规范并归档变更文档
2026-03-05 11:23:28 +08:00

56 lines
4.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 1. 套餐系列 DTO 修复Operator 字段)
- [x] 1.1 `internal/model/dto/package_series_dto.go``OneTimeCommissionTierDTO` 新增 `Operator string` 字段tag 为 `json:"operator,omitempty" validate:"omitempty,oneof=> >= < <=" description:"阈值比较运算符(>、>=、<、<=),空值时计算引擎默认 >="`
- [x] 1.2 `internal/service/package_series/service.go``dtoToModelConfig()``OneTimeCommissionTier` 赋值新增 `Operator: tier.Operator`
- [x] 1.3 `internal/service/package_series/service.go``modelToDTO()``OneTimeCommissionTierDTO` 赋值新增 `Operator: tier.Operator`
- [x] 1.4 运行 `go build ./...` 确认无编译错误
## 2. 授权分配 DTO 修复Dimension / StatScope 字段)
- [x] 2.1 `internal/model/dto/shop_series_grant_dto.go``GrantCommissionTierItem` 新增两个字段:
- `Dimension string`tag 为 `json:"dimension,omitempty" description:"统计维度sales_count:销售量, sales_amount:销售额),来自 PackageSeries 全局配置,响应中只读"`
- `StatScope string`tag 为 `json:"stat_scope,omitempty" description:"统计范围self:仅自己, self_and_sub:自己+下级),来自 PackageSeries 全局配置,响应中只读"`
- [x] 2.2 `internal/service/shop_series_grant/service.go``buildGrantResponse()` 梯度模式合并分支,在构造 `GrantCommissionTierItem` 时补充 `Dimension: globalTier.Dimension``StatScope: globalTier.StatScope`
- [x] 2.3 运行 `go build ./...` 确认无编译错误
## 3. 验证
- [x] 3.1 db-validation创建含 `operator`/`dimension`/`stat_scope` 的梯度套餐系列,查询详情确认响应中 tiers 包含完整字段
- [x] 3.2 db-validation创建梯度模式系列授权调用 `GET /shop-series-grants/:id`,确认 `commission_tiers` 中每档位包含 `operator``dimension``stat_scope``threshold``amount`
- [x] 3.3 db-validation调用 `POST /shop-series-grants`Create`PUT /shop-series-grants/:id`Update确认响应中同样携带 `dimension`/`stat_scope`
- [x] 3.4 db-validation不传 `operator` 的梯度档位,确认响应中 `operator` 字段缺失omitempty 生效),不影响佣金计算逻辑
## 4. 强充状态有效展示修复
- [x] 4.1 `internal/model/dto/shop_series_grant_dto.go``ShopSeriesGrantListItem` 新增两个字段:
- `ForceRechargeLocked bool`tag 为 `json:"force_recharge_locked" description:"强充是否被套餐系列锁定true 时代理不可修改)"`
- `ForceRechargeAmount int64`tag 为 `json:"force_recharge_amount" description:"强充金额(分)"`
- [x] 4.2 `internal/service/shop_series_grant/service.go`列表构建for 循环内的 `if sr, ok := seriesMap[a.SeriesID]` 分支)修正强充状态字段:
```go
forceRechargeLocked := config.TriggerType == model.OneTimeCommissionTriggerFirstRecharge || config.EnableForceRecharge
item.ForceRechargeLocked = forceRechargeLocked
if forceRechargeLocked {
item.ForceRechargeEnabled = true
item.ForceRechargeAmount = config.ForceAmount
} else {
item.ForceRechargeEnabled = a.EnableForceRecharge
item.ForceRechargeAmount = a.ForceRechargeAmount
}
```
- [x] 4.3 `internal/service/shop_series_grant/service.go``buildGrantResponse()` 内强充状态计算修正(当前约 L132-L135
```go
if forceRechargeLocked {
resp.ForceRechargeEnabled = true
resp.ForceRechargeAmount = config.ForceAmount
} else {
resp.ForceRechargeEnabled = allocation.EnableForceRecharge
resp.ForceRechargeAmount = allocation.ForceRechargeAmount
}
```
- [x] 4.4 运行 `go build ./...` 确认无编译错误
## 5. 强充 Bug 验证
- [x] 5.1 db-validation查询套餐系列中 `enable_force_recharge=true` 的系列(如 series_id=21172118对应的授权分配列表确认 `force_recharge_locked=true`、`force_recharge_enabled=true`、`force_recharge_amount=系列配置值`
- [x] 5.2 db-validation调用 `GET /api/admin/shop-series-grants/:id`(锁定系列的分配记录),确认详情响应中 `force_recharge_locked=true`、`force_recharge_enabled=true`