Przeglądaj źródła

add reverse:for v1.5.3 公排返积分调整

tags/v1.5.3
huangjiajun 2 lat temu
rodzic
commit
86cbd79886
2 zmienionych plików z 43 dodań i 24 usunięć
  1. +7
    -5
      md/public_platoon_relate_commission.go
  2. +36
    -19
      svc/reward_commission.go

+ 7
- 5
md/public_platoon_relate_commission.go Wyświetl plik

@@ -11,11 +11,12 @@ type LvGrade struct {
}

type PublicPlatoonRelateCommissionReq struct {
Pvd string `json:"pvd"` //平台供应商 (taobao/jd/pdd/mall_goods ...)
Uid string `json:"uid"`
UserLevel string `json:"user_level"` //用户等级
PendingAmount string `json:"pending_amount"` //待处理金额
Oid string `json:"oid"` //订单id
Pvd string `json:"pvd"` //平台供应商 (taobao/jd/pdd/mall_goods ...)
Uid string `json:"uid"`
UserLevel string `json:"user_level"` //用户等级
PendingAmount string `json:"pending_amount"` //待处理金额
Oid string `json:"oid"` //订单id
PendingIntegral string `json:"pending_integral"` //待处理金额
}

type PublicPlatoonRelateCommissionResp struct {
@@ -27,6 +28,7 @@ type PublicPlatoonRelateCommissionResp struct {
SelfRateList map[string]string `json:"self_rate_list"` // 自购奖励
CommonWealthSystem map[string]string `json:"common_wealth_system"` // 共富制度奖励
DirectPush map[string]string `json:"direct_push"` // 直推奖励
PendingIntegral string `json:"pending_integral"` //待处理金额
}

type AddPublicPlatoonRelateCommissionReq struct {


+ 36
- 19
svc/reward_commission.go Wyświetl plik

@@ -88,16 +88,16 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b
//佣金扣除抽成后
fee, pvdFee, sysFee := CommFee(comf, cfg, "commission")
////积分扣除抽成后
//var integralSysFee float64 = 0
//integralFee, _, integralSysFee := CommFee(comf, cfg, "integral")
integralFee, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral")
//调用公排制度
var PublicPlatoonRelateCommissionReqList = []*md.PublicPlatoonRelateCommissionReq{
{
Pvd: newProvider,
Uid: zhios_order_relate_utils.IntToStr(uid),
UserLevel: zhios_order_relate_utils.IntToStr(level),
PendingAmount: zhios_order_relate_utils.Float64ToStr(fee),
Oid: rmd.Oid,
Pvd: newProvider,
Uid: zhios_order_relate_utils.IntToStr(uid),
UserLevel: zhios_order_relate_utils.IntToStr(level),
PendingAmount: zhios_order_relate_utils.Float64ToStr(fee),
PendingIntegral: zhios_order_relate_utils.Float64ToStr(integralFee),
Oid: rmd.Oid,
},
}
var order = make(map[string]*md.PublicPlatoonRelateCommissionResp)
@@ -114,24 +114,27 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b
var ulink = &comm_plan.LvUser{}
if zhios_order_relate_utils.StrToInt(reward.CommonWealthBenefitUid) != zhios_order_relate_utils.StrToInt(reward.DirectPushBenefitUid) {
//共富收益处理
ulink = getRewardLink(reward.CommonWealthBenefitUid, 2, reward.CommonWealthSystem, ulink, "public_platoon")
ulink = getRewardLink(reward.CommonWealthBenefitUid, 2, reward.CommonWealthSystem, ulink, "public_platoon", cfg)
//直推收益处理
ulink = getRewardLink(reward.DirectPushBenefitUid, 1, reward.DirectPush, ulink, "extend")
ulink = getRewardLink(reward.DirectPushBenefitUid, 1, reward.DirectPush, ulink, "extend", cfg)
} else { //共富 直推都是同一个用户的处理
ulink = getRewardLinkCommWithExtend(reward.CommonWealthBenefitUid, 3, reward.CommonWealthSystem, reward.DirectPush, ulink)
ulink = getRewardLinkCommWithExtend(reward.CommonWealthBenefitUid, 3, reward.CommonWealthSystem, reward.DirectPush, ulink, cfg)
}
//自购
ulink = getRewardLink(reward.Uid, 0, reward.SelfRateList, ulink, "own")
ulink = getRewardLink(reward.Uid, 0, reward.SelfRateList, ulink, "own", cfg)
return profit, pvdFee, sysFee, 0, ulink, nil
}
}
func getRewardLink(uid string, diff int, reward map[string]string, ulinkParent *comm_plan.LvUser, types string) *comm_plan.LvUser {
func getRewardLink(uid string, diff int, reward map[string]string, ulinkParent *comm_plan.LvUser, types string, cfg *comm_plan.PlanOpt) *comm_plan.LvUser {
var SubsidyFee = zhios_order_relate_utils.StrToFloat64(reward["0"])
var SubsidyFeeList = make([]*comm_plan.VirtualCoinCommission, 0)
for k, v := range reward {
coinId := zhios_order_relate_utils.StrToInt(k)
ratio := cfg.VirtualCoinMoneyRatioList[coinId]
rate := zhios_order_relate_utils.StrToFloat64(ratio)
var tmp = &comm_plan.VirtualCoinCommission{
Cid: k,
Val: zhios_order_relate_utils.StrToFloat64(v),
Val: zhios_order_relate_utils.StrToFloat64(v) * rate,
}
SubsidyFeeList = append(SubsidyFeeList, tmp)
}
@@ -151,22 +154,31 @@ func getRewardLink(uid string, diff int, reward map[string]string, ulinkParent *
return ulink
}

func getRewardLinkCommWithExtend(uid string, diff int, reward map[string]string, rewardExtend map[string]string, ulinkParent *comm_plan.LvUser) *comm_plan.LvUser {
func getRewardLinkCommWithExtend(uid string, diff int, reward map[string]string, rewardExtend map[string]string, ulinkParent *comm_plan.LvUser, cfg *comm_plan.PlanOpt) *comm_plan.LvUser {
var SubsidyFee = zhios_order_relate_utils.StrToFloat64(reward["0"])
var SubsidyFeeList = make([]*comm_plan.VirtualCoinCommission, 0)
for k, v := range reward {
coinId := zhios_order_relate_utils.StrToInt(k)
ratio := cfg.VirtualCoinMoneyRatioList[coinId]
rate := zhios_order_relate_utils.StrToFloat64(ratio)
var tmp = &comm_plan.VirtualCoinCommission{
Cid: k,
Val: zhios_order_relate_utils.StrToFloat64(v),
Val: zhios_order_relate_utils.StrToFloat64(v) * rate,
}
SubsidyFeeList = append(SubsidyFeeList, tmp)
}
var SubsidyFeeExtend = zhios_order_relate_utils.StrToFloat64(rewardExtend["0"])
var SubsidyFeeListExtend = make([]*comm_plan.VirtualCoinCommission, 0)
for k, v := range rewardExtend {
var rate float64 = 1
coinId := zhios_order_relate_utils.StrToInt(k)
if coinId > 0 {
ratio := cfg.VirtualCoinMoneyRatioList[coinId]
rate = zhios_order_relate_utils.StrToFloat64(ratio)
}
var tmp = &comm_plan.VirtualCoinCommission{
Cid: k,
Val: zhios_order_relate_utils.StrToFloat64(v),
Val: zhios_order_relate_utils.StrToFloat64(v) * rate,
}
SubsidyFeeListExtend = append(SubsidyFeeListExtend, tmp)
}
@@ -496,14 +508,19 @@ func BatchGetPublicPlatoonRelateCommissionByGoods(engine *xorm.Engine, masterId
var directPush = make(map[string]string)
var selfRateList = make(map[string]string)
var commonWealthSystem = make(map[string]string)
var pendingAmount = param.PendingAmount
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)
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)
}
resp[param.Oid] = &md.PublicPlatoonRelateCommissionResp{
Uid: param.Uid,
PendingAmount: param.PendingAmount,
PendingIntegral: param.PendingIntegral,
Oid: param.Oid,
SelfRateList: selfRateList,
CommonWealthSystem: commonWealthSystem,


Ładowanie…
Anuluj
Zapisz