diff --git a/rule/relate_commission.go b/rule/relate_commission.go index bb723c7..dec227c 100644 --- a/rule/relate_commission.go +++ b/rule/relate_commission.go @@ -150,6 +150,32 @@ func SettleCommWithGoodsDetail(eg *xorm.Engine, dbName string, CommissionParam m profit, pvdFee, sysFee, subsidyFee, lvUser, err := svc.GetRewardCommission(eg, &CommissionParam.CommissionParam, isShare, CommissionParam.Uid, CommissionParam.Provider, dbName, isAllLevelReturn, mapData, virType) return profit, pvdFee, sysFee, subsidyFee, lvUser, err } +func SettleCommWithOrder(eg *xorm.Engine, dbName string, CommissionParam md.CommissionFirstParam) (float64, float64, float64, float64, *comm_plan.LvUser, error) { + var ( + isShare = false + isAllLevelReturn = false + ) + if CommissionParam.IsShare != 0 { + isShare = true + } + + if CommissionParam.IsAllLevelReturn != 0 { + isAllLevelReturn = true + } + var mapData = map[string]string{ + "old_lv": CommissionParam.OldLv, + "new_lv": CommissionParam.NewLv, + "ownbuy_return_type": zhios_order_relate_utils.IntToStr(CommissionParam.OwnbuyReturnType), + } + virCfg, _ := db.SysCfgGetOne(eg, "virtual_coin_rebate_type") + var virType = "price" + if virCfg != nil && virCfg.Val != "" { + virType = virCfg.Val + } + CommissionParam.CommissionParam.Oid = CommissionParam.GoodsId + profit, pvdFee, sysFee, subsidyFee, lvUser, err := svc.GetRewardCommission(eg, &CommissionParam.CommissionParam, isShare, CommissionParam.Uid, CommissionParam.Provider, dbName, isAllLevelReturn, mapData, virType) + return profit, pvdFee, sysFee, subsidyFee, lvUser, err +} //获取自购分享佣金的 func GetRewardCommission(eg *xorm.Engine, dbName, mode string, CommissionParam md.CommissionFirstParam) (float64, float64, *comm_plan.LvUser, error) {