fix(force-recharge): 补充强充配置缺失的接口和数据库字段
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m19s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m19s
- 订单管理:增加 payment_method 字段支持,合并代购订单逻辑 - 套餐系列分配:增加强充配置字段(enable_force_recharge、force_recharge_amount、force_recharge_trigger_type) - 数据库迁移:添加 force_recharge_trigger_type 字段 - 测试:更新订单服务测试用例 - OpenSpec:归档 fix-force-recharge-missing-interfaces 变更
This commit is contained in:
@@ -124,6 +124,18 @@ func (s *Service) Create(ctx context.Context, req *dto.CreateShopSeriesAllocatio
|
||||
allocation.OneTimeCommissionValue = cfg.Value
|
||||
}
|
||||
}
|
||||
|
||||
// 处理强充配置
|
||||
if req.EnableForceRecharge != nil {
|
||||
allocation.EnableForceRecharge = *req.EnableForceRecharge
|
||||
}
|
||||
if req.ForceRechargeAmount != nil {
|
||||
allocation.ForceRechargeAmount = *req.ForceRechargeAmount
|
||||
}
|
||||
if req.ForceRechargeTriggerType != nil {
|
||||
allocation.ForceRechargeTriggerType = *req.ForceRechargeTriggerType
|
||||
}
|
||||
|
||||
allocation.Creator = currentUserID
|
||||
|
||||
if err := s.allocationStore.Create(ctx, allocation); err != nil {
|
||||
@@ -224,6 +236,17 @@ func (s *Service) Update(ctx context.Context, id uint, req *dto.UpdateShopSeries
|
||||
allocation.OneTimeCommissionValue = 0
|
||||
}
|
||||
}
|
||||
|
||||
if req.EnableForceRecharge != nil {
|
||||
allocation.EnableForceRecharge = *req.EnableForceRecharge
|
||||
}
|
||||
if req.ForceRechargeAmount != nil {
|
||||
allocation.ForceRechargeAmount = *req.ForceRechargeAmount
|
||||
}
|
||||
if req.ForceRechargeTriggerType != nil {
|
||||
allocation.ForceRechargeTriggerType = *req.ForceRechargeTriggerType
|
||||
}
|
||||
|
||||
allocation.Updater = currentUserID
|
||||
|
||||
if configChanged {
|
||||
@@ -399,10 +422,13 @@ func (s *Service) buildResponse(ctx context.Context, a *model.ShopSeriesAllocati
|
||||
Mode: a.BaseCommissionMode,
|
||||
Value: a.BaseCommissionValue,
|
||||
},
|
||||
EnableOneTimeCommission: a.EnableOneTimeCommission,
|
||||
Status: a.Status,
|
||||
CreatedAt: a.CreatedAt.Format(time.RFC3339),
|
||||
UpdatedAt: a.UpdatedAt.Format(time.RFC3339),
|
||||
EnableOneTimeCommission: a.EnableOneTimeCommission,
|
||||
EnableForceRecharge: a.EnableForceRecharge,
|
||||
ForceRechargeAmount: a.ForceRechargeAmount,
|
||||
ForceRechargeTriggerType: a.ForceRechargeTriggerType,
|
||||
Status: a.Status,
|
||||
CreatedAt: a.CreatedAt.Format(time.RFC3339),
|
||||
UpdatedAt: a.UpdatedAt.Format(time.RFC3339),
|
||||
}
|
||||
|
||||
if a.EnableOneTimeCommission {
|
||||
|
||||
Reference in New Issue
Block a user