huangjiajun 1 anno fa
parent
commit
6ef8459bff
3 ha cambiato i file con 37 aggiunte e 28 eliminazioni
  1. +3
    -2
      lib/comm_plan/ds_check.go
  2. +14
    -10
      lib/comm_plan/init.go
  3. +20
    -16
      svc/reward_commission.go

+ 3
- 2
lib/comm_plan/ds_check.go Vedi File

@@ -34,8 +34,9 @@ func CalReturnAmountAndRatioDsOwn(level, ownbuyReturnType, peerNum int, userType
continue
}
amountList = append(amountList, &VirtualCoinCommission{
Cid: coinId,
Val: amount,
Cid: coinId,
Val: amount,
ProfitBili: zhios_order_relate_utils.AnyToFloat64(ratio),
})
ratioList = append(ratioList, &VirtualCoinCommission{
Cid: coinId,


+ 14
- 10
lib/comm_plan/init.go Vedi File

@@ -160,13 +160,16 @@ type SettleCommissionToRelationList struct {
Name string `json:"name"`
}
type LvUser struct {
Uid int // 用户ID
Lv int // 等级
NewLv int // 升级后等级 针对会员费分佣
LevelWeight int // 权重
Profit float64 // 利润(金额)
SubsidyFee float64 // 补贴(金额)
MinLevel int
FirstFee float64
IntegralFirstFee float64
ProfitBili float64
Uid int // 用户ID
Lv int // 等级
NewLv int // 升级后等级 针对会员费分佣
LevelWeight int // 权重
Profit float64 // 利润(金额)
SubsidyFee float64 // 补贴(金额)
MinLevel int
//IntegralProfit float64 // 积分利润
//IntegralSubsidyFee float64 // 积分补贴
//BlockIconsProfit float64 // 区块币利润
@@ -185,9 +188,10 @@ type LvUser struct {

// 虚拟币分佣结构体
type VirtualCoinCommission struct {
Cid string `json:"cid"` // 虚拟币id
Val float64 `json:"val"` // 数量
Bili float64 `json:"bili"`
Cid string `json:"cid"` // 虚拟币id
Val float64 `json:"val"` // 数量
Bili float64 `json:"bili"`
ProfitBili float64 `json:"profit_bili"`
}

type VirtualCoinRateList struct {


+ 20
- 16
svc/reward_commission.go Vedi File

@@ -84,9 +84,9 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b
if cfg.Mode == "public_platoon" {
//公排
//佣金扣除抽成后
fee, pvdFee, sysFee := CommFee(comf, cfg, "commission", rmd.IsGoods)
fee, _, pvdFee, sysFee := CommFee(comf, cfg, "commission", rmd.IsGoods)
////积分扣除抽成后
integralFee, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd.IsGoods)
integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd.IsGoods)
//调用公排制度

userPublicPlatoonSetting, err := db.UserPublicPlatoonSettingGetOneByParams(engine, map[string]interface{}{
@@ -189,9 +189,9 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b
userLevel = zhios_order_relate_utils.StrToInt(extraData["agent_lv"])
}
//佣金扣除抽成后
fee, pvdFee, sysFee := CommFee(comf, cfg, "commission", rmd.IsGoods)
fee, _, pvdFee, sysFee := CommFee(comf, cfg, "commission", rmd.IsGoods)
////积分扣除抽成后
integralFee, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd.IsGoods)
integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd.IsGoods)
var param = map[string]string{
"commission": zhios_order_relate_utils.Float64ToStr(fee),
"integral": zhios_order_relate_utils.Float64ToStr(integralFee),
@@ -471,10 +471,12 @@ func currentPrice(m *md.CommissionParam, pvd string) string {
return ""
}
}
func CommFee(fee float64, opt *comm_plan.PlanOpt, types, isGoods string) (float64, float64, float64) {
func CommFee(fee float64, opt *comm_plan.PlanOpt, types, isGoods string) (float64, float64, float64, float64) {
var feeFirst float64 = 1
if types == "integral" && opt.IntegralOpen == 0 || opt.Mode == "lv_winery" { //积分抽成后台没开启不用扣
return fee, 0, 0
return fee, feeFirst, 0, 0
}

if isGoods == "1" {
orderBeforeRate := fee * opt.OrderBeforeRate
fee1 := int64(fee*1e4) - int64(orderBeforeRate*1e4)
@@ -496,7 +498,7 @@ func CommFee(fee float64, opt *comm_plan.PlanOpt, types, isGoods string) (float6
if fee < 0 {
fee = 0
}
return fee, pvdFee, sysFee
return fee, feeFirst, pvdFee, sysFee
}

// 根据用户计算对应的手续费
@@ -504,10 +506,12 @@ func CommFee(fee float64, opt *comm_plan.PlanOpt, types, isGoods string) (float6
//pvd 只是为了判断是会员升级的订单 可不传
func CalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee float64, isShare bool, opt *comm_plan.PlanOpt, userRelationShip *[]md.UserRelation, pvd string, newLevel int, eg *xorm.Engine, isGoods string, rmd *md.CommissionParam) (pvdFee, sysFee, subsidyFee float64, lvUser *comm_plan.LvUser, err error) {
//佣金扣除抽成后
fee, pvdFee, sysFee = CommFee(fee, opt, "commission", isGoods)
var feeFirst float64 = 1
var integralFeeFirst float64 = 1
fee, feeFirst, pvdFee, sysFee = CommFee(fee, opt, "commission", isGoods)
//积分扣除抽成后
var integralSysFee float64 = 0
integralFee, _, integralSysFee = CommFee(integralFee, opt, "integral", isGoods)
integralFee, integralFeeFirst, _, integralSysFee = CommFee(integralFee, opt, "integral", isGoods)
// 计算自购补贴比例
subsidyFee = 0
//如果没登录,要找出权重最低的那个
@@ -552,12 +556,12 @@ func CalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee
fmt.Println("==================================这里4", fee)
}
// 获得自购的
commission, _, amountList, ratioList := comm_plan.CalReturnAmountAndRatio(level, ownbuyReturnType, 0, "own", fee, integralFee, opt)
commission, profitBili, amountList, ratioList := comm_plan.CalReturnAmountAndRatio(level, ownbuyReturnType, 0, "own", fee, integralFee, opt)
if opt.Mode == "lv_winery" {
commission, _, amountList, ratioList = comm_plan.CalReturnAmountAndRatioToWinery(level, fee, integralFee, opt)
commission, profitBili, amountList, ratioList = comm_plan.CalReturnAmountAndRatioToWinery(level, fee, integralFee, opt)
}
if opt.Mode == "lv_ds_check" {
commission, _, amountList, ratioList = comm_plan.CalReturnAmountAndRatioDsOwn(level, ownbuyReturnType, 0, "own", fee, integralFee, opt)
commission, profitBili, amountList, ratioList = comm_plan.CalReturnAmountAndRatioDsOwn(level, ownbuyReturnType, 0, "own", fee, integralFee, opt)
}
if uid == 8 {
fmt.Println("==================================这里5", commission)
@@ -567,7 +571,7 @@ func CalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee
amountList[k].Val = ratioListMap[v.Cid] * v.Val
}
//重新计算佣金
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{ProfitBili: profitBili, FirstFee: feeFirst, IntegralFirstFee: integralFeeFirst, TikTokOwnSubsidyFeeList: tikTokSubsidyFeeList, OwnSubsidyFeeList: subsidyFeeList, Uid: uid, Lv: level, OldDiff: oldDiff, Profit: commission, ProfitList: amountList, Diff: 0}, nil
}
if uid == 8 {
fmt.Println("==================================这里6")
@@ -625,11 +629,11 @@ func CalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee
//pvd 只是为了判断是会员升级的订单 可不传
func NiuBeiCalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee float64, isShare bool, opt *comm_plan.PlanOpt, userRelationShip *[]md.UserRelation, pvd string, newLevel int, eg *xorm.Engine, isGoods string, rmd *md.CommissionParam) (pvdFee, sysFee, subsidyFee float64, lvUser *comm_plan.LvUser, err error) {
//佣金扣除抽成后
fee, pvdFee, sysFee = CommFee(fee, opt, "commission", isGoods)
fee, _, pvdFee, sysFee = CommFee(fee, opt, "commission", isGoods)
//积分扣除抽成后
var integralSysFee float64 = 0
integralFee, _, integralSysFee = CommFee(integralFee, opt, "integral", isGoods)
integralFeeForPrice, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(rmd.OldPrice), opt, "integral", isGoods)
integralFee, _, _, integralSysFee = CommFee(integralFee, opt, "integral", isGoods)
integralFeeForPrice, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(rmd.OldPrice), opt, "integral", isGoods)
// 计算自购补贴比例
subsidyFee = 0
//如果没登录,要找出权重最低的那个


Caricamento…
Annulla
Salva