fix: 修复梯度佣金档位字段缺失,补全授权接口响应字段及强充有效状态
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m27s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m27s
- OneTimeCommissionTierDTO 补充 operator 字段映射 - GrantCommissionTierItem 补充 dimension/stat_scope 字段(从全局配置合并) - 系列授权列表/详情补充强充锁定状态和强充金额的有效值计算 - 同步 OpenSpec 主规范并归档变更文档
This commit is contained in:
@@ -263,6 +263,7 @@ func (s *Service) dtoToModelConfig(dtoConfig *dto.SeriesOneTimeCommissionConfigD
|
||||
tiers = make([]model.OneTimeCommissionTier, len(dtoConfig.Tiers))
|
||||
for i, tier := range dtoConfig.Tiers {
|
||||
tiers[i] = model.OneTimeCommissionTier{
|
||||
Operator: tier.Operator,
|
||||
Dimension: tier.Dimension,
|
||||
StatScope: tier.StatScope,
|
||||
Threshold: tier.Threshold,
|
||||
@@ -296,6 +297,7 @@ func (s *Service) modelToDTO(config *model.OneTimeCommissionConfig) *dto.SeriesO
|
||||
tiers = make([]dto.OneTimeCommissionTierDTO, len(config.Tiers))
|
||||
for i, tier := range config.Tiers {
|
||||
tiers[i] = dto.OneTimeCommissionTierDTO{
|
||||
Operator: tier.Operator,
|
||||
Dimension: tier.Dimension,
|
||||
StatScope: tier.StatScope,
|
||||
Threshold: tier.Threshold,
|
||||
|
||||
@@ -128,11 +128,17 @@ func (s *Service) buildGrantResponse(ctx context.Context, allocation *model.Shop
|
||||
resp.AllocatorShopName = "平台"
|
||||
}
|
||||
|
||||
// 强充状态:first_recharge 或平台已启用 accumulated_recharge 强充时,锁定不可改
|
||||
// 强充有效状态:first_recharge 或平台已启用 accumulated_recharge 强充时,锁定不可改
|
||||
forceRechargeLocked := config.TriggerType == model.OneTimeCommissionTriggerFirstRecharge || config.EnableForceRecharge
|
||||
resp.ForceRechargeLocked = forceRechargeLocked
|
||||
resp.ForceRechargeEnabled = allocation.EnableForceRecharge
|
||||
resp.ForceRechargeAmount = allocation.ForceRechargeAmount
|
||||
if forceRechargeLocked {
|
||||
// 锁定时强充实际生效,金额取套餐系列配置值(allocation 字段为 0 不能使用)
|
||||
resp.ForceRechargeEnabled = true
|
||||
resp.ForceRechargeAmount = config.ForceAmount
|
||||
} else {
|
||||
resp.ForceRechargeEnabled = allocation.EnableForceRecharge
|
||||
resp.ForceRechargeAmount = allocation.ForceRechargeAmount
|
||||
}
|
||||
|
||||
// 固定模式
|
||||
if config.CommissionType == "fixed" {
|
||||
@@ -153,11 +159,13 @@ func (s *Service) buildGrantResponse(ctx context.Context, allocation *model.Shop
|
||||
// 合并全局 operator 和代理 amount
|
||||
tiers := make([]dto.GrantCommissionTierItem, 0, len(config.Tiers))
|
||||
for _, globalTier := range config.Tiers {
|
||||
tiers = append(tiers, dto.GrantCommissionTierItem{
|
||||
Operator: globalTier.Operator,
|
||||
Threshold: globalTier.Threshold,
|
||||
Amount: agentAmountMap[globalTier.Threshold],
|
||||
})
|
||||
tiers = append(tiers, dto.GrantCommissionTierItem{
|
||||
Operator: globalTier.Operator,
|
||||
Dimension: globalTier.Dimension,
|
||||
StatScope: globalTier.StatScope,
|
||||
Threshold: globalTier.Threshold,
|
||||
Amount: agentAmountMap[globalTier.Threshold],
|
||||
})
|
||||
}
|
||||
resp.CommissionTiers = tiers
|
||||
}
|
||||
@@ -452,9 +460,11 @@ func (s *Service) List(ctx context.Context, req *dto.ShopSeriesGrantListRequest)
|
||||
SeriesID: a.SeriesID,
|
||||
AllocatorShopID: a.AllocatorShopID,
|
||||
OneTimeCommissionAmount: a.OneTimeCommissionAmount,
|
||||
ForceRechargeEnabled: a.EnableForceRecharge,
|
||||
Status: a.Status,
|
||||
CreatedAt: a.CreatedAt.Format(time.DateTime),
|
||||
// 强充有效状态在 seriesMap 分支中计算,此处先设默认值
|
||||
ForceRechargeEnabled: a.EnableForceRecharge,
|
||||
ForceRechargeAmount: a.ForceRechargeAmount,
|
||||
Status: a.Status,
|
||||
CreatedAt: a.CreatedAt.Format(time.DateTime),
|
||||
}
|
||||
if a.AllocatorShopID > 0 {
|
||||
item.AllocatorShopName = shopMap[a.AllocatorShopID]
|
||||
@@ -466,6 +476,16 @@ func (s *Service) List(ctx context.Context, req *dto.ShopSeriesGrantListRequest)
|
||||
config, _ := sr.GetOneTimeCommissionConfig()
|
||||
if config != nil {
|
||||
item.CommissionType = config.CommissionType
|
||||
// 计算强充有效状态:first_recharge 或平台已启用 accumulated_recharge 强充时锁定
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
// 统计套餐数量
|
||||
|
||||
Reference in New Issue
Block a user