Browse Source

Merge remote-tracking branch 'origin/master'

master
DengBiao 10 months ago
parent
commit
1feadcc880
8 changed files with 42 additions and 25 deletions
  1. +1
    -0
      db/model/plan_reward.go
  2. +1
    -0
      lib/comm_plan/init.go
  3. +11
    -10
      md/provider.go
  4. +1
    -1
      rule/appreciation.go
  5. +6
    -1
      rule/relate_commission.go
  6. +12
    -6
      svc/get_plan_cfg.go
  7. +3
    -4
      svc/reward_commission.go
  8. +7
    -3
      svc/small_public_platoon_relate_commission.go

+ 1
- 0
db/model/plan_reward.go View File

@@ -9,6 +9,7 @@ type PlanReward struct {
RegionSubRate float32 `json:"region_sub_rate" xorm:"not null default 0.0000 comment('区域代理抽成比例') FLOAT(6,4)"`
GlobalRate float32 `json:"global_rate" xorm:"not null default 0.0000 comment('全球分红抽成比例') FLOAT(6,4)"`
SelfBuyGlobalRate float64 `json:"self_buy_global_rate" xorm:"not null default 0.0000 comment('全球分红抽成比例') FLOAT(6,4)"`
BuckleRate float64 `json:"buckle_rate_rate" xorm:"not null default 0.0000 comment('抽成比例') FLOAT(6,4)"`
SettleMode int `json:"settle_mode" xorm:"not null default 1 comment('0.手动方案,1.自动方案') TINYINT(1)"`
PlanCommissionId int `json:"plan_commission_id" xorm:"not null default 0 comment('佣金方案0未设置,>0对应方案') TINYINT(3)"`
PlanSettleId int `json:"plan_settle_id" xorm:"not null default 0 comment('结算方案0未设置,>0对应方案') TINYINT(3)"`


+ 1
- 0
lib/comm_plan/init.go View File

@@ -21,6 +21,7 @@ type NiuBeiIntegralReleaseO2oRatio struct {
Key string `json:"key"`
}
type PlanOpt struct {
BuckleRate float64
PointType int
IntegralOpen int
PlanCommissionId int


+ 11
- 10
md/provider.go View File

@@ -1,16 +1,17 @@
package md

const (
PVD_TB = "taobao"
PVD_JD = "jd"
PVD_SN = "suning"
PVD_VIP = "vip"
PVD_PDD = "pdd"
PVD_KL = "kaola"
PVD_TM = "tmall"
PVD_DTK = "dataoke"
PVD_HDK = "haodanku"
PVD_JTT = "jingtuitui"
PVD_TB = "taobao"
PVD_JD = "jd"
PVD_JDOwn = "jd_own"
PVD_SN = "suning"
PVD_VIP = "vip"
PVD_PDD = "pdd"
PVD_KL = "kaola"
PVD_TM = "tmall"
PVD_DTK = "dataoke"
PVD_HDK = "haodanku"
PVD_JTT = "jingtuitui"
// 特殊活动免单方案
PVD_FREE = "free"
PVD_MEITUAN = "meituan"


+ 1
- 1
rule/appreciation.go View File

@@ -85,6 +85,6 @@ func DealWithdrawalAndDestroy(session *xorm.Session, feeMap md.DealWithdrawalFee
resp.TransferOutValue, _ = decimal.NewFromFloat(transferOut).Mul(decimal.NewFromFloat(nowValue)).Float64()
resp.AmountOut, _ = transferOutValue.Mul(decimal.NewFromFloat(nowValue)).Float64()
resp.DestroyValue, _ = destroyValue.Float64()
resp.RefluxValue, _ = refluxValue.Float64()
resp.RefluxValue, _ = refluxValue.Mul(decimal.NewFromFloat(nowValue)).Float64()
return
}

+ 6
- 1
rule/relate_commission.go View File

@@ -278,7 +278,12 @@ func BatchGetCommissionByOrder(engine *xorm.Engine, dbName string, CommissionPar
}
param.CommissionParam.ShowLevel = param.ShowLevel
param.CommissionParam.Oid = param.Oid
profit, pvdFee, sysFee, subsidyFee, lvUser, err := svc.GetRewardCommission(engine, &param.CommissionParam, isShare, param.Uid, param.Provider, dbName, isAllLevelReturn, map[string]string{}, commArr, plan, commission, virtualCoinMoneyRate)
var mapData = map[string]string{
"old_lv": param.OldLv,
"new_lv": param.NewLv,
"ownbuy_return_type": zhios_order_relate_utils.IntToStr(param.OwnbuyReturnType),
}
profit, pvdFee, sysFee, subsidyFee, lvUser, err := svc.GetRewardCommission(engine, &param.CommissionParam, isShare, param.Uid, param.Provider, dbName, isAllLevelReturn, mapData, commArr, plan, commission, virtualCoinMoneyRate)
if err != nil {
return err
}


+ 12
- 6
svc/get_plan_cfg.go View File

@@ -20,12 +20,13 @@ var pvdCfgList = map[string]struct {
SK string
Sid string
}{
md.PVD_TB: {"third_taobao_svc_ak", "third_taobao_svc_sk", "third_taobao_web_sid"},
md.PVD_KL: {md.KEY_CFG_KL_AK, md.KEY_CFG_KL_SK, ""},
md.PVD_SN: {md.KEY_CFG_SN_AK, md.KEY_CFG_SN_SK, ""},
md.PVD_JD: {md.KEY_CFG_ZM_AK, md.KEY_CFG_ZM_SK, md.KEY_CFG_ZM_WEB_ID},
md.PVD_PDD: {md.KEY_CFG_ZM_AK, md.KEY_CFG_ZM_SK, md.KEY_CFG_ZM_WEB_ID},
md.PVD_VIP: {md.KEY_CFG_ZM_AK, md.KEY_CFG_ZM_SK, md.KEY_CFG_ZM_WEB_ID},
md.PVD_TB: {"third_taobao_svc_ak", "third_taobao_svc_sk", "third_taobao_web_sid"},
md.PVD_KL: {md.KEY_CFG_KL_AK, md.KEY_CFG_KL_SK, ""},
md.PVD_SN: {md.KEY_CFG_SN_AK, md.KEY_CFG_SN_SK, ""},
md.PVD_JD: {md.KEY_CFG_ZM_AK, md.KEY_CFG_ZM_SK, md.KEY_CFG_ZM_WEB_ID},
md.PVD_JDOwn: {md.KEY_CFG_ZM_AK, md.KEY_CFG_ZM_SK, md.KEY_CFG_ZM_WEB_ID},
md.PVD_PDD: {md.KEY_CFG_ZM_AK, md.KEY_CFG_ZM_SK, md.KEY_CFG_ZM_WEB_ID},
md.PVD_VIP: {md.KEY_CFG_ZM_AK, md.KEY_CFG_ZM_SK, md.KEY_CFG_ZM_WEB_ID},
}

func GetAllPlan(eg *xorm.Engine, dbName string) (map[string]*model.PlanReward, map[int]*model.PlanCommission, map[int]string) {
@@ -82,6 +83,9 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string, rewardOpts map[string]*mo
rewardOpt = rewardOpts["kuaishouTeam"]
}
}
if pvd == md.PVD_JDOwn && (rewardOpts["jd_own"] == nil || (rewardOpts["jd_own"] != nil && rewardOpts["jd_own"].PlanCommissionId == 0)) {
rewardOpt = rewardOpts["jd"]
}
if rewardOpt == nil {
return nil, zhios_order_relate_logx.Warn("找不到方案记录")
}
@@ -112,6 +116,7 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string, rewardOpts map[string]*mo
opt.MerchantRate = float64(int64(rewardOpt.MerchantRate*1e4)) / 1e4
opt.NewAgentRate = float64(int64(rewardOpt.NewAgentRate*1e4)) / 1e4
opt.OrderBeforeRate = float64(int64(rewardOpt.OrderBeforeRate*1e4)) / 1e4
opt.BuckleRate = float64(int64(rewardOpt.BuckleRate*1e4)) / 1e4
opt.PlanCommissionId = rewardOpt.PlanCommissionId
rateList := make(map[string]float64)
if rewardOpt.RateList != "" {
@@ -285,6 +290,7 @@ func PlanOpts(eg *xorm.Engine) map[string]*comm_plan.PlanOpt {
GlobalRate: float64(v.GlobalRate),
SelfBuyGlobalRate: v.SelfBuyGlobalRate,
UserRate: subsidyTmp,
BuckleRate: v.BuckleRate,
}

}


+ 3
- 4
svc/reward_commission.go View File

@@ -20,7 +20,7 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b
virType := commArr["virType"]
if virType == "commission" {
rmd.PaidPrice = rmd.Commission
if zhios_order_relate_utils.InArr(provider, []string{md.PVD_TB, md.PVD_TM, md.PVD_PDD, md.PVD_SN, md.PVD_KL, md.PVD_JD, md.PVD_VIP}) == false {
if zhios_order_relate_utils.InArr(provider, []string{md.PVD_TB, md.PVD_TM, md.PVD_PDD, md.PVD_SN, md.PVD_KL, md.PVD_JD, md.PVD_JDOwn, md.PVD_VIP}) == false {
rmd.GoodsPrice = rmd.Commission
}
}
@@ -78,7 +78,6 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b
if cfg == nil {
return 0, 0, 0, 0, nil, errors.New("分佣方案未设置")
}

// 获取全部佣金
com, price := getCommission(rmd, provider)
fmt.Println(com)
@@ -469,7 +468,7 @@ func getCommission(d *md.CommissionParam, provider string) (string, string) {
commissionRateF := zhios_order_relate_utils.StrToFloat64(d.CommissionRate) / 100
com := currentPriceF * commissionRateF
return zhios_order_relate_utils.Float64ToStr(com), currentPrice
case md.PVD_JD:
case md.PVD_JD, md.PVD_JDOwn:
if zhios_order_relate_utils.StrToFloat64(d.GoodsPrice) == 0 {
//如果价格没有直接返回佣金
return d.Commission, d.PaidPrice
@@ -539,7 +538,7 @@ func currentPrice(m *md.CommissionParam, pvd string) string {
return zhios_order_relate_utils.Float64ToStr(price)
}
return m.WlGoodsPrice
case md.PVD_JD:
case md.PVD_JD, md.PVD_JDOwn:
//fmt.Println(m.LowestCouponPrice, m.LowerPrice, m.WlGoodsPrice)
if m.LowestCouponPrice == "" {
if m.CouponPrice != "" {


+ 7
- 3
svc/small_public_platoon_relate_commission.go View File

@@ -54,9 +54,13 @@ func BatchSmallGetPublicPlatoonRelateCommission(engine *xorm.Engine, masterId st
var commonWealthSystem = make(map[string]string)
if lvGrade != nil {
for _, coinId := range lvGrade.ReturnType {
selfRateList[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.SelfRateList[coinId]) * zhios_order_relate_utils.StrToFloat64(param.PendingAmount) / 100)
commonWealthSystem[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.CommonWealthSystem[coinId]) * zhios_order_relate_utils.StrToFloat64(param.PendingAmount) / 100)
directPush[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.DirectPush[coinId]) * zhios_order_relate_utils.StrToFloat64(param.PendingAmount) / 100)
var pendingAmount = param.PendingAmount
if zhios_order_relate_utils.StrToInt(coinId) > 0 { //积分更换基数
pendingAmount = param.PendingIntegral
}
selfRateList[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.SelfRateList[coinId]) * zhios_order_relate_utils.StrToFloat64(pendingAmount) / 100)
commonWealthSystem[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.CommonWealthSystem[coinId]) * zhios_order_relate_utils.StrToFloat64(pendingAmount) / 100)
directPush[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.DirectPush[coinId]) * zhios_order_relate_utils.StrToFloat64(pendingAmount) / 100)
}
}



Loading…
Cancel
Save