Bläddra i källkod

更新

master
huangjiajun 1 år sedan
förälder
incheckning
3fb3fdfee8
3 ändrade filer med 22 tillägg och 18 borttagningar
  1. +1
    -0
      md/commission_parameter.go
  2. +17
    -14
      svc/reward_commission.go
  3. +4
    -4
      svc/svc_integral_release.go

+ 1
- 0
md/commission_parameter.go Visa fil

@@ -21,6 +21,7 @@ type CommissionParam struct {
TikTokTeamCommission string `json:"tik_tok_team_commission"`
IsTikTokTeamOrder string `json:"is_tik_tok_team_order"`
MinLevel int `json:"min_level"`
DouyinBili string `json:"douyin_bili"`
}
type CommissionFirstParam struct {
CommissionParam CommissionParam `json:"commission_param"`


+ 17
- 14
svc/reward_commission.go Visa fil

@@ -90,9 +90,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)
////积分扣除抽成后
integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd.IsGoods)
integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd)
//调用公排制度

userPublicPlatoonSetting, err := db.UserPublicPlatoonSettingGetOneByParams(engine, map[string]interface{}{
@@ -175,7 +175,7 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b
}
if cfg.Mode == "lv_integral_release" { //
price = rmd.OldPrice
pvdFee, sysFee, _, ulink, err := IntegralRelease(engine, uid, newLevel, returnAllLevel, rmd.IsShowExtend, newProvider, user, comf, price, cfg, rmd.IsGoods, commArr, virtualCoinMoneyRate)
pvdFee, sysFee, _, ulink, err := IntegralRelease(engine, uid, newLevel, returnAllLevel, rmd.IsShowExtend, newProvider, user, comf, price, cfg, rmd, commArr, virtualCoinMoneyRate)
if err != nil {
return 0, 0, 0, 0, nil, nil
}
@@ -195,9 +195,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)
////积分扣除抽成后
integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd.IsGoods)
integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd)
var param = map[string]string{
"commission": zhios_order_relate_utils.Float64ToStr(fee),
"integral": zhios_order_relate_utils.Float64ToStr(integralFee),
@@ -270,9 +270,9 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b
}
func public(engine *xorm.Engine, ulinkParent *comm_plan.LvUser, cfg *comm_plan.PlanOpt, newProvider string, uid int, comf float64, price string, rmd *md.CommissionParam) *comm_plan.LvUser {
//佣金扣除抽成后
fee, _, _, _ := CommFee(comf, cfg, "commission", rmd.IsGoods)
fee, _, _, _ := CommFee(comf, cfg, "commission", rmd)
////积分扣除抽成后
integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd.IsGoods)
integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd)
//调用公排制度

userPublicPlatoonSetting, err := db.UserPublicPlatoonSettingGetOneByParams(engine, map[string]interface{}{
@@ -576,12 +576,12 @@ func currentPrice(m *md.CommissionParam, pvd string) string {
return ""
}
}
func CommFee(fee float64, opt *comm_plan.PlanOpt, types, isGoods string) (float64, float64, float64, float64) {
func CommFee(fee float64, opt *comm_plan.PlanOpt, types string, rmd *md.CommissionParam) (float64, float64, float64, float64) {
var feeFirst float64 = 1
if types == "integral" && opt.IntegralOpen == 0 || opt.Mode == "lv_winery" { //积分抽成后台没开启不用扣
return fee, feeFirst, 0, 0
}
isGoods := rmd.IsGoods
if isGoods == "1" {
orderBeforeRate := fee * opt.OrderBeforeRate
orderBeforeRateFirst := feeFirst * opt.OrderBeforeRate
@@ -610,6 +610,9 @@ func CommFee(fee float64, opt *comm_plan.PlanOpt, types, isGoods string) (float6
for _, v := range opt.RateList {
total -= int64(fee * (v / 100) * 1e4)
}
if zhios_order_relate_utils.StrToFloat64(rmd.DouyinBili) > 0 {
total -= int64(zhios_order_relate_utils.StrToFloat64(rmd.DouyinBili) * 1e4)
}
fee = float64(total) / 1e4
if fee < 0 {
fee = 0
@@ -645,10 +648,10 @@ func CalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee
//佣金扣除抽成后
var feeFirst float64 = 1
var integralFeeFirst float64 = 1
fee, feeFirst, pvdFee, sysFee = CommFee(fee, opt, "commission", isGoods)
fee, feeFirst, pvdFee, sysFee = CommFee(fee, opt, "commission", rmd)
//积分扣除抽成后
var integralSysFee float64 = 0
integralFee, integralFeeFirst, _, integralSysFee = CommFee(integralFee, opt, "integral", isGoods)
integralFee, integralFeeFirst, _, integralSysFee = CommFee(integralFee, opt, "integral", rmd)
// 计算自购补贴比例
subsidyFee = 0
//如果没登录,要找出权重最低的那个
@@ -764,11 +767,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", rmd)
//积分扣除抽成后
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", rmd)
integralFeeForPrice, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(rmd.OldPrice), opt, "integral", rmd)
// 计算自购补贴比例
subsidyFee = 0
//如果没登录,要找出权重最低的那个


+ 4
- 4
svc/svc_integral_release.go Visa fil

@@ -12,12 +12,12 @@ import (
"xorm.io/xorm"
)

func IntegralRelease(engine *xorm.Engine, uid, level int, returnAllLevel bool, IsShowExtend, pvd string, user *model.User, comf float64, price string, cfg *comm_plan.PlanOpt, isGoods string, commArr map[string]string, virtualCoinMoneyRate map[int]string) (pvdFee, sysFee, subsidyFee float64, lvUser *comm_plan.LvUser, err error) {
func IntegralRelease(engine *xorm.Engine, uid, level int, returnAllLevel bool, IsShowExtend, pvd string, user *model.User, comf float64, price string, cfg *comm_plan.PlanOpt, rmd *md.CommissionParam, commArr map[string]string, virtualCoinMoneyRate map[int]string) (pvdFee, sysFee, subsidyFee float64, lvUser *comm_plan.LvUser, err error) {
//佣金扣除抽成后
fee, _, pvdFee, sysFee := CommFee(comf, cfg, "commission", isGoods)
fee, _, pvdFee, sysFee := CommFee(comf, cfg, "commission", rmd)
////积分扣除抽成后
integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", isGoods)
integralFeeCom, _, _, _ := CommFee(comf, cfg, "integral", isGoods)
integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd)
integralFeeCom, _, _, _ := CommFee(comf, cfg, "integral", rmd)
//常规级差
var userRelationship *[]md.UserRelation
if returnAllLevel {


Laddar…
Avbryt
Spara