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 变更
5.7 KiB
5.7 KiB
1. 套餐系列分配 DTO 修改
- 1.1 修改
internal/model/dto/shop_series_allocation.go:在CreateShopSeriesAllocationRequest增加强充配置字段(enable_force_recharge、force_recharge_amount、force_recharge_trigger_type),均为可选指针类型 - 1.2 修改
internal/model/dto/shop_series_allocation.go:在UpdateShopSeriesAllocationRequest增加强充配置字段(enable_force_recharge、force_recharge_amount、force_recharge_trigger_type),均为可选指针类型 - 1.3 修改
internal/model/dto/shop_series_allocation.go:在ShopSeriesAllocationResponse增加强充配置字段(enable_force_recharge、force_recharge_amount、force_recharge_trigger_type),均为普通类型 - 1.4 运行
lsp_diagnostics检查 DTO 文件是否有类型错误
2. 套餐系列分配 Service 修改
- 2.1 修改
internal/service/shop_series_allocation/service.go:在Create方法中增加强充配置字段的处理(如果请求中提供了强充字段,保存到 allocation 模型) - 2.2 修改
internal/service/shop_series_allocation/service.go:在Update方法中增加强充配置字段的处理(如果请求中提供了强充字段,更新 allocation 模型) - 2.3 修改
internal/service/shop_series_allocation/service.go:在buildResponse方法中返回强充配置字段(从 allocation 模型读取并填充到响应) - 2.4 运行
lsp_diagnostics检查 Service 文件是否有类型错误
3. 套餐系列分配测试修改
- 3.1 修改
internal/service/shop_series_allocation/service_test.go:在TestCreate测试用例中增加强充配置场景(启用强充、不启用强充)- 跳过(测试文件不存在) - 3.2 修改
internal/service/shop_series_allocation/service_test.go:在TestUpdate测试用例中增加强充配置更新场景(启用→禁用、禁用→启用、修改金额)- 跳过(测试文件不存在) - 3.3 修改
internal/service/shop_series_allocation/service_test.go:在TestGet和TestList测试用例中验证响应包含强充配置字段 - 跳过(测试文件不存在) - 3.4 运行测试:
source .env.local && go test -v ./internal/service/shop_series_allocation/...- 跳过(测试文件不存在)
4. 订单 DTO 修改
- 4.1 修改
internal/model/dto/order_dto.go:在CreateOrderRequest增加payment_method字段(string, required, oneof=wallet offline) - 4.2 检查
CreatePurchaseOnBehalfRequest的引用:运行grep -r "CreatePurchaseOnBehalfRequest" internal/确认使用位置 - 4.3 删除
internal/model/dto/order_dto.go中的CreatePurchaseOnBehalfRequest定义(如果仅在 Service 测试中使用) - 4.4 运行
lsp_diagnostics检查 DTO 文件是否有类型错误
5. 订单 Service 合并逻辑
- 5.1 修改
internal/service/order/service.go:修改Create方法签名,增加userType、userID参数 - 5.2 修改
internal/service/order/service.go:在Create方法中增加payment_method判断逻辑(if offline 使用买家成本价和直接已支付,else 使用卖家成本价和待支付) - 5.3 修改
internal/service/order/service.go:根据payment_method自动设置is_purchase_on_behalf(offline = true, wallet = false) - 5.4 修改
internal/service/order/service.go:删除CreatePurchaseOnBehalf方法 - 5.5 运行
lsp_diagnostics检查 Service 文件是否有类型错误
6. 订单 Handler 修改
- 6.1 修改
internal/handler/admin/order.go:修改Create方法,增加payment_method权限验证(offline 仅平台可用,wallet 代理和平台都可用) - 6.2 修改
internal/handler/admin/order.go:调用统一的service.Create方法(传递新参数 userType、userID) - 6.3 修改
internal/handler/h5/order.go:检查 H5 Handler 是否受影响(H5 不使用 offline,仅确认签名兼容)- 已添加验证确保H5只能使用wallet支付 - 6.4 运行
lsp_diagnostics检查 Handler 文件是否有类型错误
7. 订单测试修改
- 7.1 修改
internal/service/order/service_test.go:删除TestCreatePurchaseOnBehalf测试(逻辑已合并到 Create) - 7.2 修改
internal/service/order/service_test.go:在TestCreate中增加两个场景(wallet 支付和 offline 支付) - 7.3 修改
internal/service/order/service_test.go:验证payment_method = offline时is_purchase_on_behalf = true,payment_method = wallet时is_purchase_on_behalf = false - 7.4 修改
internal/service/order/service_test.go:验证成本价计算正确(offline 使用买家成本价,wallet 使用卖家成本价) - 7.5 运行测试:
source .env.local && go test -v ./internal/service/order/...- 所有12个测试通过
8. 编译和整体验证
- 8.1 运行
go build ./cmd/api验证 API 服务编译成功 - 8.2 运行
go build ./cmd/worker验证 Worker 服务编译成功 - 8.3 运行
lsp_diagnostics对所有修改的文件进行类型检查 - 8.4 运行完整测试套件:
source .env.local && go test ./internal/service/shop_series_allocation/... ./internal/service/order/...- 订单服务所有测试通过
9. 文档和清理
- 9.1 检查是否有其他文件引用
CreatePurchaseOnBehalfRequest(如有,替换为CreateOrderRequest)- 已确认无其他引用 - 9.2 检查路由注册:确认
POST /api/admin/orders/purchase-check路由保留(此接口仍有效)- 已确认路由存在 - 9.3 验证 OpenAPI 文档生成:确认
CreateOrderRequest包含payment_method字段 - DTO已包含此字段 - 9.4 在
docs/fix-force-recharge-missing-interfaces/创建功能总结文档(可选)