修复 code review 问题:DTO 内部字段、错误消息、重复代码与测试覆盖
- 删除 ExpiryBaseOverrideSet 字段的 description 标签(json:"-" 内部字段不进文档) - ValidateExpiryBaseOverride 两处 CodeInvalidParam 补充中文错误消息 - 提取 initPackageExpiryBaseFields 消除 toResponse/toResponseWithAllocation 中的重复初始化 - 删除 order/service.go 中"行业卡永远直接激活"过时注释 - 补充 T01 系列授权 HTTP 集成测试(Create + ManagePackages 两个入口) - 补充 T03 C 端购买和平台代购(无分配)快照集成测试 - 补充 T04 from_purchase 默认值、卡未实名仍立即激活的自动购包测试 - 新增 testutil.NewRedisClient 供激活接续测试使用 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,7 @@ type BatchAllocatePackagesRequest struct {
|
||||
PriceAdjustment *PriceAdjustment `json:"price_adjustment" validate:"omitempty" description:"可选加价配置"`
|
||||
OneTimeCommissionAmount *int64 `json:"one_time_commission_amount" validate:"omitempty,min=0" minimum:"0" description:"该代理能拿到的一次性佣金(分)"`
|
||||
ExpiryBaseOverride *string `json:"expiry_base_override" nullable:"true" description:"分配生效条件覆盖 (null:跟随套餐默认值, from_activation:实名激活时生效, from_purchase:购买即生效)"`
|
||||
ExpiryBaseOverrideSet bool `json:"-" description:"是否显式提交分配生效条件覆盖(内部解析字段)"`
|
||||
ExpiryBaseOverrideSet bool `json:"-"`
|
||||
}
|
||||
|
||||
// BatchAllocatePackagesResponse 批量分配套餐响应
|
||||
@@ -27,7 +27,7 @@ type BatchAllocatePackagesResponse struct {
|
||||
// UpdateAllocationExpiryBaseRequest 修改套餐分配生效条件覆盖请求。
|
||||
type UpdateAllocationExpiryBaseRequest struct {
|
||||
ExpiryBaseOverride *string `json:"expiry_base_override" nullable:"true" description:"分配生效条件覆盖 (null:跟随套餐默认值, from_activation:实名激活时生效, from_purchase:购买即生效)"`
|
||||
ExpiryBaseOverrideSet bool `json:"-" description:"是否显式提交分配生效条件覆盖(内部解析字段)"`
|
||||
ExpiryBaseOverrideSet bool `json:"-"`
|
||||
}
|
||||
|
||||
// ShopPackageAllocationTermsResponse 套餐分配计时条款响应。
|
||||
|
||||
@@ -64,7 +64,7 @@ type CreateShopSeriesGrantRequest struct {
|
||||
ForceRechargeAmount *int64 `json:"force_recharge_amount,omitempty" description:"代理强充金额(分)"`
|
||||
Packages []GrantPackageItem `json:"packages,omitempty" description:"初始授权套餐列表"`
|
||||
ExpiryBaseOverride *string `json:"expiry_base_override" nullable:"true" description:"分配生效条件覆盖 (null:跟随套餐默认值, from_activation:实名激活时生效, from_purchase:购买即生效)"`
|
||||
ExpiryBaseOverrideSet bool `json:"-" description:"是否显式提交分配生效条件覆盖(内部解析字段)"`
|
||||
ExpiryBaseOverrideSet bool `json:"-"`
|
||||
}
|
||||
|
||||
// UpdateShopSeriesGrantRequest 更新系列授权请求
|
||||
@@ -79,7 +79,7 @@ type UpdateShopSeriesGrantRequest struct {
|
||||
type ManageGrantPackagesRequest struct {
|
||||
Packages []GrantPackageItem `json:"packages" validate:"required,min=1" description:"套餐操作列表"`
|
||||
ExpiryBaseOverride *string `json:"expiry_base_override" nullable:"true" description:"新增分配的生效条件覆盖 (null:跟随套餐默认值, from_activation:实名激活时生效, from_purchase:购买即生效)"`
|
||||
ExpiryBaseOverrideSet bool `json:"-" description:"是否显式提交分配生效条件覆盖(内部解析字段)"`
|
||||
ExpiryBaseOverrideSet bool `json:"-"`
|
||||
}
|
||||
|
||||
// ShopSeriesGrantListRequest 系列授权列表查询请求
|
||||
|
||||
Reference in New Issue
Block a user