Sfoglia il codice sorgente

add reverse:for v1.8.4 test

tags/v1.8.4
huangjiajun 2 anni fa
parent
commit
1837e6b7d3
7 ha cambiato i file con 40 aggiunte e 47 eliminazioni
  1. +1
    -0
      db/model/plan_reward.go
  2. +1
    -0
      lib/comm_plan/init.go
  3. +10
    -12
      md/extend_price_reward.go
  4. +10
    -15
      svc/extend_agent_commission.go
  5. +15
    -19
      svc/extend_price_reward.go
  6. +1
    -0
      svc/get_plan_cfg.go
  7. +2
    -1
      svc/reward_commission.go

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

@@ -15,6 +15,7 @@ type PlanReward struct {
Source int `json:"source" xorm:"not null default 1 comment('佣金来源:1联盟佣金 2补贴金额') TINYINT(1)"`
AppType int `json:"app_type" xorm:"not null default 1 comment('所属应用:1导购 2自营 4O2O') TINYINT(3)"`
MerchantRate float32 `json:"merchant_rate" xorm:"not null default 0.0000 comment('o2o商家抽成比例') FLOAT(6,4)"`
NewAgentRate float32 `json:"new_agent_rate" xorm:"not null default 0.0000 comment('') FLOAT(6,4)"`
PushHandRate float32 `json:"push_hand_rate" xorm:"not null default 0.0000 comment('o2o推手抽成比例') FLOAT(6,4)"`
IntegralOpen int `json:"integral_open" xorm:"not null default 0 comment('积分抽成') TINYINT(1)"`
}

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

