feat: 归档佣金计算触发和快照变更,同步规范文档
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m40s
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:
13
pkg/utils/commission.go
Normal file
13
pkg/utils/commission.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user