|
|
@@ -1,13 +1,15 @@ |
|
|
|
package comm_plan |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db" |
|
|
|
zhios_order_relate_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils" |
|
|
|
zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils/logx" |
|
|
|
"fmt" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
|
// 按总佣金的比例进行划分计算 |
|
|
|
func CalcWinery(opt *PlanOpt, totalAmt, integralTotalAmt float64, userList *LvUser, pvd string, sysFee float64, integralSysFee float64, level, levelWeight int) error { |
|
|
|
func CalcWinery(opt *PlanOpt, totalAmt, integralTotalAmt float64, userList *LvUser, pvd string, sysFee float64, integralSysFee float64, level, levelWeight int, eg *xorm.Engine) error { |
|
|
|
grade := opt.UserRate |
|
|
|
if len(grade) == 0 { |
|
|
|
return zhios_order_relate_logx.Warn("level grade is not set") |
|
|
@@ -19,10 +21,10 @@ func CalcWinery(opt *PlanOpt, totalAmt, integralTotalAmt float64, userList *LvUs |
|
|
|
userList.ProfitList = amountList // 各币种分佣 |
|
|
|
userList.SubsidyFee = 0 |
|
|
|
ratioListMap := convertList2Map(ratioList) |
|
|
|
|
|
|
|
for k, v := range userList.ProfitList { |
|
|
|
userList.ProfitList[k].Val = ratioListMap[v.Cid] * v.Val |
|
|
|
} |
|
|
|
maxLvData, _ := db.UserLevelByID(eg, "2") |
|
|
|
// 各种币换算出总的额度 |
|
|
|
totalAmtList := make([]*VirtualCoinCommission, 0) |
|
|
|
for coinId, rate := range opt.VirtualCoinMoneyRatioList { |
|
|
@@ -92,6 +94,9 @@ Loop: |
|
|
|
} |
|
|
|
maxLevelWeight, maxLv, peerRate, peerRateList, peerNum, sameProfit, sameProfitList = node.ParentUser.LevelWeight, node.ParentUser.Lv, 0, nil, 0, node.ParentUser.Profit, node.ParentUser.ProfitList |
|
|
|
} else { |
|
|
|
if node.ParentUser.Lv > 2 && maxLvData != nil { |
|
|
|
node.ParentUser.LevelWeight = maxLvData.LevelWeight |
|
|
|
} |
|
|
|
// 同级奖 |
|
|
|
if node.ParentUser.LevelWeight == maxLevelWeight && count > peerNum { |
|
|
|
|
|
|
|