@@ -22,6 +22,7 @@ type PlanOpt struct {
RegionRate float64 // 区域代理占佣比例
GlobalRate float64 // 全球分红占佣比例
MerchantRate float64 //商家占佣比例
NewAgentRate float64 //代理分红占佣比例
PushHandRate float64 //推手占佣比例
//IntegralBili float64 // 积分兑换比例
//BlockIconsBili float64 // 区块币兑换比例


+ 10
- 12
md/extend_price_reward.go Vedi File

@@ -2,21 +2,19 @@ package md

// 直推奖励结构
type ExtendRewardLvGrade struct {
Lv int `json:"lv"` // 会员级别
LvName string `json:"lv_name"` // 会员名称
ReturnType []string `json:"return_type"` //返利类型
ExtendPriceRewardList []ExtendPriceRewardList `json:"extend_price_reward_list"` // 直推奖励比例
}
type ExtendPriceRewardList struct {
CoinID string `json:"coin_id"`
AreaAgent ExtendPriceRewardListDetail `json:"area_agent"`
CityAgent ExtendPriceRewardListDetail `json:"city_agent"`
ProvinceAgent ExtendPriceRewardListDetail `json:"province_agent"`
UpLv ExtendPriceRewardListDetail `json:"up_lv"`
Lv int `json:"lv"` // 会员级别
LvName string `json:"lv_name"` // 会员名称
ReturnType []string `json:"return_type"` //返利类型
ExtendPriceRewardUpLv map[string]ExtendPriceRewardListDetail `json:"extend_price_reward_up_lv"`
ExtendPriceRewardProvince map[string]ExtendPriceRewardListDetail `json:"extend_price_reward_province"`
ExtendPriceRewardCity map[string]ExtendPriceRewardListDetail `json:"extend_price_reward_city"`
ExtendPriceRewardArea map[string]ExtendPriceRewardListDetail `json:"extend_price_reward_area"`
ExtendPriceRewardBuyGoodsProvince map[string]ExtendPriceRewardListDetail `json:"extend_price_reward_buy_goods_province"`
ExtendPriceRewardBuyGoodsCity map[string]ExtendPriceRewardListDetail `json:"extend_price_reward_buy_goods_city"`
ExtendPriceRewardBuyGoodsArea map[string]ExtendPriceRewardListDetail `json:"extend_price_reward_buy_goods_area"`
}
type ExtendPriceRewardListDetail struct {
BaseVal string `json:"base_val"`
Bili string `json:"bili"`
PositionBili string `json:"position_bili"`
ExtendAgentBili string `json:"extend_agent_bili"`
}

+ 10
- 15
svc/extend_agent_commission.go Vedi File

@@ -69,9 +69,15 @@ func AddExtendAgentCommission(eg *xorm.Engine, args map[string]string) {
return
}
lvGrade := subsidyTmp[parentUser.Level]
var rewardList = make(map[string]md.ExtendPriceRewardList)
for _, v := range lvGrade.ExtendPriceRewardList {
rewardList[v.CoinID] = v
var rewardList = make(map[string]md.ExtendPriceRewardListDetail)
if agentUser.Level == 1 {
rewardList = lvGrade.ExtendPriceRewardBuyGoodsProvince
}
if agentUser.Level == 2 {
rewardList = lvGrade.ExtendPriceRewardBuyGoodsCity
}
if agentUser.Level == 3 {
rewardList = lvGrade.ExtendPriceRewardBuyGoodsArea
}
//判断有没有存过
relate, _ := db.GetExtendAgentCommissionRelate(eg, args["oid"], args["pvd"])
@@ -81,18 +87,7 @@ func AddExtendAgentCommission(eg *xorm.Engine, args map[string]string) {

for k, v := range rewardList {
var amount float64 = 0
rewardData := v
reward := md.ExtendPriceRewardListDetail{}
if agentUser.Level == 1 {
reward = rewardData.ProvinceAgent
}
if agentUser.Level == 2 {
reward = rewardData.CityAgent
}
if agentUser.Level == 3 {
reward = rewardData.AreaAgent
}
amount = zhios_order_relate_utils.StrToFloat64(args["commission"]) * zhios_order_relate_utils.StrToFloat64(reward.ExtendAgentBili) / 100
amount = zhios_order_relate_utils.StrToFloat64(args["commission"]) * zhios_order_relate_utils.StrToFloat64(v.Bili) / 100
if amount == 0 {
continue
}


+ 15
- 19
svc/extend_price_reward.go Vedi File

@@ -39,9 +39,20 @@ func ExtendPriceReward(eg *xorm.Engine, param map[string]string, cfg *comm_plan.
return map[string]string{"0": "0"}, 0
}
lvGrade := subsidyTmp[parentUser.Level]
var rewardList = make(map[string]md.ExtendPriceRewardList)
for _, v := range lvGrade.ExtendPriceRewardList {
rewardList[v.CoinID] = v
var rewardList = make(map[string]md.ExtendPriceRewardListDetail)
if param["source"] == "mall_goods_extend_price" {
rewardList = lvGrade.ExtendPriceRewardUpLv
}
if param["source"] == "regional_agent_pay" {
if param["level"] == "1" {
rewardList = lvGrade.ExtendPriceRewardProvince
}
if param["level"] == "2" {
rewardList = lvGrade.ExtendPriceRewardCity
}
if param["level"] == "3" {
rewardList = lvGrade.ExtendPriceRewardArea
}
}
//查出当前的数量
count, _ := eg.Where("source=? and lv=?", param["source"], param["level"]).Count(&model.UserLvBuyList{})
@@ -53,22 +64,7 @@ func ExtendPriceReward(eg *xorm.Engine, param map[string]string, cfg *comm_plan.
}
var extendReward = make(map[string]string)
for _, coinId := range lvGrade.ReturnType {
rewardData := rewardList[coinId]
reward := md.ExtendPriceRewardListDetail{}
if param["source"] == "mall_goods_extend_price" {
reward = rewardData.UpLv
}
if param["source"] == "regional_agent_pay" {
if param["level"] == "1" {
reward = rewardData.ProvinceAgent
}
if param["level"] == "2" {
reward = rewardData.CityAgent
}
if param["level"] == "3" {
reward = rewardData.AreaAgent
}
}
reward := rewardList[coinId]
var pendingAmount = param["commission"]
if zhios_order_relate_utils.StrToInt(coinId) > 0 { //积分更换基数
pendingAmount = param["integral"]


+ 1
- 0
svc/get_plan_cfg.go Vedi File

@@ -60,6 +60,7 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string) (*comm_plan.PlanOpt, erro
opt.GlobalRate = float64(int64(rewardOpt.GlobalRate*1e4)) / 1e4
opt.PushHandRate = float64(int64(rewardOpt.PushHandRate*1e4)) / 1e4
opt.MerchantRate = float64(int64(rewardOpt.MerchantRate*1e4)) / 1e4
opt.NewAgentRate = float64(int64(rewardOpt.NewAgentRate*1e4)) / 1e4
opt.PlanCommissionId = rewardOpt.PlanCommissionId
// 兑换现金比例
virtualCoinMoneyRate, err := GetVirtualCoinMoneyRateList(eg, masterId)


+ 2
- 1
svc/reward_commission.go Vedi File

@@ -397,8 +397,9 @@ func CommFee(fee float64, opt *comm_plan.PlanOpt, types string) (float64, float6
globalFee := fee * opt.GlobalRate // 全球分红比例
pushHandFee := fee * opt.PushHandRate
merchantFee := fee * opt.MerchantRate
newAgentFee := fee * opt.NewAgentRate
// 剩余可分配的佣金
fee = float64(int64(fee*1e4)-int64(pvdFee*1e4)-int64(sysFee*1e4)-int64(regionFee*1e4)-int64(globalFee*1e4)-int64(pushHandFee*1e4)-int64(merchantFee*1e4)) / 1e4
fee = float64(int64(fee*1e4)-int64(pvdFee*1e4)-int64(sysFee*1e4)-int64(regionFee*1e4)-int64(globalFee*1e4)-int64(pushHandFee*1e4)-int64(merchantFee*1e4)-int64(newAgentFee*1e4)) / 1e4
return fee, pvdFee, sysFee
}



Caricamento…
Annulla
Salva