清理冗余的梯度返佣(TierCommission)配置
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m46s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m46s
- 移除 Model 层:删除 ShopSeriesCommissionTier 模型及相关字段 - 更新 DTO:删除 TierCommissionConfig、TierEntry 类型及相关请求/响应字段 - 删除 Store 层:移除 ShopSeriesCommissionTierStore 及相关查询逻辑 - 简化 Service 层:删除梯度返佣处理逻辑,统计查询移除 tier_bonus 字段 - 数据库迁移:创建 000034_remove_tier_commission 移除相关表和字段 - 更新测试:移除梯度返佣相关测试用例,更新集成测试 - OpenAPI 文档:删除梯度返佣相关 schema 和枚举值 - 归档变更:归档 remove-tier-commission-redundancy 到 archive/2026-01-30- - 同步规范:更新 4 个主 specs,标记废弃功能并添加迁移指引 原因:梯度返佣功能与一次性梯度佣金功能重复,且从未实现实际计算逻辑 迁移:使用一次性佣金的梯度模式 (OneTimeCommissionConfig.type = "tiered") 替代
This commit is contained in:
@@ -16,7 +16,6 @@ import (
|
||||
|
||||
type Service struct {
|
||||
allocationStore *postgres.ShopSeriesAllocationStore
|
||||
tierStore *postgres.ShopSeriesCommissionTierStore
|
||||
configStore *postgres.ShopSeriesAllocationConfigStore
|
||||
oneTimeCommissionTierStore *postgres.ShopSeriesOneTimeCommissionTierStore
|
||||
shopStore *postgres.ShopStore
|
||||
@@ -26,7 +25,6 @@ type Service struct {
|
||||
|
||||
func New(
|
||||
allocationStore *postgres.ShopSeriesAllocationStore,
|
||||
tierStore *postgres.ShopSeriesCommissionTierStore,
|
||||
configStore *postgres.ShopSeriesAllocationConfigStore,
|
||||
oneTimeCommissionTierStore *postgres.ShopSeriesOneTimeCommissionTierStore,
|
||||
shopStore *postgres.ShopStore,
|
||||
@@ -35,7 +33,6 @@ func New(
|
||||
) *Service {
|
||||
return &Service{
|
||||
allocationStore: allocationStore,
|
||||
tierStore: tierStore,
|
||||
configStore: configStore,
|
||||
oneTimeCommissionTierStore: oneTimeCommissionTierStore,
|
||||
shopStore: shopStore,
|
||||
@@ -106,13 +103,12 @@ func (s *Service) Create(ctx context.Context, req *dto.CreateShopSeriesAllocatio
|
||||
}
|
||||
|
||||
allocation := &model.ShopSeriesAllocation{
|
||||
ShopID: req.ShopID,
|
||||
SeriesID: req.SeriesID,
|
||||
AllocatorShopID: allocatorShopID,
|
||||
BaseCommissionMode: req.BaseCommission.Mode,
|
||||
BaseCommissionValue: req.BaseCommission.Value,
|
||||
EnableTierCommission: req.EnableTierCommission,
|
||||
Status: constants.StatusEnabled,
|
||||
ShopID: req.ShopID,
|
||||
SeriesID: req.SeriesID,
|
||||
AllocatorShopID: allocatorShopID,
|
||||
BaseCommissionMode: req.BaseCommission.Mode,
|
||||
BaseCommissionValue: req.BaseCommission.Value,
|
||||
Status: constants.StatusEnabled,
|
||||
}
|
||||
|
||||
// 处理一次性佣金配置
|
||||
@@ -192,12 +188,6 @@ func (s *Service) Update(ctx context.Context, id uint, req *dto.UpdateShopSeries
|
||||
allocation.BaseCommissionMode = req.BaseCommission.Mode
|
||||
allocation.BaseCommissionValue = req.BaseCommission.Value
|
||||
}
|
||||
if req.EnableTierCommission != nil {
|
||||
if allocation.EnableTierCommission != *req.EnableTierCommission {
|
||||
configChanged = true
|
||||
}
|
||||
allocation.EnableTierCommission = *req.EnableTierCommission
|
||||
}
|
||||
|
||||
enableOneTimeCommission := allocation.EnableOneTimeCommission
|
||||
if req.EnableOneTimeCommission != nil {
|
||||
@@ -409,7 +399,6 @@ func (s *Service) buildResponse(ctx context.Context, a *model.ShopSeriesAllocati
|
||||
Mode: a.BaseCommissionMode,
|
||||
Value: a.BaseCommissionValue,
|
||||
},
|
||||
EnableTierCommission: a.EnableTierCommission,
|
||||
EnableOneTimeCommission: a.EnableOneTimeCommission,
|
||||
Status: a.Status,
|
||||
CreatedAt: a.CreatedAt.Format(time.RFC3339),
|
||||
@@ -458,12 +447,11 @@ func (s *Service) createNewConfigVersion(ctx context.Context, allocation *model.
|
||||
}
|
||||
|
||||
newConfig := &model.ShopSeriesAllocationConfig{
|
||||
AllocationID: allocation.ID,
|
||||
Version: newVersion,
|
||||
BaseCommissionMode: allocation.BaseCommissionMode,
|
||||
BaseCommissionValue: allocation.BaseCommissionValue,
|
||||
EnableTierCommission: allocation.EnableTierCommission,
|
||||
EffectiveFrom: now,
|
||||
AllocationID: allocation.ID,
|
||||
Version: newVersion,
|
||||
BaseCommissionMode: allocation.BaseCommissionMode,
|
||||
BaseCommissionValue: allocation.BaseCommissionValue,
|
||||
EffectiveFrom: now,
|
||||
}
|
||||
|
||||
if err := s.configStore.Create(ctx, newConfig); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user