@@ -2,12 +2,13 @@ package md | |||||
// 公排结构 | // 公排结构 | ||||
type LvGrade struct { | 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 { | type PublicPlatoonRelateCommissionReq struct { | ||||
@@ -88,7 +88,7 @@ func DealUserGreenCoinDoubleChainIntegral(Db *xorm.Engine, uid int, amount, ordI | |||||
//5、查询上级直推的所有下级用户的虚拟币金额是否有大于当前用户的 | //5、查询上级直推的所有下级用户的虚拟币金额是否有大于当前用户的 | ||||
var sonUserVirtualWallet model.UserVirtualAmount | 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 { | if err != nil { | ||||
return | return | ||||
} | } | ||||
@@ -218,12 +218,40 @@ func BatchGetPublicPlatoonRelateCommissionByOrderLevel(engine *xorm.Engine, mast | |||||
parentUid, _ := db.UserFindByID(engine, nowBenefitUid) | parentUid, _ := db.UserFindByID(engine, nowBenefitUid) | ||||
lvGrade := subsidyTmp[zhios_order_relate_utils.IntToStr(parentUid.Level)] | lvGrade := subsidyTmp[zhios_order_relate_utils.IntToStr(parentUid.Level)] | ||||
if lvGrade != nil { | 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 | |||||
} else { | |||||
rateList, ok := v2["rate_list"].([]interface{}) | |||||
if ok { | |||||
for k, v := range rateList { | |||||
UserLvUpPublicPlatoonList[zhios_order_relate_utils.AnyToString(k)] = v | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
for _, coinId := range lvGrade.ReturnType { | for _, coinId := range lvGrade.ReturnType { | ||||
var pendingAmount = param.PendingAmount | var pendingAmount = param.PendingAmount | ||||
if zhios_order_relate_utils.StrToInt(coinId) > 0 { //积分更换基数 | if zhios_order_relate_utils.StrToInt(coinId) > 0 { //积分更换基数 | ||||
pendingAmount = param.PendingIntegral | 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) | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -429,16 +429,47 @@ func BatchSmallGetPublicPlatoonRelateCommissionLevel(engine *xorm.Engine, master | |||||
//共富简历 | //共富简历 | ||||
if zhios_order_relate_utils.StrToInt(nowBenefitUid) > 0 { | if zhios_order_relate_utils.StrToInt(nowBenefitUid) > 0 { | ||||
parentUid, _ := db.UserFindByID(engine, nowBenefitUid) | 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 { | |||||
//判断购买人是哪个等级 | |||||
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 | |||||
} else { | |||||
rateList, ok := v2["rate_list"].([]interface{}) | |||||
if ok { | |||||
for k, v := range rateList { | |||||
UserLvUpPublicPlatoonList[zhios_order_relate_utils.AnyToString(k)] = v | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
for _, coinId := range lvGrade.ReturnType { | |||||
var pendingAmount = param.PendingAmount | |||||
if zhios_order_relate_utils.StrToInt(coinId) > 0 { //积分更换基数 | |||||
pendingAmount = param.PendingIntegral | |||||
} | |||||
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) | |||||
} | } | ||||
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{ | resp[param.Oid] = &md.SmallPublicPlatoonRelateCommissionResp{ | ||||