feat: 归档佣金计算触发和快照变更,同步规范文档
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m40s

- 归档 OpenSpec 变更到 archive 目录
- 创建 2 个新的主规范文件:commission-trigger 和 order-commission-snapshot
- 实现订单佣金快照字段和支付自动触发
- 确保事务一致性,所有佣金操作在同一事务内完成
- 提取成本价计算为公共工具函数
This commit is contained in:
2026-01-29 14:58:35 +08:00
parent c9fee7f2f6
commit d977000a66
14 changed files with 542 additions and 66 deletions

13
pkg/utils/commission.go Normal file
View File

@@ -0,0 +1,13 @@
package utils
import "github.com/break/junhong_cmp_fiber/internal/model"
func CalculateCostPrice(allocation *model.ShopSeriesAllocation, orderAmount int64) int64 {
if allocation.BaseCommissionMode == model.CommissionModeFixed {
return orderAmount - allocation.BaseCommissionValue
} else if allocation.BaseCommissionMode == model.CommissionModePercent {
commission := orderAmount * allocation.BaseCommissionValue / 1000
return orderAmount - commission
}
return orderAmount
}