Explorar el Código

test

tags/v4.3.0
huangjiajun hace 1 año
padre
commit
a91c469f55
Se han modificado 1 ficheros con 34 adiciones y 33 borrados
  1. +34
    -33
      lib/comm_plan/winery.go

+ 34
- 33
lib/comm_plan/winery.go Ver fichero

@@ -124,44 +124,45 @@ Loop:
if node.ParentUser.Lv > 2 && maxLvData != nil {
node.ParentUser.LevelWeight = maxLvData.LevelWeight
}

// 同级奖
if node.ParentUser.LevelWeight == maxLevelWeight && count > peerNum {
peerRate = 0
//同级奖励比例
commission, commissionRatio, amountList, ratioList := CalReturnAmountAndRatioWinery(maxLv, userList.OwnbuyReturnType, peerNum, "same_lv", sameProfit, sameProfitList, opt)
//佣金 (lv, isOnlySubsidy int, restAmt, profit, peerRate, totalRatio, restRatio, subsidyFee, subsidyBili float64, opt *PlanOpt)
node.ParentUser.Profit, restAmt, totalCommissionRatio, peerRate, node.ParentUser.SubsidyFee, isBreak = sameMoney(node.Lv, isOnlySubsidyFee, restAmt, commission, peerRate, totalCommissionRatio, commissionRatio, node.ParentUser.SubsidyFee, subsidyRatio, opt)
node.ParentUser.ProfitList, restAmtList, accumulateRatioList, peerRateList, node.ParentUser.SubsidyFeeList, zeroList = sameMoneyV2Winery(node.Lv, isOnlySubsidyFee, totalAmtList, restAmtList, amountList, peerRateList, accumulateRatioList, ratioList, node.ParentUser.SubsidyFeeList, subsidyRatioList, opt)

// 全部都没得分了
if isBreak && len(zeroList) == len(opt.UserRate[maxLv].ReturnType) {
break Loop
}
isCus = 0
extendUid = 0
peerNum++
} else if node.ParentUser.LevelWeight > maxLevelWeight {
isNext := 0
if isCus == 1 && extendUid > 0 {
//找出前两个人 如果不是就分团队奖 如果是就再找
sql := `SELECT u.uid,u.first_arrive_at FROM user_profile up
isNext := 0
//如果前一等级是团长 就不用判断这个了
if isCus == 1 && extendUid > 0 { //店员才有值
//找出前两个人 如果不是就分团队奖 如果是就再找
sql := `SELECT u.uid,u.first_arrive_at FROM user_profile up
LEFT JOIN user u on u.uid=up.uid
WHERE up.parent_uid=? ORDER BY u.first_arrive_at asc,u.uid asc LIMIT 2`
nativeString, err := db.QueryNativeString(eg, sql, node.ParentUser.Uid)
if err != nil {
return zhios_order_relate_logx.Warn("sql error")
}
if len(nativeString) > 0 {
for _, v := range nativeString {
if zhios_order_relate_utils.StrToInt(v["uid"]) == extendUid {
isNext = 1
extendUid = node.ParentUser.Uid
}
nativeString, err := db.QueryNativeString(eg, sql, node.ParentUser.Uid)
if err != nil {
return zhios_order_relate_logx.Warn("sql error")
}
if len(nativeString) > 0 {
for _, v := range nativeString {
if zhios_order_relate_utils.StrToInt(v["uid"]) == extendUid {
isNext = 1
extendUid = node.ParentUser.Uid
}
}
}
if isNext == 0 {
}
if isNext == 0 {
// 同级奖
if node.ParentUser.LevelWeight == maxLevelWeight && count > peerNum {

peerRate = 0
//同级奖励比例
commission, commissionRatio, amountList, ratioList := CalReturnAmountAndRatioWinery(maxLv, userList.OwnbuyReturnType, peerNum, "same_lv", sameProfit, sameProfitList, opt)
//佣金 (lv, isOnlySubsidy int, restAmt, profit, peerRate, totalRatio, restRatio, subsidyFee, subsidyBili float64, opt *PlanOpt)
node.ParentUser.Profit, restAmt, totalCommissionRatio, peerRate, node.ParentUser.SubsidyFee, isBreak = sameMoney(node.Lv, isOnlySubsidyFee, restAmt, commission, peerRate, totalCommissionRatio, commissionRatio, node.ParentUser.SubsidyFee, subsidyRatio, opt)
node.ParentUser.ProfitList, restAmtList, accumulateRatioList, peerRateList, node.ParentUser.SubsidyFeeList, zeroList = sameMoneyV2Winery(node.Lv, isOnlySubsidyFee, totalAmtList, restAmtList, amountList, peerRateList, accumulateRatioList, ratioList, node.ParentUser.SubsidyFeeList, subsidyRatioList, opt)

// 全部都没得分了
if isBreak && len(zeroList) == len(opt.UserRate[maxLv].ReturnType) {
break Loop
}
isCus = 0
extendUid = 0
peerNum++
} else if node.ParentUser.LevelWeight > maxLevelWeight {
if _, ok := grade[node.Lv]; !ok {
return zhios_order_relate_logx.Warn("level grade node.Lv is not set")
}


Cargando…
Cancelar
Guardar