diff --git a/lib/comm_plan/winery.go b/lib/comm_plan/winery.go index 6403979..c9acf42 100644 --- a/lib/comm_plan/winery.go +++ b/lib/comm_plan/winery.go @@ -64,7 +64,11 @@ func CalcWinery(opt *PlanOpt, totalAmt, integralTotalAmt float64, userList *LvUs // 累计比例 accumulateRatioList = ratioList restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 2) - + teamCountMinData, _ := db.SysCfgGetOne(eg, "team_count_min") + teamCountMin := 15 + if teamCountMinData != nil { + teamCountMin = zhios_order_relate_utils.StrToInt(teamCountMinData.Val) + } Loop: for node.ParentUser != nil { //查找上级用户 node.ParentUser.Profit = 0 @@ -155,7 +159,7 @@ Loop: 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 { + if teamtotal == nil || teamtotal != nil && teamtotal.TeamCount < teamCountMin { 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 @@ -166,7 +170,7 @@ Loop: var nMap = make(map[string][]string) nCount := 0 for _, v := range nativeString1 { - if zhios_order_relate_utils.StrToInt(v["uid"]) == 0 || nCount > 15 { + if zhios_order_relate_utils.StrToInt(v["uid"]) == 0 || nCount >= teamCountMin { continue } if v["level"] == "1" && len(nMap[v["level"]]) < 2 { @@ -186,7 +190,7 @@ Loop: teamtotal.TeamCount = nCount eg.Where("uid=?", node.ParentUser.Uid).Update(teamtotal) } - if nCount < 15 { + if nCount < teamCountMin { node.ParentUser.IsFreeze = 1 } }