From 81f129dd77390ed45dba5cefd001f4e8dd96d4dc Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 1 Mar 2024 18:38:00 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rule/green_coin_double_chain_settlement.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rule/green_coin_double_chain_settlement.go b/rule/green_coin_double_chain_settlement.go index afd4a7c..aed8569 100644 --- a/rule/green_coin_double_chain_settlement.go +++ b/rule/green_coin_double_chain_settlement.go @@ -88,7 +88,7 @@ func DealUserGreenCoinDoubleChainIntegral(Db *xorm.Engine, uid int, amount, ordI //5、查询上级直推的所有下级用户的虚拟币金额是否有大于当前用户的 var sonUserVirtualWallet model.UserVirtualAmount - isHas, err := session.Where(" coin_id = ? and amount >=", greenCoinDoubleChain.Coin2, amount).In("uid", sonUserIds).Get(&sonUserVirtualWallet) + isHas, err := session.Where(" coin_id = ? and amount >=?", greenCoinDoubleChain.Coin2, amount).In("uid", sonUserIds).Get(&sonUserVirtualWallet) if err != nil { return } From 634f5e4bf12ec2f6333fb762c0a1e410361e14f4 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Sat, 2 Mar 2024 16:02:08 +0800 Subject: [PATCH 2/4] =?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 | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/svc/small_public_platoon_relate_commission.go b/svc/small_public_platoon_relate_commission.go index 027368e..137f189 100644 --- a/svc/small_public_platoon_relate_commission.go +++ b/svc/small_public_platoon_relate_commission.go @@ -429,16 +429,19 @@ func BatchSmallGetPublicPlatoonRelateCommissionLevel(engine *xorm.Engine, master //共富简历 if zhios_order_relate_utils.StrToInt(nowBenefitUid) > 0 { parentUid, _ := db.UserFindByID(engine, nowBenefitUid) - lvGrade := subsidyTmp[zhios_order_relate_utils.IntToStr(parentUid.Level)] - if lvGrade != nil { - for _, coinId := range lvGrade.ReturnType { - var pendingAmount = param.PendingAmount - if zhios_order_relate_utils.StrToInt(coinId) > 0 { //积分更换基数 - pendingAmount = param.PendingIntegral + if parentUid != nil { + lvGrade := subsidyTmp[zhios_order_relate_utils.IntToStr(parentUid.Level)] + if lvGrade != nil { + for _, coinId := range lvGrade.ReturnType { + var pendingAmount = param.PendingAmount + if zhios_order_relate_utils.StrToInt(coinId) > 0 { //积分更换基数 + pendingAmount = param.PendingIntegral + } + commonWealthSystem[coinId] = zhios_order_relate_utils.Float64ToStrByPrec(zhios_order_relate_utils.StrToFloat64(lvGrade.CommonWealthSystem[coinId])*zhios_order_relate_utils.StrToFloat64(pendingAmount)/100, 9) } - commonWealthSystem[coinId] = zhios_order_relate_utils.Float64ToStrByPrec(zhios_order_relate_utils.StrToFloat64(lvGrade.CommonWealthSystem[coinId])*zhios_order_relate_utils.StrToFloat64(pendingAmount)/100, 9) } } + } resp[param.Oid] = &md.SmallPublicPlatoonRelateCommissionResp{ From cb613142b9fb8019ca4b1aa7236ee0f2bfc40284 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Mon, 4 Mar 2024 16:58:05 +0800 Subject: [PATCH 3/4] =?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/public_platoon_relate_commission.go | 13 ++++++----- svc/public_platoon_relate_commission.go | 23 ++++++++++++++++++- svc/small_public_platoon_relate_commission.go | 23 ++++++++++++++++++- 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/md/public_platoon_relate_commission.go b/md/public_platoon_relate_commission.go index 13761d9..47db1bb 100644 --- a/md/public_platoon_relate_commission.go +++ b/md/public_platoon_relate_commission.go @@ -2,12 +2,13 @@ package md // 公排结构 type LvGrade struct { - Lv int `json:"lv"` // 会员级别 - LvName string `json:"lv_name"` // 会员名称 - ReturnType []string `json:"return_type"` //返利类型 - CommonWealthSystem map[string]string `json:"common_wealth_system"` //共富制度比例 - SelfRateList map[string]string `json:"self_rate_list"` // 自购比例 - DirectPush map[string]string `json:"direct_push"` // 直推奖励比例 + Lv int `json:"lv"` // 会员级别 + LvName string `json:"lv_name"` // 会员名称 + ReturnType []string `json:"return_type"` //返利类型 + CommonWealthSystem map[string]string `json:"common_wealth_system"` //共富制度比例 + SelfRateList map[string]string `json:"self_rate_list"` // 自购比例 + DirectPush map[string]string `json:"direct_push"` // 直推奖励比例 + UserLvUpPublicPlatoonList []interface{} `json:"user_lv_up_public_platoon_list"` //会员费分销补贴相应方式的列表 } type PublicPlatoonRelateCommissionReq struct { diff --git a/svc/public_platoon_relate_commission.go b/svc/public_platoon_relate_commission.go index be2b611..f09c416 100644 --- a/svc/public_platoon_relate_commission.go +++ b/svc/public_platoon_relate_commission.go @@ -218,12 +218,33 @@ func BatchGetPublicPlatoonRelateCommissionByOrderLevel(engine *xorm.Engine, mast parentUid, _ := db.UserFindByID(engine, nowBenefitUid) lvGrade := subsidyTmp[zhios_order_relate_utils.IntToStr(parentUid.Level)] if lvGrade != nil { + //判断购买人是哪个等级 + UserLvUpPublicPlatoonList := make(map[string]interface{}) + if len(lvGrade.UserLvUpPublicPlatoonList) > 0 { + for _, v1 := range lvGrade.UserLvUpPublicPlatoonList { + v2 := v1.(map[string]interface{}) + if zhios_order_relate_utils.AnyToInt64(v2["lv"]) == zhios_order_relate_utils.StrToInt64(param.UserLevel) { + rateList, ok := v2["rate_list"].(map[string]interface{}) + if ok { + UserLvUpPublicPlatoonList = rateList + } + } + } + } for _, coinId := range lvGrade.ReturnType { var pendingAmount = param.PendingAmount if zhios_order_relate_utils.StrToInt(coinId) > 0 { //积分更换基数 pendingAmount = param.PendingIntegral } - commonWealthSystem[coinId] = zhios_order_relate_utils.Float64ToStrByPrec(zhios_order_relate_utils.StrToFloat64(lvGrade.CommonWealthSystem[coinId])*zhios_order_relate_utils.StrToFloat64(pendingAmount)/100, 9) + bili := lvGrade.CommonWealthSystem[coinId] + //判断购买人是哪个等级 读对应的比例 + if UserLvUpPublicPlatoonList != nil { + newBili, ok := UserLvUpPublicPlatoonList[coinId] + if ok { + bili = zhios_order_relate_utils.AnyToString(newBili) + } + } + commonWealthSystem[coinId] = zhios_order_relate_utils.Float64ToStrByPrec(zhios_order_relate_utils.StrToFloat64(bili)*zhios_order_relate_utils.StrToFloat64(pendingAmount)/100, 9) } } } diff --git a/svc/small_public_platoon_relate_commission.go b/svc/small_public_platoon_relate_commission.go index 137f189..81675bb 100644 --- a/svc/small_public_platoon_relate_commission.go +++ b/svc/small_public_platoon_relate_commission.go @@ -432,12 +432,33 @@ func BatchSmallGetPublicPlatoonRelateCommissionLevel(engine *xorm.Engine, master if parentUid != nil { lvGrade := subsidyTmp[zhios_order_relate_utils.IntToStr(parentUid.Level)] if lvGrade != nil { + //判断购买人是哪个等级 + UserLvUpPublicPlatoonList := make(map[string]interface{}) + if len(lvGrade.UserLvUpPublicPlatoonList) > 0 { + for _, v1 := range lvGrade.UserLvUpPublicPlatoonList { + v2 := v1.(map[string]interface{}) + if zhios_order_relate_utils.AnyToInt64(v2["lv"]) == zhios_order_relate_utils.StrToInt64(param.UserLevel) { + rateList, ok := v2["rate_list"].(map[string]interface{}) + if ok { + UserLvUpPublicPlatoonList = rateList + } + } + } + } for _, coinId := range lvGrade.ReturnType { var pendingAmount = param.PendingAmount if zhios_order_relate_utils.StrToInt(coinId) > 0 { //积分更换基数 pendingAmount = param.PendingIntegral } - commonWealthSystem[coinId] = zhios_order_relate_utils.Float64ToStrByPrec(zhios_order_relate_utils.StrToFloat64(lvGrade.CommonWealthSystem[coinId])*zhios_order_relate_utils.StrToFloat64(pendingAmount)/100, 9) + bili := lvGrade.CommonWealthSystem[coinId] + //判断购买人是哪个等级 读对应的比例 + if UserLvUpPublicPlatoonList != nil { + newBili, ok := UserLvUpPublicPlatoonList[coinId] + if ok { + bili = zhios_order_relate_utils.AnyToString(newBili) + } + } + commonWealthSystem[coinId] = zhios_order_relate_utils.Float64ToStrByPrec(zhios_order_relate_utils.StrToFloat64(bili)*zhios_order_relate_utils.StrToFloat64(pendingAmount)/100, 9) } } } From 673ac2e65031a5dc48f781afbe6a1579189dfa22 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Mon, 4 Mar 2024 17:38:24 +0800 Subject: [PATCH 4/4] =?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/public_platoon_relate_commission.go | 7 +++++++ svc/small_public_platoon_relate_commission.go | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/svc/public_platoon_relate_commission.go b/svc/public_platoon_relate_commission.go index f09c416..992769e 100644 --- a/svc/public_platoon_relate_commission.go +++ b/svc/public_platoon_relate_commission.go @@ -227,6 +227,13 @@ func BatchGetPublicPlatoonRelateCommissionByOrderLevel(engine *xorm.Engine, mast rateList, ok := v2["rate_list"].(map[string]interface{}) if ok { UserLvUpPublicPlatoonList = rateList + } else { + rateList, ok := v2["rate_list"].([]interface{}) + if ok { + for k, v := range rateList { + UserLvUpPublicPlatoonList[zhios_order_relate_utils.AnyToString(k)] = v + } + } } } } diff --git a/svc/small_public_platoon_relate_commission.go b/svc/small_public_platoon_relate_commission.go index 81675bb..1d2a549 100644 --- a/svc/small_public_platoon_relate_commission.go +++ b/svc/small_public_platoon_relate_commission.go @@ -441,6 +441,13 @@ func BatchSmallGetPublicPlatoonRelateCommissionLevel(engine *xorm.Engine, master rateList, ok := v2["rate_list"].(map[string]interface{}) if ok { UserLvUpPublicPlatoonList = rateList + } else { + rateList, ok := v2["rate_list"].([]interface{}) + if ok { + for k, v := range rateList { + UserLvUpPublicPlatoonList[zhios_order_relate_utils.AnyToString(k)] = v + } + } } } }