From 68edc684d3ffee788df44ae3472304c1035c4fa3 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 4 Apr 2023 14:44:19 +0800 Subject: [PATCH] test --- lib/comm_plan/init.go | 30 ++++++++++++++++++++++++++++++ svc/get_plan_cfg.go | 17 +++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/lib/comm_plan/init.go b/lib/comm_plan/init.go index 194617d..27241b2 100644 --- a/lib/comm_plan/init.go +++ b/lib/comm_plan/init.go @@ -78,6 +78,36 @@ type LvGrade struct { TikTokTeamSubsidyOwnBiliType []string `json:"tik_tok_team_subsidy_own_bili_type"` //分销 返利类型 TikTokTeamSubsidyList []map[string]string `json:"tik_tok_team_subsidy_list"` } +type LvGradeDs struct { + Lv int `json:"lv"` // 级别 + SubsidyMode int `json:"subsidy_mode"` // 补贴计算方式, 0按佣金计算,1按平台利润计算 + SubsidyEnable int `json:"subsidy_enable"` // 是否开启补贴计算方式 0关闭, 1开启 + TikTokTeamSubsidyEnable int `json:"tik_tok_team_subsidy_enable"` // 是否开启补贴计算方式 0关闭, 1开启 + SubsidySelfRate float64 `json:"subsidy_self_rate"` // 自购补贴比例 + SubsidyShareRate float64 `json:"subsidy_share_rate"` // 分享补贴比例 + PayMode int `json:"pay_mode"` // 0团队内部支出, 1平台系统支出 + SelfRate float64 `json:"self_rate"` // 自购比例 + TeamRate float64 `json:"team_rate"` // 团队分成比例 + PeerRate []float64 `json:"peer_rate"` // 同级分成比例 + UserLvUpSubsidyEnable int `json:"user_lv_up_subsidy_enable"` //分销补贴开关 + UserLvUpSubsidyMode int `json:"user_lv_up_subsidy_mode"` //补贴方式 0比例 1固定金额 + UserSubsidyType string `json:"user_subsidy_type"` // 补贴模式 up_lv 推荐会员补贴 buy_goods 购买商品 + UserSubsidyBaseCoinId string `json:"user_subsidy_base_coin_id"` // 补贴计算基数 + UserLvUpSubsidyList []interface{} `json:"user_lv_up_subsidy_list"` //会员费分销补贴相应方式的列表 + PeerRateList []map[string]string `json:"peer_rate_list"` //同级比例 + BuyDeliverList map[string]string `json:"buy_deliver_list"` //酒庄制度 + ReturnType []string `json:"return_type"` //返利类型 + SelfRateList map[string]string `json:"self_rate_list"` // 自购比例 + TeamRateList map[string]string `json:"team_rate_list"` // 团队最高比例 + NewTeamList map[string]string `json:"new_team_list"` // 新团队比例 + NewExtendList map[string]string `json:"new_extend_list"` // 直推比例 + SecondExtendList map[string]string `json:"second_extend_list"` // 直推比例 + SameUserCount string `json:"same_user_count"` + SameExtend []map[string]string `json:"same_extend"` + TikTokTeamSubsidyOwnBiliType []string `json:"tik_tok_team_subsidy_own_bili_type"` //分销 返利类型 + TikTokTeamSubsidyList []map[string]string `json:"tik_tok_team_subsidy_list"` +} + type UserLvUpSubsidyList struct { Lv int `json:"lv"` // 等级 //Bili float64 `json:"bili"` // 比例 diff --git a/svc/get_plan_cfg.go b/svc/get_plan_cfg.go index 1c8e4c9..88150a2 100644 --- a/svc/get_plan_cfg.go +++ b/svc/get_plan_cfg.go @@ -10,6 +10,7 @@ import ( "encoding/json" "errors" "fmt" + "github.com/jinzhu/copier" "strings" "xorm.io/xorm" ) @@ -93,6 +94,7 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string, rewardOpts map[string]*mo } var subsidyTmp map[int]*comm_plan.LvGrade + var subsidyTmpDs map[int]*comm_plan.LvGradeDs commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"bili\":0", "\"bili\":\"0\"") commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"buy_deliver_list\":[]", "\"buy_deliver_list\":{}") commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"new_team_list\":[]", "\"new_team_list\":{}") @@ -125,6 +127,21 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string, rewardOpts map[string]*mo } } } + + if zhios_order_relate_utils.InArr(commissionOpt.Mode, []string{"lv_ds_check"}) { + if err := json.Unmarshal([]byte(commissionOpt.Data), &subsidyTmpDs); err != nil { + if masterId == "68823769" { + fmt.Println("===========================分佣方案数据设置错误", commissionOpt) + fmt.Println("===========================分佣方案数据设置错误", err) + } + return nil, zhios_order_relate_logx.Warn(fmt.Sprintf("%s:分佣方案数据设置错误", masterId)) + } + copier.Copy(subsidyTmp, &subsidyTmpDs) + opt.UserRate = subsidyTmp + + return opt, nil + } + if err := json.Unmarshal([]byte(commissionOpt.Data), &subsidyTmp); err != nil { if masterId == "68823769" { fmt.Println("===========================分佣方案数据设置错误", commissionOpt)