From 3f46738f4e56ae5351c0d6ffe734fbdb1d22dae5 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 26 Sep 2023 19:13:11 +0800 Subject: [PATCH 01/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- svc/get_plan_cfg.go | 1 + 1 file changed, 1 insertion(+) diff --git a/svc/get_plan_cfg.go b/svc/get_plan_cfg.go index 232c84d..4786323 100644 --- a/svc/get_plan_cfg.go +++ b/svc/get_plan_cfg.go @@ -115,6 +115,7 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string, rewardOpts map[string]*mo commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"second_extend_list\":[]", "\"second_extend_list\":{}") commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"to_extend_list\":[]", "\"to_extend_list\":{}") commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"common_wealth_system\":[]", "\"common_wealth_system\":{}") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"common_wealth_system\":[\"0\"]", "\"common_wealth_system\":{}") commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"to_team_list\":[]", "\"to_team_list\":{}") commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"same_extend\":[[]]", "\"same_extend\":[]") if strings.Contains(commissionOpt.Data, "\"subsidy_mode_list\":[") { //兼容旧的方案 From 031640bc1846bcd8f455aa2e2e4dd1f2a7bd20a4 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Sat, 7 Oct 2023 14:35:44 +0800 Subject: [PATCH 02/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user_public_platoon_laxin_reward_setting.go | 1 + md/small_public_platoon_relate_commission.go | 4 ++++ rule/small_public_platoon_relate_commission.go | 4 ++-- svc/small_public_platoon_relate_commission.go | 13 +++++++++++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/db/model/user_public_platoon_laxin_reward_setting.go b/db/model/user_public_platoon_laxin_reward_setting.go index 35692b6..05ff79c 100644 --- a/db/model/user_public_platoon_laxin_reward_setting.go +++ b/db/model/user_public_platoon_laxin_reward_setting.go @@ -8,6 +8,7 @@ type UserPublicPlatoonLaxinRewardSetting struct { IsUseRewardLimit int `json:"is_use_reward_limit" xorm:"default 0 comment('是否开启奖励限制(奖励积分只能获取等级与自己一样或等级低的人的奖励积分) ') TINYINT(1)"` CoinId int `json:"coin_id" xorm:"INT(11)"` Detail string `json:"detail" xorm:"TEXT"` + LevelDetail string `json:"level_detail" xorm:"TEXT"` CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') TIMESTAMP"` UpdateAt time.Time `json:"update_at" xorm:"default 'CURRENT_TIMESTAMP' comment('更新时间') TIMESTAMP"` } diff --git a/md/small_public_platoon_relate_commission.go b/md/small_public_platoon_relate_commission.go index 3092a08..d6ba998 100644 --- a/md/small_public_platoon_relate_commission.go +++ b/md/small_public_platoon_relate_commission.go @@ -36,6 +36,10 @@ type CalcSmallPublicPlatoonRelateLaXinReward struct { CoinId int `json:"coin_id"` Value string `json:"value"` } +type CalcSmallPublicPlatoonRelateLaXinLevel struct { + Id string `json:"id"` + Detail []*CalcSmallPublicPlatoonRelateLaXinDetail `json:"detail"` +} type CalcSmallPublicPlatoonRelateLaXinDetail struct { Key int `json:"key"` diff --git a/rule/small_public_platoon_relate_commission.go b/rule/small_public_platoon_relate_commission.go index 53b11cd..39494c0 100644 --- a/rule/small_public_platoon_relate_commission.go +++ b/rule/small_public_platoon_relate_commission.go @@ -26,8 +26,8 @@ func BatchGetSmallPublicPlatoonRelateCommissionByOrder(engine *xorm.Engine, mast } // CalcSmallPublicPlatoonRelateLaXinReward 计算拉新奖励 -func CalcSmallPublicPlatoonRelateLaXinReward(engine *xorm.Engine, masterId string, rewardUid int) ([]*md.CalcSmallPublicPlatoonRelateLaXinReward, error) { - resp, err := svc.CalcSmallPublicPlatoonRelateLaXinReward(engine, masterId, rewardUid) +func CalcSmallPublicPlatoonRelateLaXinReward(engine *xorm.Engine, masterId string, rewardUid, level int) ([]*md.CalcSmallPublicPlatoonRelateLaXinReward, error) { + resp, err := svc.CalcSmallPublicPlatoonRelateLaXinReward(engine, masterId, rewardUid, level) if err != nil { return nil, err } diff --git a/svc/small_public_platoon_relate_commission.go b/svc/small_public_platoon_relate_commission.go index 900f18f..fcd8dfc 100644 --- a/svc/small_public_platoon_relate_commission.go +++ b/svc/small_public_platoon_relate_commission.go @@ -155,7 +155,7 @@ func benefitUid(engine *xorm.Engine, param *md.SmallPublicPlatoonRelateCommissio } -func CalcSmallPublicPlatoonRelateLaXinReward(engine *xorm.Engine, masterId string, rewardUid int) (resp []*md.CalcSmallPublicPlatoonRelateLaXinReward, err error) { +func CalcSmallPublicPlatoonRelateLaXinReward(engine *xorm.Engine, masterId string, rewardUid, level int) (resp []*md.CalcSmallPublicPlatoonRelateLaXinReward, err error) { userPublicPlatoonRelation, err := db.UserSmallPublicPlatoonRelationGetOneByParams(engine, map[string]interface{}{ "key": "uid", "value": rewardUid, @@ -185,10 +185,19 @@ func CalcSmallPublicPlatoonRelateLaXinReward(engine *xorm.Engine, masterId strin //2、解析 detail var detail []*md.CalcSmallPublicPlatoonRelateLaXinDetail - if err2 := json.Unmarshal([]byte(m.Detail), &detail); err != nil { + if err2 := json.Unmarshal([]byte(m.Detail), &detail); err2 != nil { return nil, err2 } + var levelDetail []md.CalcSmallPublicPlatoonRelateLaXinLevel + err2 := json.Unmarshal([]byte(m.LevelDetail), &levelDetail) + if err2 == nil { + for _, v := range levelDetail { + if zhios_order_relate_utils.StrToInt(v.Id) == level && len(v.Detail) > 0 { + detail = v.Detail + } + } + } fatherPositions := strings.Split(userPublicPlatoonRelation.FatherUid, "-") var rewardUserLevelWeight int if m.IsUseRewardLimit == 1 { From bf0036221e8092a3c92b19abbff3829746bae4ca Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 13 Oct 2023 16:55:26 +0800 Subject: [PATCH 03/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- svc/get_plan_cfg.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/svc/get_plan_cfg.go b/svc/get_plan_cfg.go index 4786323..42bdac0 100644 --- a/svc/get_plan_cfg.go +++ b/svc/get_plan_cfg.go @@ -50,6 +50,9 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string, rewardOpts map[string]*mo if pvd == "tikTok" && rmd.IsTikTokTeamOrder == "1" && rewardOpts["tikTokTeam"] != nil && rewardOpts["tikTokTeam"].PlanCommissionId > 0 { rewardOpt = rewardOpts["tikTokTeam"] } + if pvd == "kuaishou" && rmd.IsTikTokTeamOrder == "1" && rewardOpts["kuaishouTeam"] != nil && rewardOpts["kuaishouTeam"].PlanCommissionId > 0 { + rewardOpt = rewardOpts["kuaishouTeam"] + } if rewardOpt == nil { return nil, zhios_order_relate_logx.Warn("找不到方案记录") } From 3fb3fdfee816fbf8abb46764233ce3bbc2fe8aad Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 26 Oct 2023 09:58:06 +0800 Subject: [PATCH 04/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- md/commission_parameter.go | 1 + svc/reward_commission.go | 31 +++++++++++++++++-------------- svc/svc_integral_release.go | 8 ++++---- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/md/commission_parameter.go b/md/commission_parameter.go index 853dd66..0aea15c 100644 --- a/md/commission_parameter.go +++ b/md/commission_parameter.go @@ -21,6 +21,7 @@ type CommissionParam struct { TikTokTeamCommission string `json:"tik_tok_team_commission"` IsTikTokTeamOrder string `json:"is_tik_tok_team_order"` MinLevel int `json:"min_level"` + DouyinBili string `json:"douyin_bili"` } type CommissionFirstParam struct { CommissionParam CommissionParam `json:"commission_param"` diff --git a/svc/reward_commission.go b/svc/reward_commission.go index b49ee22..9671f34 100644 --- a/svc/reward_commission.go +++ b/svc/reward_commission.go @@ -90,9 +90,9 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b if cfg.Mode == "public_platoon" { //公排 //佣金扣除抽成后 - fee, _, pvdFee, sysFee := CommFee(comf, cfg, "commission", rmd.IsGoods) + fee, _, pvdFee, sysFee := CommFee(comf, cfg, "commission", rmd) ////积分扣除抽成后 - integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd.IsGoods) + integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd) //调用公排制度 userPublicPlatoonSetting, err := db.UserPublicPlatoonSettingGetOneByParams(engine, map[string]interface{}{ @@ -175,7 +175,7 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b } if cfg.Mode == "lv_integral_release" { // price = rmd.OldPrice - pvdFee, sysFee, _, ulink, err := IntegralRelease(engine, uid, newLevel, returnAllLevel, rmd.IsShowExtend, newProvider, user, comf, price, cfg, rmd.IsGoods, commArr, virtualCoinMoneyRate) + pvdFee, sysFee, _, ulink, err := IntegralRelease(engine, uid, newLevel, returnAllLevel, rmd.IsShowExtend, newProvider, user, comf, price, cfg, rmd, commArr, virtualCoinMoneyRate) if err != nil { return 0, 0, 0, 0, nil, nil } @@ -195,9 +195,9 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b userLevel = zhios_order_relate_utils.StrToInt(extraData["agent_lv"]) } //佣金扣除抽成后 - fee, _, pvdFee, sysFee := CommFee(comf, cfg, "commission", rmd.IsGoods) + fee, _, pvdFee, sysFee := CommFee(comf, cfg, "commission", rmd) ////积分扣除抽成后 - integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd.IsGoods) + integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd) var param = map[string]string{ "commission": zhios_order_relate_utils.Float64ToStr(fee), "integral": zhios_order_relate_utils.Float64ToStr(integralFee), @@ -270,9 +270,9 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b } func public(engine *xorm.Engine, ulinkParent *comm_plan.LvUser, cfg *comm_plan.PlanOpt, newProvider string, uid int, comf float64, price string, rmd *md.CommissionParam) *comm_plan.LvUser { //佣金扣除抽成后 - fee, _, _, _ := CommFee(comf, cfg, "commission", rmd.IsGoods) + fee, _, _, _ := CommFee(comf, cfg, "commission", rmd) ////积分扣除抽成后 - integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd.IsGoods) + integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd) //调用公排制度 userPublicPlatoonSetting, err := db.UserPublicPlatoonSettingGetOneByParams(engine, map[string]interface{}{ @@ -576,12 +576,12 @@ func currentPrice(m *md.CommissionParam, pvd string) string { return "" } } -func CommFee(fee float64, opt *comm_plan.PlanOpt, types, isGoods string) (float64, float64, float64, float64) { +func CommFee(fee float64, opt *comm_plan.PlanOpt, types string, rmd *md.CommissionParam) (float64, float64, float64, float64) { var feeFirst float64 = 1 if types == "integral" && opt.IntegralOpen == 0 || opt.Mode == "lv_winery" { //积分抽成后台没开启不用扣 return fee, feeFirst, 0, 0 } - + isGoods := rmd.IsGoods if isGoods == "1" { orderBeforeRate := fee * opt.OrderBeforeRate orderBeforeRateFirst := feeFirst * opt.OrderBeforeRate @@ -610,6 +610,9 @@ func CommFee(fee float64, opt *comm_plan.PlanOpt, types, isGoods string) (float6 for _, v := range opt.RateList { total -= int64(fee * (v / 100) * 1e4) } + if zhios_order_relate_utils.StrToFloat64(rmd.DouyinBili) > 0 { + total -= int64(zhios_order_relate_utils.StrToFloat64(rmd.DouyinBili) * 1e4) + } fee = float64(total) / 1e4 if fee < 0 { fee = 0 @@ -645,10 +648,10 @@ func CalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee //佣金扣除抽成后 var feeFirst float64 = 1 var integralFeeFirst float64 = 1 - fee, feeFirst, pvdFee, sysFee = CommFee(fee, opt, "commission", isGoods) + fee, feeFirst, pvdFee, sysFee = CommFee(fee, opt, "commission", rmd) //积分扣除抽成后 var integralSysFee float64 = 0 - integralFee, integralFeeFirst, _, integralSysFee = CommFee(integralFee, opt, "integral", isGoods) + integralFee, integralFeeFirst, _, integralSysFee = CommFee(integralFee, opt, "integral", rmd) // 计算自购补贴比例 subsidyFee = 0 //如果没登录,要找出权重最低的那个 @@ -764,11 +767,11 @@ func CalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee //pvd 只是为了判断是会员升级的订单 可不传 func NiuBeiCalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee float64, isShare bool, opt *comm_plan.PlanOpt, userRelationShip *[]md.UserRelation, pvd string, newLevel int, eg *xorm.Engine, isGoods string, rmd *md.CommissionParam) (pvdFee, sysFee, subsidyFee float64, lvUser *comm_plan.LvUser, err error) { //佣金扣除抽成后 - fee, _, pvdFee, sysFee = CommFee(fee, opt, "commission", isGoods) + fee, _, pvdFee, sysFee = CommFee(fee, opt, "commission", rmd) //积分扣除抽成后 var integralSysFee float64 = 0 - integralFee, _, _, integralSysFee = CommFee(integralFee, opt, "integral", isGoods) - integralFeeForPrice, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(rmd.OldPrice), opt, "integral", isGoods) + integralFee, _, _, integralSysFee = CommFee(integralFee, opt, "integral", rmd) + integralFeeForPrice, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(rmd.OldPrice), opt, "integral", rmd) // 计算自购补贴比例 subsidyFee = 0 //如果没登录,要找出权重最低的那个 diff --git a/svc/svc_integral_release.go b/svc/svc_integral_release.go index 403e059..a8a9908 100644 --- a/svc/svc_integral_release.go +++ b/svc/svc_integral_release.go @@ -12,12 +12,12 @@ import ( "xorm.io/xorm" ) -func IntegralRelease(engine *xorm.Engine, uid, level int, returnAllLevel bool, IsShowExtend, pvd string, user *model.User, comf float64, price string, cfg *comm_plan.PlanOpt, isGoods string, commArr map[string]string, virtualCoinMoneyRate map[int]string) (pvdFee, sysFee, subsidyFee float64, lvUser *comm_plan.LvUser, err error) { +func IntegralRelease(engine *xorm.Engine, uid, level int, returnAllLevel bool, IsShowExtend, pvd string, user *model.User, comf float64, price string, cfg *comm_plan.PlanOpt, rmd *md.CommissionParam, commArr map[string]string, virtualCoinMoneyRate map[int]string) (pvdFee, sysFee, subsidyFee float64, lvUser *comm_plan.LvUser, err error) { //佣金扣除抽成后 - fee, _, pvdFee, sysFee := CommFee(comf, cfg, "commission", isGoods) + fee, _, pvdFee, sysFee := CommFee(comf, cfg, "commission", rmd) ////积分扣除抽成后 - integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", isGoods) - integralFeeCom, _, _, _ := CommFee(comf, cfg, "integral", isGoods) + integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd) + integralFeeCom, _, _, _ := CommFee(comf, cfg, "integral", rmd) //常规级差 var userRelationship *[]md.UserRelation if returnAllLevel { From cb5f61f0be98c11f5bced4a99b1590af3af92399 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 27 Oct 2023 11:27:29 +0800 Subject: [PATCH 05/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/comm_plan/all.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/comm_plan/all.go b/lib/comm_plan/all.go index 3121bdf..fa21ed0 100644 --- a/lib/comm_plan/all.go +++ b/lib/comm_plan/all.go @@ -725,7 +725,7 @@ func getCommissionRatio(typ string, level, peerNum int, grade map[int]*LvGrade) case "team": ratio = grade[level].TeamRate case "same_lv": - if len(grade[level].PeerRate) == 0 { + if len(grade[level].PeerRate) == 0 || len(grade[level].PeerRate) >= peerNum+1 { ratio = 0 } else { ratio = grade[level].PeerRate[peerNum] From c2781194b378f021d9a842a3d01ffeb47141581a Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 27 Oct 2023 11:33:58 +0800 Subject: [PATCH 06/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/comm_plan/all.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/comm_plan/all.go b/lib/comm_plan/all.go index fa21ed0..eb338f5 100644 --- a/lib/comm_plan/all.go +++ b/lib/comm_plan/all.go @@ -725,7 +725,7 @@ func getCommissionRatio(typ string, level, peerNum int, grade map[int]*LvGrade) case "team": ratio = grade[level].TeamRate case "same_lv": - if len(grade[level].PeerRate) == 0 || len(grade[level].PeerRate) >= peerNum+1 { + if len(grade[level].PeerRate) == 0 || len(grade[level].PeerRate) < peerNum+1 { ratio = 0 } else { ratio = grade[level].PeerRate[peerNum] From 66646bdea78f5fb9aac3b78aeb6e1a3e3e7036b2 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 3 Nov 2023 18:08:43 +0800 Subject: [PATCH 07/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- svc/reward_commission.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svc/reward_commission.go b/svc/reward_commission.go index 9671f34..2bb1775 100644 --- a/svc/reward_commission.go +++ b/svc/reward_commission.go @@ -84,7 +84,7 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b fmt.Println(com) fmt.Println(price) comf := zhios_order_relate_utils.StrToFloat64(com) - if zhios_order_relate_utils.InArr(cfg.Mode, []string{"lv_price_public_platoon", "lv_price", "lv_winery", "extend_price", "niubei_amount"}) && zhios_order_relate_utils.StrToFloat64(rmd.OldPrice) > 0 { //价格为基数 + if zhios_order_relate_utils.InArr(cfg.Mode, []string{"lv_price_public_platoon", "lv_price", "lv_price_other", "lv_winery", "extend_price", "niubei_amount"}) && zhios_order_relate_utils.StrToFloat64(rmd.OldPrice) > 0 { //价格为基数 comf = zhios_order_relate_utils.StrToFloat64(rmd.OldPrice) } if cfg.Mode == "public_platoon" { From 4f6299708c6113c3c7e5191d33398de06e9b7de6 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 7 Nov 2023 17:33:12 +0800 Subject: [PATCH 08/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/comm_plan/init.go | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/comm_plan/init.go b/lib/comm_plan/init.go index e7bf99e..56ecbcc 100644 --- a/lib/comm_plan/init.go +++ b/lib/comm_plan/init.go @@ -226,6 +226,7 @@ type LvUser struct { LevelWeight int // 权重 Profit float64 // 利润(金额) SubsidyFee float64 // 补贴(金额) + AdditionalSubsidy float64 MinLevel int IsFreeze int MinProfit float64 // 利润(金额) From f3747b8bf5e754b83879e71bf0992da369038a17 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Wed, 8 Nov 2023 14:44:03 +0800 Subject: [PATCH 09/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- svc/small_public_platoon_relate_commission.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/svc/small_public_platoon_relate_commission.go b/svc/small_public_platoon_relate_commission.go index fcd8dfc..95a3dfa 100644 --- a/svc/small_public_platoon_relate_commission.go +++ b/svc/small_public_platoon_relate_commission.go @@ -332,9 +332,13 @@ func BatchSmallGetPublicPlatoonRelateByGoods(engine *xorm.Engine, masterId strin var commonWealthSystem = make(map[string]string) if lvGrade != nil { 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) + var pendingAmount = param.PendingAmount + 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.SmallPublicPlatoonRelateCommissionResp{ From 33e8c6cda90915a61b5e78aa8088cf64813fad88 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 9 Nov 2023 13:36:09 +0800 Subject: [PATCH 10/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/db_second_newcomers_free.go | 14 +++++++++++ db/model/second_newcomers_free_price_type.go | 19 ++++++++++++++ svc/get_plan_cfg.go | 26 ++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 db/db_second_newcomers_free.go create mode 100644 db/model/second_newcomers_free_price_type.go diff --git a/db/db_second_newcomers_free.go b/db/db_second_newcomers_free.go new file mode 100644 index 0000000..91ef1ba --- /dev/null +++ b/db/db_second_newcomers_free.go @@ -0,0 +1,14 @@ +package db + +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db/model" + "xorm.io/xorm" +) + +func SecondGetAllPriceTypeList(Db *xorm.Engine) ([]model.SecondNewcomersFreePriceType, error) { + var priceType []model.SecondNewcomersFreePriceType + if err := Db.Find(&priceType); err != nil { + return nil, err + } + return priceType, nil +} diff --git a/db/model/second_newcomers_free_price_type.go b/db/model/second_newcomers_free_price_type.go new file mode 100644 index 0000000..db06178 --- /dev/null +++ b/db/model/second_newcomers_free_price_type.go @@ -0,0 +1,19 @@ +package model + +type SecondNewcomersFreePriceType struct { + Id int `json:"id" xorm:"not null pk autoincr INT(10)"` + PriceName string `json:"price_name" xorm:"not null comment('价格类型') VARCHAR(255)"` + NeedQuan int `json:"need_quan" xorm:"not null default 0 comment('需要的福利券') INT(11)"` + CreatedAt int `json:"created_at" xorm:"not null default 0 INT(11)"` + UpdatedAt int `json:"updated_at" xorm:"not null default 0 INT(11)"` + IsShow int `json:"is_show" xorm:"not null default 1 comment('是否开启') TINYINT(1)"` + IsDel int `json:"is_del" xorm:"not null default 0 INT(11)"` + Auth string `json:"auth" xorm:"not null comment('权限') TEXT"` + NeedUseQuan int `json:"need_use_quan" xorm:"default 1 comment('是否需要使用免单券 0否 1是') INT(1)"` + NeedLimitBuy int `json:"need_limit_buy" xorm:"default 0 comment('是否限购') INT(1)"` + LimitBuyCondition string `json:"limit_buy_condition" xorm:"default '' comment('限购条件') VARCHAR(255)"` + CommissionId string `json:"commission_id" xorm:"default '' VARCHAR(255)"` + LimitStr string `json:"limit_str" xorm:"default '' VARCHAR(255)"` + BuyStr string `json:"buy_str" xorm:"default '' VARCHAR(255)"` + CommissionData string `json:"commission_data" xorm:"default '' VARCHAR(500)"` +} diff --git a/svc/get_plan_cfg.go b/svc/get_plan_cfg.go index 42bdac0..2ba9ad5 100644 --- a/svc/get_plan_cfg.go +++ b/svc/get_plan_cfg.go @@ -34,6 +34,32 @@ func GetAllPlan(eg *xorm.Engine, dbName string) (map[string]*model.PlanReward, m for _, v := range pvds { plan[v.Pvd] = v } + list, _ := db.SecondGetAllPriceTypeList(eg) + for _, v := range list { + var oneRewardPlan map[string]string + err := json.Unmarshal([]byte(v.CommissionData), &oneRewardPlan) + if err == nil { + var tmp = &model.PlanReward{ + Id: 0, + Pvd: "seFree_" + zhios_order_relate_utils.IntToStr(v.Id), + PvdRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["pvd_rate"]) / 100, + SysRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["sys_rate"]) / 100, + RegionRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["region_rate"]) / 100, + GlobalRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["global_rate"]) / 100, + SettleMode: zhios_order_relate_utils.StrToInt(oneRewardPlan["settle_mode"]), + PlanCommissionId: zhios_order_relate_utils.StrToInt(oneRewardPlan["plan_commission_id"]), + PlanSettleId: zhios_order_relate_utils.StrToInt(oneRewardPlan["plan_settle_id"]), + State: 1, + Source: 1, + IntegralOpen: zhios_order_relate_utils.StrToInt(oneRewardPlan["integral_open"]), + MerchantRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["merchant_rate"]) / 100, + PushHandRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["push_hand_rate"]) / 100, + OrderBeforeRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["order_before_rate"]) / 100, + } + plan[tmp.Pvd] = tmp + } + } + commission := make(map[int]*model.PlanCommission, 0) commissions := db.DbsPlanCommissionByIds(eg) for _, v := range commissions { From 53b4c5a65d38c1dc86807c8005356dbff06fdcf5 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 10 Nov 2023 09:23:46 +0800 Subject: [PATCH 11/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- svc/get_plan_cfg.go | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/svc/get_plan_cfg.go b/svc/get_plan_cfg.go index 2ba9ad5..e86df00 100644 --- a/svc/get_plan_cfg.go +++ b/svc/get_plan_cfg.go @@ -240,7 +240,31 @@ func PlanOpts(eg *xorm.Engine) map[string]*comm_plan.PlanOpt { if err != nil || allRewardPlan == nil { return nil } - + list, _ := db.SecondGetAllPriceTypeList(eg) + for _, v := range list { + var oneRewardPlan map[string]string + err := json.Unmarshal([]byte(v.CommissionData), &oneRewardPlan) + if err == nil { + var tmp = &model.PlanReward{ + Id: 0, + Pvd: "seFree_" + zhios_order_relate_utils.IntToStr(v.Id), + PvdRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["pvd_rate"]) / 100, + SysRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["sys_rate"]) / 100, + RegionRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["region_rate"]) / 100, + GlobalRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["global_rate"]) / 100, + SettleMode: zhios_order_relate_utils.StrToInt(oneRewardPlan["settle_mode"]), + PlanCommissionId: zhios_order_relate_utils.StrToInt(oneRewardPlan["plan_commission_id"]), + PlanSettleId: zhios_order_relate_utils.StrToInt(oneRewardPlan["plan_settle_id"]), + State: 1, + Source: 1, + IntegralOpen: zhios_order_relate_utils.StrToInt(oneRewardPlan["integral_open"]), + MerchantRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["merchant_rate"]) / 100, + PushHandRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["push_hand_rate"]) / 100, + OrderBeforeRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["order_before_rate"]) / 100, + } + allRewardPlan = append(allRewardPlan, tmp) + } + } opts := map[string]*comm_plan.PlanOpt{} for _, v := range allRewardPlan { if _, ok := commissionPlans[v.PlanCommissionId]; ok && v.State == 1 && v.PlanCommissionId > 0 { @@ -265,6 +289,7 @@ func PlanOpts(eg *xorm.Engine) map[string]*comm_plan.PlanOpt { } } fmt.Println(opts) + if len(opts) == 0 { return nil } From 47c05207f039bbfdd6d3e1e9dfe2516f96b2f1a5 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Sat, 11 Nov 2023 19:21:00 +0800 Subject: [PATCH 12/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- svc/get_plan_cfg.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/svc/get_plan_cfg.go b/svc/get_plan_cfg.go index e86df00..7ff4946 100644 --- a/svc/get_plan_cfg.go +++ b/svc/get_plan_cfg.go @@ -73,11 +73,14 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string, rewardOpts map[string]*mo opt := &comm_plan.PlanOpt{} // 根据供应商 rewardOpt := rewardOpts[pvd] - if pvd == "tikTok" && rmd.IsTikTokTeamOrder == "1" && rewardOpts["tikTokTeam"] != nil && rewardOpts["tikTokTeam"].PlanCommissionId > 0 { - rewardOpt = rewardOpts["tikTokTeam"] - } - if pvd == "kuaishou" && rmd.IsTikTokTeamOrder == "1" && rewardOpts["kuaishouTeam"] != nil && rewardOpts["kuaishouTeam"].PlanCommissionId > 0 { - rewardOpt = rewardOpts["kuaishouTeam"] + if strings.Contains(pvd, "seFree") == false { + if pvd == "tikTok" && rmd.IsTikTokTeamOrder == "1" && rewardOpts["tikTokTeam"] != nil && rewardOpts["tikTokTeam"].PlanCommissionId > 0 { + rewardOpt = rewardOpts["tikTokTeam"] + } + + if pvd == "kuaishou" && rmd.IsTikTokTeamOrder == "1" && rewardOpts["kuaishouTeam"] != nil && rewardOpts["kuaishouTeam"].PlanCommissionId > 0 { + rewardOpt = rewardOpts["kuaishouTeam"] + } } if rewardOpt == nil { return nil, zhios_order_relate_logx.Warn("找不到方案记录") From c1ac2b5b300d8498cd788dbe2182a9208340a3a2 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 17 Nov 2023 18:25:16 +0800 Subject: [PATCH 13/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- svc/get_plan_cfg.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/svc/get_plan_cfg.go b/svc/get_plan_cfg.go index 7ff4946..1301bbf 100644 --- a/svc/get_plan_cfg.go +++ b/svc/get_plan_cfg.go @@ -214,10 +214,8 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string, rewardOpts map[string]*mo } if err := json.Unmarshal([]byte(commissionOpt.Data), &subsidyTmp); err != nil { - if masterId == "68823769" { - fmt.Println("===========================分佣方案数据设置错误", commissionOpt) - fmt.Println("===========================分佣方案数据设置错误", err) - } + fmt.Println("===========================分佣方案数据设置错误", commissionOpt) + fmt.Println("===========================分佣方案数据设置错误", err) return nil, zhios_order_relate_logx.Warn(fmt.Sprintf("%s:分佣方案数据设置错误", masterId)) } opt.UserRate = subsidyTmp From d04a940731d57283c01a94002290b031c38c8b27 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 17 Nov 2023 18:38:51 +0800 Subject: [PATCH 14/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- svc/get_plan_cfg.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/svc/get_plan_cfg.go b/svc/get_plan_cfg.go index 1301bbf..fc52d36 100644 --- a/svc/get_plan_cfg.go +++ b/svc/get_plan_cfg.go @@ -141,14 +141,14 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string, rewardOpts map[string]*mo var subsidyTmpPricePublic map[int]*comm_plan.LvGradePricePublic var subsidyTmpWineryAdv map[int]*comm_plan.LvGradeWineryAdv 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\":{}") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"new_extend_list\":[]", "\"new_extend_list\":{}") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"second_extend_list\":[]", "\"second_extend_list\":{}") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"to_extend_list\":[]", "\"to_extend_list\":{}") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"common_wealth_system\":[]", "\"common_wealth_system\":{}") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"common_wealth_system\":[\"0\"]", "\"common_wealth_system\":{}") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"to_team_list\":[]", "\"to_team_list\":{}") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"buy_deliver_list\":[]", "") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"new_team_list\":[]", "") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"new_extend_list\":[]", "") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"second_extend_list\":[]", "") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"to_extend_list\":[]", "") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"common_wealth_system\":[]", "") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"common_wealth_system\":[\"0\"]", "") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"to_team_list\":[]", "") commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"same_extend\":[[]]", "\"same_extend\":[]") if strings.Contains(commissionOpt.Data, "\"subsidy_mode_list\":[") { //兼容旧的方案 tmp := strings.Split(commissionOpt.Data, "\"subsidy_mode_list\":[") From 32cd93eb859f2b726391ac2e281cecc7895586c8 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 17 Nov 2023 18:41:43 +0800 Subject: [PATCH 15/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- svc/get_plan_cfg.go | 1 + 1 file changed, 1 insertion(+) diff --git a/svc/get_plan_cfg.go b/svc/get_plan_cfg.go index fc52d36..19b006b 100644 --- a/svc/get_plan_cfg.go +++ b/svc/get_plan_cfg.go @@ -150,6 +150,7 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string, rewardOpts map[string]*mo commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"common_wealth_system\":[\"0\"]", "") commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"to_team_list\":[]", "") commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"same_extend\":[[]]", "\"same_extend\":[]") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",,", ",") if strings.Contains(commissionOpt.Data, "\"subsidy_mode_list\":[") { //兼容旧的方案 tmp := strings.Split(commissionOpt.Data, "\"subsidy_mode_list\":[") if len(tmp) > 0 { From d214151acc9b873347ff683aadef4362a01c7b4e Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 17 Nov 2023 18:50:07 +0800 Subject: [PATCH 16/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- svc/get_plan_cfg.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/svc/get_plan_cfg.go b/svc/get_plan_cfg.go index 19b006b..fcd4737 100644 --- a/svc/get_plan_cfg.go +++ b/svc/get_plan_cfg.go @@ -141,16 +141,15 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string, rewardOpts map[string]*mo var subsidyTmpPricePublic map[int]*comm_plan.LvGradePricePublic var subsidyTmpWineryAdv map[int]*comm_plan.LvGradeWineryAdv commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"bili\":0", "\"bili\":\"0\"") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"buy_deliver_list\":[]", "") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"new_team_list\":[]", "") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"new_extend_list\":[]", "") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"second_extend_list\":[]", "") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"to_extend_list\":[]", "") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"common_wealth_system\":[]", "") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"common_wealth_system\":[\"0\"]", "") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"to_team_list\":[]", "") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"buy_deliver_list\":[]", "") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"new_team_list\":[]", "") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"new_extend_list\":[]", "") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"second_extend_list\":[]", "") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"to_extend_list\":[]", "") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"common_wealth_system\":[]", "") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"common_wealth_system\":[\"0\"]", "") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"to_team_list\":[]", "") commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"same_extend\":[[]]", "\"same_extend\":[]") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",,", ",") if strings.Contains(commissionOpt.Data, "\"subsidy_mode_list\":[") { //兼容旧的方案 tmp := strings.Split(commissionOpt.Data, "\"subsidy_mode_list\":[") if len(tmp) > 0 { From 4fd7bcf9f4bdca8e93dbb26764a16b370451d48b Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 17 Nov 2023 19:14:38 +0800 Subject: [PATCH 17/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/comm_plan/all.go | 8 ++++++-- lib/comm_plan/ds_check.go | 5 ++++- lib/comm_plan/init.go | 4 ++-- svc/get_plan_cfg.go | 14 +++++++------- svc/reward_commission.go | 6 +++++- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/lib/comm_plan/all.go b/lib/comm_plan/all.go index eb338f5..6282845 100644 --- a/lib/comm_plan/all.go +++ b/lib/comm_plan/all.go @@ -748,8 +748,12 @@ func getVirtualCoinRatio(typ string, level, peerNum int, grade map[int]*LvGrade, switch typ { case "extend_lv": if isPostion == 1 { - ratio, ok = grade[level].SecondExtendList[coinId] - ratio = zhios_order_relate_utils.Float64ToStrByPrec(zhios_order_relate_utils.StrToFloat64(ratio)/100, 4) + SecondExtendList, ok1 := grade[level].SecondExtendList.(map[string]string) + if ok1 { + ratio, ok = SecondExtendList[coinId] + ratio = zhios_order_relate_utils.Float64ToStrByPrec(zhios_order_relate_utils.StrToFloat64(ratio)/100, 4) + + } } else { ratio, ok = grade[level].NewExtendList[coinId] ratio = zhios_order_relate_utils.Float64ToStrByPrec(zhios_order_relate_utils.StrToFloat64(ratio)/100, 4) diff --git a/lib/comm_plan/ds_check.go b/lib/comm_plan/ds_check.go index f4829bb..3522e4a 100644 --- a/lib/comm_plan/ds_check.go +++ b/lib/comm_plan/ds_check.go @@ -70,7 +70,10 @@ func getVirtualCoinRatioDsOwn(typ string, level, peerNum int, grade map[int]*LvG switch typ { case "extend_lv": if isPostion == 1 { - ratio, ok = grade[level].SecondExtendList[coinId] + SecondExtendList, ok1 := grade[level].SecondExtendList.(map[string]string) + if ok1 { + ratio, ok = SecondExtendList[coinId] + } } else { ratio, ok = grade[level].NewExtendList[coinId] } diff --git a/lib/comm_plan/init.go b/lib/comm_plan/init.go index 56ecbcc..ac61a7d 100644 --- a/lib/comm_plan/init.go +++ b/lib/comm_plan/init.go @@ -72,7 +72,7 @@ type LvGrade struct { 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"` // 直推比例 + SecondExtendList interface{} `json:"second_extend_list"` // 直推比例 ToTeamList map[string]string `json:"to_team_list"` // 直推比例 SameUserCount string `json:"same_user_count"` SameExtend []map[string]string `json:"same_extend"` @@ -85,7 +85,7 @@ type LvGrade struct { TikTokTeamSubsidyOwnBiliType []string `json:"tik_tok_team_subsidy_own_bili_type"` //分销 返利类型 TikTokTeamSubsidyList []map[string]string `json:"tik_tok_team_subsidy_list"` ToExtendList map[string]string `json:"to_extend_list"` // - CommonWealthSystem map[string]string `json:"common_wealth_system"` //共富制度比例 + CommonWealthSystem interface{} `json:"common_wealth_system"` //共富制度比例 } type LvGradePricePublic struct { diff --git a/svc/get_plan_cfg.go b/svc/get_plan_cfg.go index fcd4737..0041b3f 100644 --- a/svc/get_plan_cfg.go +++ b/svc/get_plan_cfg.go @@ -141,13 +141,13 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string, rewardOpts map[string]*mo var subsidyTmpPricePublic map[int]*comm_plan.LvGradePricePublic var subsidyTmpWineryAdv map[int]*comm_plan.LvGradeWineryAdv commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"bili\":0", "\"bili\":\"0\"") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"buy_deliver_list\":[]", "") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"new_team_list\":[]", "") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"new_extend_list\":[]", "") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"second_extend_list\":[]", "") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"to_extend_list\":[]", "") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"common_wealth_system\":[]", "") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"common_wealth_system\":[\"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\":{}") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"new_extend_list\":[]", "\"new_extend_list\":{}") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"second_extend_list\":[]", "\"second_extend_list\":{}") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"to_extend_list\":[]", "\"to_extend_list\":{}") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"common_wealth_system\":[]", "\"common_wealth_system\":{}") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"common_wealth_system\":[\"0\"]", "\"common_wealth_system\":{}") commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"to_team_list\":[]", "") commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"same_extend\":[[]]", "\"same_extend\":[]") if strings.Contains(commissionOpt.Data, "\"subsidy_mode_list\":[") { //兼容旧的方案 diff --git a/svc/reward_commission.go b/svc/reward_commission.go index 2bb1775..2262f7a 100644 --- a/svc/reward_commission.go +++ b/svc/reward_commission.go @@ -320,7 +320,11 @@ func public(engine *xorm.Engine, ulinkParent *comm_plan.LvUser, cfg *comm_plan.P if zhios_order_relate_utils.StrToInt(coinId) > 0 { //积分更换基数 pendingAmount = zhios_order_relate_utils.Float64ToStr(integralFee) } - commonWealthSystem[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(grade.CommonWealthSystem[coinId]) * zhios_order_relate_utils.StrToFloat64(pendingAmount) / 100) + CommonWealthSystems, ok := grade.CommonWealthSystem.(map[string]string) + if ok { + commonWealthSystem[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(CommonWealthSystems[coinId]) * zhios_order_relate_utils.StrToFloat64(pendingAmount) / 100) + + } } } //共富收益处理 From d0d3a66776c6f95372e2d6fcaeb32cc09dec695c Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 17 Nov 2023 19:17:23 +0800 Subject: [PATCH 18/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- svc/get_plan_cfg.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/svc/get_plan_cfg.go b/svc/get_plan_cfg.go index 0041b3f..1301bbf 100644 --- a/svc/get_plan_cfg.go +++ b/svc/get_plan_cfg.go @@ -141,14 +141,14 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string, rewardOpts map[string]*mo var subsidyTmpPricePublic map[int]*comm_plan.LvGradePricePublic var subsidyTmpWineryAdv map[int]*comm_plan.LvGradeWineryAdv 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\":{}") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"new_extend_list\":[]", "\"new_extend_list\":{}") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"second_extend_list\":[]", "\"second_extend_list\":{}") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"to_extend_list\":[]", "\"to_extend_list\":{}") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"common_wealth_system\":[]", "\"common_wealth_system\":{}") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"common_wealth_system\":[\"0\"]", "\"common_wealth_system\":{}") - commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, ",\"to_team_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_extend_list\":[]", "\"new_extend_list\":{}") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"second_extend_list\":[]", "\"second_extend_list\":{}") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"to_extend_list\":[]", "\"to_extend_list\":{}") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"common_wealth_system\":[]", "\"common_wealth_system\":{}") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"common_wealth_system\":[\"0\"]", "\"common_wealth_system\":{}") + commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"to_team_list\":[]", "\"to_team_list\":{}") commissionOpt.Data = strings.ReplaceAll(commissionOpt.Data, "\"same_extend\":[[]]", "\"same_extend\":[]") if strings.Contains(commissionOpt.Data, "\"subsidy_mode_list\":[") { //兼容旧的方案 tmp := strings.Split(commissionOpt.Data, "\"subsidy_mode_list\":[") From 61e5516cbe7a22b1c8c2505ccacef5858bc71862 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 20 Nov 2023 14:48:38 +0800 Subject: [PATCH 19/19] update --- rule/public_platoon_relate_commission.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rule/public_platoon_relate_commission.go b/rule/public_platoon_relate_commission.go index d6cf847..8fa0ca1 100644 --- a/rule/public_platoon_relate_commission.go +++ b/rule/public_platoon_relate_commission.go @@ -533,7 +533,7 @@ func FindRandUser(engine *xorm.Engine, nums int) (resp []int64, err error) { var uniqueMap = map[int64]bool{} var j = 0 for { - ids := randSeedInt(int64(minM.Id), int64(maxM.Id), nums-len(resp), uniqueMap) + ids := randSeedInt(int64(minM.Id), int64(maxM.Id), nums-len(resp), uniqueMap, &[]int64{}) var list []model.UserPublicPlatoonRelation if err1 := engine.In("id", ids). Find(&list); err1 != nil { @@ -559,19 +559,20 @@ func FindRandUser(engine *xorm.Engine, nums int) (resp []int64, err error) { return } -func randSeedInt(start, end int64, nums int, uniqueMap map[int64]bool) (resp []int64) { +func randSeedInt(start, end int64, nums int, uniqueMap map[int64]bool, resp *[]int64) (res []int64) { rand.Seed(time.Now().UnixNano()) for { result := rand.Int63n(end) + start if !uniqueMap[result] { - resp = append(resp, result) + *resp = append(*resp, result) uniqueMap[result] = true break } } - if len(resp) < nums { - randSeedInt(start, end, nums, uniqueMap) + if len(*resp) < nums { + randSeedInt(start, end, nums, uniqueMap, resp) } - return + res = *resp + return res }