|
@@ -158,19 +158,25 @@ func CalcAdv(opt *PlanOpt, totalAmt, integralTotalAmt float64, userList *LvUser, |
|
|
maxLv = node.Lv // 当前等级 |
|
|
maxLv = node.Lv // 当前等级 |
|
|
maxLevelWeight = node.LevelWeight // 当前权重 |
|
|
maxLevelWeight = node.LevelWeight // 当前权重 |
|
|
peerNum = 0 // 存在同级数 |
|
|
peerNum = 0 // 存在同级数 |
|
|
|
|
|
|
|
|
|
|
|
isFirst = 0 |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
Loop: |
|
|
Loop: |
|
|
for node.ParentUser != nil { //查找上级用户 |
|
|
for node.ParentUser != nil { //查找上级用户 |
|
|
node.ParentUser.Profit = 0 |
|
|
node.ParentUser.Profit = 0 |
|
|
count := len(grade[maxLv].PeerRate) |
|
|
count := len(grade[maxLv].PeerRate) |
|
|
if grade[maxLv].PeerRateList != nil { |
|
|
|
|
|
|
|
|
if grade[maxLv].NewPeerList != nil { |
|
|
count = len(grade[maxLv].PeerRateList) |
|
|
count = len(grade[maxLv].PeerRateList) |
|
|
} |
|
|
} |
|
|
var isBreak bool |
|
|
var isBreak bool |
|
|
zeroList := make(map[string]struct{}) |
|
|
zeroList := make(map[string]struct{}) |
|
|
if node.ParentUser.Diff == 1 { |
|
|
|
|
|
|
|
|
if node.ParentUser.Lv == 0 { |
|
|
|
|
|
node.ParentUser.LastProfitList = node.LastProfitList |
|
|
|
|
|
node.ParentUser.LastProfit = node.LastProfit |
|
|
|
|
|
node = node.ParentUser |
|
|
|
|
|
continue |
|
|
|
|
|
} |
|
|
|
|
|
if isFirst == 0 { |
|
|
userType := "to_extend" |
|
|
userType := "to_extend" |
|
|
commission, _, amountList, _ := CalReturnAmountAndRatioWineryAdv(node.ParentUser.Lv, userList.OwnbuyReturnType, peerNum, userType, totalAmt, integralTotalAmt, opt) |
|
|
commission, _, amountList, _ := CalReturnAmountAndRatioWineryAdv(node.ParentUser.Lv, userList.OwnbuyReturnType, peerNum, userType, totalAmt, integralTotalAmt, opt) |
|
|
node.ParentUser.Profit = commission |
|
|
node.ParentUser.Profit = commission |
|
@@ -183,6 +189,7 @@ Loop: |
|
|
node.ParentUser.LastProfit = node.ParentUser.Profit |
|
|
node.ParentUser.LastProfit = node.ParentUser.Profit |
|
|
// 等级往上升则置0 |
|
|
// 等级往上升则置0 |
|
|
maxLevelWeight, maxLv, peerNum = node.ParentUser.LevelWeight, node.ParentUser.Lv, 0 |
|
|
maxLevelWeight, maxLv, peerNum = node.ParentUser.LevelWeight, node.ParentUser.Lv, 0 |
|
|
|
|
|
isFirst = 1 |
|
|
} else { |
|
|
} else { |
|
|
// 同级奖 |
|
|
// 同级奖 |
|
|
if node.ParentUser.LevelWeight == maxLevelWeight && count > peerNum { |
|
|
if node.ParentUser.LevelWeight == maxLevelWeight && count > peerNum { |
|
|