diff --git a/rule/small_public_platoon_relate_commission.go b/rule/small_public_platoon_relate_commission.go index 799b1c6..601f028 100644 --- a/rule/small_public_platoon_relate_commission.go +++ b/rule/small_public_platoon_relate_commission.go @@ -324,7 +324,7 @@ func smallPublicPlatoon(engine *xorm.Engine, uid, recommendUid int, userPublicPl fatherUidStr = zhios_order_relate_utils.IntToStr(m1.Id) } else { fatherUids := strings.Split(m1.FatherUid, "-") - if len(fatherUids) > userPublicPlatoonSetting.SeveralRows { + if len(fatherUids) >= userPublicPlatoonSetting.SeveralRows { fatherUidStr = zhios_order_relate_utils.IntToStr(m1.Id) + "-" + strings.Join(fatherUids[0:userPublicPlatoonSetting.SeveralRows:len(fatherUids)], "-") } else { fatherUidStr = zhios_order_relate_utils.IntToStr(m1.Id) + "-" + m1.FatherUid diff --git a/svc/small_public_platoon_relate_commission.go b/svc/small_public_platoon_relate_commission.go index e59d518..9e3edda 100644 --- a/svc/small_public_platoon_relate_commission.go +++ b/svc/small_public_platoon_relate_commission.go @@ -76,12 +76,24 @@ func BatchSmallGetPublicPlatoonRelateCommission(engine *xorm.Engine, masterId st fatherPositions := strings.Split(userPublicPlatoonRelation.FatherUid, "-") var fatherPosition string userPublicPlatoonRelation.ReturnCommissionNum++ - - remainder1 := (userPublicPlatoonRelation.ReturnCommissionNum) % len(fatherPositions) - if remainder1 == 0 { - fatherPosition = fatherPositions[len(fatherPositions)-1] + userPublicPlatoonSetting, err := db.UserPublicPlatoonSettingGetOneByParams(engine, map[string]interface{}{ + "key": "is_open", + "value": 1, + }) + if len(fatherPositions) > userPublicPlatoonSetting.SeveralTimes { + remainder1 := (userPublicPlatoonRelation.ReturnCommissionNum) % userPublicPlatoonSetting.SeveralTimes + if remainder1 == 0 { + fatherPosition = fatherPositions[len(fatherPositions)-1] + } else { + fatherPosition = fatherPositions[remainder1-1] + } } else { - fatherPosition = fatherPositions[remainder1-1] + remainder1 := (userPublicPlatoonRelation.ReturnCommissionNum) % len(fatherPositions) + if remainder1 == 0 { + fatherPosition = fatherPositions[len(fatherPositions)-1] + } else { + fatherPosition = fatherPositions[remainder1-1] + } } nowBenefitUsers, err := db.UserSmallPublicPlatoonRelationGetOneByParams(engine, map[string]interface{}{