huangjiajun 1 week ago
parent
commit
5cfde07897
1 changed files with 14 additions and 14 deletions
  1. +14
    -14
      lib/comm_plan/all.go

+ 14
- 14
lib/comm_plan/all.go View File

@@ -7,18 +7,18 @@ import (
"xorm.io/xorm"
)

//佣金 积分 区块币计算
// 佣金 积分 区块币计算
func CalReturnAmountAndRatio(level, ownbuyReturnType, peerNum int, userType string, fee, integralFee float64, opt *PlanOpt) (commission, commissionRatio float64, amountList, ratioList []*VirtualCoinCommission) {
// 佣金的比例兼容旧系统 比例独立出来的 所以这样算
commissionRatio = getCommissionRatio(userType, level, peerNum, opt.UserRate)
commission = fee * commissionRatio
var maxReturnTypeCount = 0
var returnType = make([]string, 0)
for _, v := range opt.UserRate {
if v.ReturnType != nil {
if len(v.ReturnType) > maxReturnTypeCount {
maxReturnTypeCount = len(v.ReturnType)
returnType = v.ReturnType
for _, v1 := range v.ReturnType {
if zhios_order_relate_utils.InArr(v1, returnType) == false {
returnType = append(returnType, v1)
}
}
}
}
@@ -62,17 +62,17 @@ func CalReturnAmountAndRatio(level, ownbuyReturnType, peerNum int, userType stri
return commission, commissionRatio, amountList, ratioList
}

//佣金 积分 区块币计算
// 佣金 积分 区块币计算
func CalReturnAmountAndRatioByLevel(level, ownbuyReturnType, peerNum int, userType string, fee, integralFee float64, opt *PlanOpt) (commissionRatio float64, ratioList []*VirtualCoinCommission) {
// 佣金的比例兼容旧系统 比例独立出来的 所以这样算
commissionRatio = getCommissionRatio(userType, level, peerNum, opt.UserRate)
var maxReturnTypeCount = 0
var returnType = make([]string, 0)
for _, v := range opt.UserRate {
if v.ReturnType != nil {
if len(v.ReturnType) > maxReturnTypeCount {
maxReturnTypeCount = len(v.ReturnType)
returnType = v.ReturnType
for _, v1 := range v.ReturnType {
if zhios_order_relate_utils.InArr(v1, returnType) == false {
returnType = append(returnType, v1)
}
}
}
}
@@ -89,7 +89,7 @@ func CalReturnAmountAndRatioByLevel(level, ownbuyReturnType, peerNum int, userTy
return commissionRatio, ratioList
}

//佣金 积分 区块币计算
// 佣金 积分 区块币计算
func CalReturnAmountAndRatioToWinery(level int, fee, integralFee float64, opt *PlanOpt) (commission, commissionRatio float64, amountList, ratioList []*VirtualCoinCommission) {
if opt.UserRate[level].ReturnType != nil { //返佣类型
for _, coinId := range opt.UserRate[level].ReturnType {
@@ -231,7 +231,7 @@ Loop:
return nil
}

//公共处理同级计算 (只计算佣金 旧版本用)
// 公共处理同级计算 (只计算佣金 旧版本用)
func sameMoney(lv, isOnlySubsidy int, restAmt, profit, peerRate, totalRatio, restRatio, subsidyFee, subsidyBili float64, opt *PlanOpt) (float64, float64, float64, float64, float64, bool) {
//如果不够扣了,并且是比例返利就跳过
if restAmt < profit {
@@ -488,7 +488,7 @@ func sameMoneyV2Winery(lv, isOnlySubsidy int, totalAmtList, restAmtList, profitL
return newProfitList, newRestAmtList, newTotalRatioList, newPeerRateList, newSubsidyFeeList, zeroList
}

//公共处理下团队-上一层 (用于旧版的制度 只有佣金时)
// 公共处理下团队-上一层 (用于旧版的制度 只有佣金时)
func teamDiffMoney(profit float64, payMode, isOnlySubsidy int, totalAmt, restAmt, teamRatio, totalRatio, peerRate, subsidyFee, subsidyRatio float64) (float64, float64, float64, float64, bool) {
// 如果是团队内部支出团队比例大于同级累计比例 或站长支出
if payMode == 1 || teamRatio > peerRate {
@@ -573,7 +573,7 @@ func teamDiffMoneyV2(profitList []*VirtualCoinCommission, payMode, isOnlySubsidy
return newProfitList, newRestAmtList, newTotalRatioList, newSubsidyFeeList, zeroList
}

//补贴金额计算
// 补贴金额计算
// types 支持的返佣类型
func subsidyFeeDo(opt *PlanOpt, totalAmt, integralTotalAmt float64, lvuser *LvUser, newLv int, pvd string, sysFee, integralSysFee float64) (subsidyFee, subsidyRatio float64, isOnlySubsidyFee int, subsidyFeeList, subsidyRatioList []*VirtualCoinCommission) {
grade := opt.UserRate


Loading…
Cancel
Save