|
@@ -153,7 +153,45 @@ Loop: |
|
|
if isNext == 0 { |
|
|
if isNext == 0 { |
|
|
// 同级奖 |
|
|
// 同级奖 |
|
|
if node.ParentUser.LevelWeight == maxLevelWeight && count > peerNum { |
|
|
if node.ParentUser.LevelWeight == maxLevelWeight && count > peerNum { |
|
|
|
|
|
|
|
|
|
|
|
if peerNum >= 1 && node.ParentUser.Lv >= 2 { |
|
|
|
|
|
teamtotal := db.GetUserTeamTotal(eg, zhios_order_relate_utils.IntToStr(node.ParentUser.Uid)) |
|
|
|
|
|
if teamtotal == nil || teamtotal != nil && teamtotal.TeamCount < 15 { |
|
|
|
|
|
sql1 := `SELECT ur.uid,up.parent_uid,ur.level FROM user_relate ur |
|
|
|
|
|
LEFT JOIN user_profile up on ur.uid=up.uid |
|
|
|
|
|
LEFT JOIN user u on u.uid=ur.uid |
|
|
|
|
|
WHERE ur.parent_uid=? and u.level>0 and ur.level<20 ORDER BY ur.level asc,u.first_arrive_at asc,u.uid asc |
|
|
|
|
|
` |
|
|
|
|
|
nativeString1, _ := db.QueryNativeString(eg, sql1, node.ParentUser.Uid) |
|
|
|
|
|
if len(nativeString1) > 0 { |
|
|
|
|
|
var nMap = make(map[string][]string) |
|
|
|
|
|
nCount := 0 |
|
|
|
|
|
for _, v := range nativeString1 { |
|
|
|
|
|
if zhios_order_relate_utils.StrToInt(v["uid"]) == 0 || nCount > 15 { |
|
|
|
|
|
continue |
|
|
|
|
|
} |
|
|
|
|
|
if v["level"] == "1" && len(nMap[v["level"]]) < 2 { |
|
|
|
|
|
nMap[v["level"]] = append(nMap[v["level"]], v["uid"]) |
|
|
|
|
|
nCount++ |
|
|
|
|
|
} else if len(nMap[v["level"]]) < 2 { |
|
|
|
|
|
lastLevel := zhios_order_relate_utils.IntToStr(zhios_order_relate_utils.StrToInt(v["level"]) - 1) |
|
|
|
|
|
for _, v1 := range nMap[lastLevel] { |
|
|
|
|
|
if v["parent_uid"] == v1 { |
|
|
|
|
|
nMap[v["level"]] = append(nMap[v["level"]], v["uid"]) |
|
|
|
|
|
nCount++ |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if teamtotal != nil { |
|
|
|
|
|
teamtotal.TeamCount = nCount |
|
|
|
|
|
eg.Where("uid=?", node.ParentUser.Uid).Update(teamtotal) |
|
|
|
|
|
} |
|
|
|
|
|
if nCount < 15 { |
|
|
|
|
|
node.ParentUser.IsFreeze = 1 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
peerRate = 0 |
|
|
peerRate = 0 |
|
|
//同级奖励比例 |
|
|
//同级奖励比例 |
|
|
commission, commissionRatio, amountList, ratioList := CalReturnAmountAndRatioWinery(maxLv, userList.OwnbuyReturnType, peerNum, "same_lv", sameProfit, sameProfitList, opt) |
|
|
commission, commissionRatio, amountList, ratioList := CalReturnAmountAndRatioWinery(maxLv, userList.OwnbuyReturnType, peerNum, "same_lv", sameProfit, sameProfitList, opt) |
|
|