All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m40s
- 归档 OpenSpec 变更到 archive 目录 - 创建 2 个新的主规范文件:commission-trigger 和 order-commission-snapshot - 实现订单佣金快照字段和支付自动触发 - 确保事务一致性,所有佣金操作在同一事务内完成 - 提取成本价计算为公共工具函数
14 lines
486 B
Go
14 lines
486 B
Go
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
|
|
}
|