Browse Source

add reverse:for v1.5.9 test

tags/v1.5.9
huangjiajun 2 years ago
parent
commit
090c2ffc76
3 changed files with 39 additions and 12 deletions
  1. +16
    -4
      md/extend_price_reward.go
  2. +22
    -7
      svc/extend_price_reward.go
  3. +1
    -1
      svc/get_plan_cfg.go

+ 16
- 4
md/extend_price_reward.go View File

@@ -2,8 +2,20 @@ package md

// 直推奖励结构
type ExtendRewardLvGrade struct {
Lv int `json:"lv"` // 会员级别
LvName string `json:"lv_name"` // 会员名称
ReturnType []string `json:"return_type"` //返利类型
ExtendPriceRewardList []map[string]string `json:"extend_price_reward_list"` // 直推奖励比例
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"`
}
type ExtendPriceRewardListDetail struct {
BaseVal string `json:"base_val"`
Bili string `json:"bili"`
PositionBili string `json:"position_bili"`
}

+ 22
- 7
svc/extend_price_reward.go View File

@@ -39,9 +39,9 @@ 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]map[string]string)
var rewardList = make(map[string]md.ExtendPriceRewardList)
for _, v := range lvGrade.ExtendPriceRewardList {
rewardList[v["coin_id"]] = v
rewardList[v.CoinID] = v
}
//查出当前的数量
count, _ := eg.Where("source=? and lv=?", param["source"], param["level"]).Count(&model.UserLvBuyList{})
@@ -53,17 +53,32 @@ func ExtendPriceReward(eg *xorm.Engine, param map[string]string, cfg *comm_plan.
}
var extendReward = make(map[string]string)
for _, coinId := range lvGrade.ReturnType {
reward := rewardList[coinId]
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
}
}
var pendingAmount = param["commission"]
if zhios_order_relate_utils.StrToInt(coinId) > 0 { //积分更换基数
pendingAmount = param["integral"]
}
rewardAmount := reward["extend_bili"]
rewardAmount := reward.Bili
//如果等级一致 判断位置
if isTrue {
position := count % zhios_order_relate_utils.StrToInt64(param["base_val"])
if isTrue && zhios_order_relate_utils.StrToInt(reward.BaseVal) > 0 {
position := count % zhios_order_relate_utils.StrToInt64(reward.BaseVal)
if position == 0 {
rewardAmount = reward["extend_position_bili"]
rewardAmount = reward.PositionBili
}
}



+ 1
- 1
svc/get_plan_cfg.go View File

@@ -48,7 +48,7 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string) (*comm_plan.PlanOpt, erro
if err != nil || commissionOpt == nil || commissionOpt.Id == 0 {
return nil, err
}
if _, ok := comm_plan.Fn[commissionOpt.Mode]; !ok && commissionOpt.Mode != "public_platoon" {
if _, ok := comm_plan.Fn[commissionOpt.Mode]; !ok && zhios_order_relate_utils.InArr(commissionOpt.Mode, []string{"public_platoon", "extend_price"}) == false {
return nil, zhios_order_relate_logx.Warn("分佣模式不存在")
}
opt.Pvd = pvd


Loading…
Cancel
Save