@@ -78,6 +78,36 @@ type LvGrade struct { | |||||
TikTokTeamSubsidyOwnBiliType []string `json:"tik_tok_team_subsidy_own_bili_type"` //分销 返利类型 | TikTokTeamSubsidyOwnBiliType []string `json:"tik_tok_team_subsidy_own_bili_type"` //分销 返利类型 | ||||
TikTokTeamSubsidyList []map[string]string `json:"tik_tok_team_subsidy_list"` | 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 { | type UserLvUpSubsidyList struct { | ||||
Lv int `json:"lv"` // 等级 | Lv int `json:"lv"` // 等级 | ||||
//Bili float64 `json:"bili"` // 比例 | //Bili float64 `json:"bili"` // 比例 | ||||
@@ -10,6 +10,7 @@ import ( | |||||
"encoding/json" | "encoding/json" | ||||
"errors" | "errors" | ||||
"fmt" | "fmt" | ||||
"github.com/jinzhu/copier" | |||||
"strings" | "strings" | ||||
"xorm.io/xorm" | "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 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, "\"bili\":0", "\"bili\":\"0\"") | ||||
commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"buy_deliver_list\":[]", "\"buy_deliver_list\":{}") | commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"buy_deliver_list\":[]", "\"buy_deliver_list\":{}") | ||||
commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"new_team_list\":[]", "\"new_team_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 err := json.Unmarshal([]byte(commissionOpt.Data), &subsidyTmp); err != nil { | ||||
if masterId == "68823769" { | if masterId == "68823769" { | ||||
fmt.Println("===========================分佣方案数据设置错误", commissionOpt) | fmt.Println("===========================分佣方案数据设置错误", commissionOpt) | ||||