Files
junhong_cmp_fiber/openspec/changes/fix-commission-calculation-trigger-and-snapshot/tasks.md
huang b02175271a
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m39s
feat: 实现企业设备授权功能并归档 OpenSpec 变更
- 新增企业设备授权模块(Model、DTO、Service、Handler、Store)
- 实现设备授权的创建、查询、更新、删除等完整业务逻辑
- 添加企业卡授权与设备授权的关联关系
- 新增 2 个数据库迁移脚本
- 同步 OpenSpec delta specs 到 main specs
- 归档 add-enterprise-device-authorization 变更
- 更新 API 文档和路由配置
- 新增完整的集成测试和单元测试覆盖
2026-01-29 13:18:49 +08:00

25 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 佣金计算链路修复 - 实现任务
## 1. 订单佣金字段快照
- [ ] 1.1 在 `internal/service/order/service.go` 创建订单时,从购买校验结果填充 `SeriesID/SellerShopID/SellerCostPrice`
- [ ] 1.2 补充/复用“成本价推导”工具方法,确保口径与佣金计算一致
## 2. 支付成功后自动入队
- [ ] 2.1 在首次支付成功路径 enqueue `commission:calculate`payload: order_id
- [ ] 2.2 注入队列客户端到订单服务(遵循现有 bootstrap 依赖注入方式)
- [ ] 2.3 明确入队失败策略:记录日志,订单保持 `commission_status=pending` 可重试
## 3. 佣金计算一致性与健壮性(可选但推荐)
- [ ] 3.1 调整 `internal/service/commission_calculation/service.go`,确保事务内对佣金记录/钱包/订单状态更新使用同一 `tx`
- [ ] 3.2 增加必要的空值保护:缺少关键字段时返回业务错误而非 panic
## 4. 测试与验证
- [ ] 4.1 新增单元测试:订单创建后佣金快照字段写入正确
- [ ] 4.2 新增单元/集成测试:支付成功后会 enqueue 佣金计算任务(可通过可注入的队列 client 验证)
- [ ] 4.3 运行 `go test ./...` 确保通过