修复 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:
2026-07-23 10:56:46 +09:00
parent 9818537239
commit f7e0f07692
13 changed files with 931 additions and 40 deletions

View File

@@ -2262,9 +2262,8 @@ func (s *Service) activateMainPackage(ctx context.Context, tx *gorm.DB, order *m
// 计算下次重置时间(基于套餐周期类型)
nextResetAt = packagepkg.CalculateNextResetTime(pkg.DataResetCycle, terms.CalendarType, now, activatedAt)
// REALNAME-02: 后台囤货场景三维决策(卡类型 + 购买路径 + expiry_base + 实名状态)
// 查询卡类型(行业卡永远直接激活,不等实名)
// 同时查询载体当前实名状态:已实名则跳过 pending直接激活
// REALNAME-02: 后台囤货场景三维决策(购买路径 + expiry_base + 实名状态)
// 查询载体当前实名状态:已实名则跳过 pending直接激活
var currentlyRealnamed bool
if carrierType == "iot_card" {
var card model.IotCard