Ver a proveniência

更新

tags/v4.3.1
huangjiajun há 1 ano
ascendente
cometimento
c8b6bae6ee
4 ficheiros alterados com 42 adições e 2 eliminações
  1. +14
    -0
      lib/comm_plan/ds_check.go
  2. +3
    -0
      lib/comm_plan/init.go
  3. +1
    -0
      md/commission_parameter.go
  4. +24
    -2
      svc/reward_commission.go

+ 14
- 0
lib/comm_plan/ds_check.go Ver ficheiro

@@ -211,6 +211,20 @@ func CalcDsCheck(opt *PlanOpt, totalAmt, integralTotalAmt float64, userList *LvU
for k, v := range userList.ProfitList {
userList.ProfitList[k].Val = ratioListMap[v.Cid] * v.Val
}
userList.MinProfit = 0
userList.MinProfitList = make([]*VirtualCoinCommission, 0)
if userList.Lv == userList.MinLevel {
userList.MinProfit = commission
userList.MinProfitList = userList.ProfitList
} else {
commission1, _, amountList1, ratioList1 := CalReturnAmountAndRatioDsOwn(userList.Lv, userList.OwnbuyReturnType, 0, "own", totalAmt, integralTotalAmt, opt)
userList.MinProfit = commission1 // 另外出来的佣金 兼容旧的
userList.MinProfitList = amountList1 // 各币种分佣
ratioListMap1 := convertList2Map(ratioList1)
for k, v := range userList.MinProfitList {
userList.MinProfitList[k].Val = ratioListMap1[v.Cid] * v.Val
}
}
// 各种币换算出总的额度
totalAmtList := make([]*VirtualCoinCommission, 0)
for coinId, rate := range opt.VirtualCoinMoneyRatioList {


+ 3
- 0
lib/comm_plan/init.go Ver ficheiro

@@ -136,10 +136,13 @@ type LvUser struct {
LevelWeight int // 权重
Profit float64 // 利润(金额)
SubsidyFee float64 // 补贴(金额)
MinLevel int
//IntegralProfit float64 // 积分利润
//IntegralSubsidyFee float64 // 积分补贴
//BlockIconsProfit float64 // 区块币利润
//BlockIconsSubsidyFee float64 // 区块币补贴
MinProfit float64 // 利润(金额)
MinProfitList []*VirtualCoinCommission // 各币种对用的数量
ProfitList []*VirtualCoinCommission // 各币种对用的数量
SubsidyFeeList []*VirtualCoinCommission // 各币种对应的补贴数量
OwnSubsidyFeeList map[string]float64 // 各币种对应的补贴数量


+ 1
- 0
md/commission_parameter.go Ver ficheiro

@@ -19,6 +19,7 @@ type CommissionParam struct {
GoodsCommission string `json:"goods_commission"`
GoodsType string `json:"goods_type"`
TikTokTeamCommission string `json:"tik_tok_team_commission"`
MinLevel int `json:"min_level"`
}
type CommissionFirstParam struct {
CommissionParam CommissionParam `json:"commission_param"`


+ 24
- 2
svc/reward_commission.go Ver ficheiro

@@ -32,6 +32,7 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b
level = 0
userLevel = 0
newLevel = 0
minLevel = 0
)
user, _ := db.UserFindByID(engine, userId)
if user != nil {
@@ -41,6 +42,10 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b
userLevel = user.Level
}

minLevelList, _ := db.UserLevelInIDescByWeightLowWithOne(engine)
if minLevelList != nil {
minLevel = minLevelList.Id
}
// 获取抽成方案
newProvider := provider
if newProvider == md.PVD_TM { //抽成方案只有淘宝的要替换回来
@@ -243,6 +248,7 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b
return ulink.Profit, pvdFee, sysFee, subsidyFee, ulink, nil
}
// userRelationship == nil 是只返回第一层 即用户自己的
rmd.MinLevel = minLevel
pvdFee, sysFee, subsidyFee, ulink, err := CalcCommission(uid, level, 0, ownbuyReturnType, comf, zhios_order_relate_utils.StrToFloat64(price), isShare, cfg, userRelationship, newProvider, newLevel, engine, rmd.IsGoods, rmd)
if err != nil {
return 0, 0, 0, 0, nil, nil
@@ -543,8 +549,24 @@ func CalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee
for k, v := range amountList {
amountList[k].Val = ratioListMap[v.Cid] * v.Val
}
minProfit := 0.00
minProfitList := make([]*comm_plan.VirtualCoinCommission, 0)
if opt.Mode == "lv_ds_check" {
if level == rmd.MinLevel {
minProfit = commission
minProfitList = amountList
} else {
commission, _, amountList, ratioList = comm_plan.CalReturnAmountAndRatioDsOwn(rmd.MinLevel, ownbuyReturnType, 0, "own", fee, integralFee, opt)
ratioListMap := convertList2Map(ratioList)
for k, v := range amountList {
amountList[k].Val = ratioListMap[v.Cid] * v.Val
}
minProfit = commission
minProfitList = amountList
}
}
//重新计算佣金
return pvdFee, sysFee, subsidyFee, &comm_plan.LvUser{TikTokOwnSubsidyFeeList: tikTokSubsidyFeeList, OwnSubsidyFeeList: subsidyFeeList, Uid: uid, Lv: level, OldDiff: oldDiff, Profit: commission, ProfitList: amountList, Diff: 0}, nil
return pvdFee, sysFee, subsidyFee, &comm_plan.LvUser{MinProfit: minProfit, MinProfitList: minProfitList, TikTokOwnSubsidyFeeList: tikTokSubsidyFeeList, OwnSubsidyFeeList: subsidyFeeList, Uid: uid, Lv: level, OldDiff: oldDiff, Profit: commission, ProfitList: amountList, Diff: 0}, nil
}

//查出所有等级替换权重
@@ -555,7 +577,7 @@ func CalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee
levelWeight = v1.LevelWeight
}
}
lvUser = &comm_plan.LvUser{TikTokOwnSubsidyFeeList: tikTokSubsidyFeeList, OwnSubsidyFeeList: subsidyFeeList, Uid: uid, Lv: level, Diff: 0, OldDiff: oldDiff, NewLv: newLevel, LevelWeight: levelWeight, OwnbuyReturnType: ownbuyReturnType}
lvUser = &comm_plan.LvUser{MinLevel: rmd.MinLevel, TikTokOwnSubsidyFeeList: tikTokSubsidyFeeList, OwnSubsidyFeeList: subsidyFeeList, Uid: uid, Lv: level, Diff: 0, OldDiff: oldDiff, NewLv: newLevel, LevelWeight: levelWeight, OwnbuyReturnType: ownbuyReturnType}
var node = lvUser
//关系链处理
for _, v := range *userRelationShip {


Carregando…
Cancelar
Guardar