Browse Source

add reverse:for v4.1.8 牛贝积分处理

tags/v4.1.8
huangjiajun 2 years ago
parent
commit
05e67e93c7
1 changed files with 40 additions and 1 deletions
  1. +40
    -1
      lib/comm_plan/niubei_all.go

+ 40
- 1
lib/comm_plan/niubei_all.go View File

@@ -71,19 +71,58 @@ func NiuBeiCalcAll(opt *PlanOpt, totalAmt, integralTotalAmt float64, userList *L
userList.SubsidyFee = 0
// 各种币换算出总的额度
totalAmtList := make([]*VirtualCoinCommission, 0)
amountList := make([]*VirtualCoinCommission, 0)
for coinId, rate := range opt.VirtualCoinMoneyRatioList {
var amount float64
if coinId == 0 {
amount = totalAmt
} else {
amount = integralTotalAmt * zhios_order_relate_utils.AnyToFloat64(rate)
}
totalAmtList = append(totalAmtList, &VirtualCoinCommission{
Cid: zhios_order_relate_utils.AnyToString(coinId),
Val: amount,
})

}
var (
node = userList
maxLv = node.Lv // 当前等级
maxLevelWeight = node.LevelWeight // 当前权重
maxLevelWeight = -2 // 当前权重
peerNum = 0 // 存在同级数
peerRate float64 = 0 // 同级累计比例
peerRateList = make([]*VirtualCoinCommission, 0) // 各虚拟币同级累计
restAmtList = make([]*VirtualCoinCommission, 0) // 各虚拟币剩余额度
accumulateRatioList = make([]*VirtualCoinCommission, 0) // 各虚拟币累计比例
ratioList = make([]*VirtualCoinCommission, 0) // 各虚拟币累计比例
restAmt = totalAmt - userList.Profit // 剩余比例
totalCommissionRatio float64 = 0 // 累计佣金比例
)
var returnType = make([]string, 0)
var maxReturnTypeCount = 0
for _, v := range opt.UserRate {
if v.ReturnType != nil {
if len(v.ReturnType) > maxReturnTypeCount {
maxReturnTypeCount = len(v.ReturnType)
returnType = v.ReturnType
}
}
}
// 新版支持多种虚拟币 支持的种类id保存在ReturnType id=0代表现金佣金 其他为虚拟币
if returnType != nil { //返佣类型

for _, coinId := range returnType {
amountList = append(amountList, &VirtualCoinCommission{
Cid: coinId,
Val: 0,
})
ratioList = append(ratioList, &VirtualCoinCommission{
Cid: coinId,
Val: 0,
})
}
}
restAmtList, _ = CalVirtualCommissionMinus(totalAmtList, amountList)

Loop:
for node.ParentUser != nil { //查找上级用户


Loading…
Cancel
Save