|
|
@@ -79,12 +79,22 @@ func BatchGetPublicPlatoonRelateCommissionByOrder(engine *xorm.Engine, masterId |
|
|
|
fatherPositions := strings.Split(userPublicPlatoonRelation.FatherUid, "-") |
|
|
|
var fatherPosition string |
|
|
|
userPublicPlatoonRelation.ReturnCommissionNum++ |
|
|
|
remainder := (userPublicPlatoonRelation.ReturnCommissionNum) % userPublicPlatoonSetting.SeveralRows |
|
|
|
if remainder == 0 { |
|
|
|
fatherPosition = fatherPositions[userPublicPlatoonSetting.SeveralRows-1] |
|
|
|
if len(fatherPositions) < userPublicPlatoonSetting.SeveralRows { |
|
|
|
remainder1 := (userPublicPlatoonRelation.ReturnCommissionNum) % len(fatherPositions) |
|
|
|
if remainder1 == 0 { |
|
|
|
fatherPosition = fatherPositions[len(fatherPositions)-1] |
|
|
|
} else { |
|
|
|
fatherPosition = fatherPositions[len(fatherPositions)-remainder1] |
|
|
|
} |
|
|
|
} else { |
|
|
|
fatherPosition = fatherPositions[remainder-1] |
|
|
|
remainder2 := (userPublicPlatoonRelation.ReturnCommissionNum) % userPublicPlatoonSetting.SeveralRows |
|
|
|
if remainder2 == 0 { |
|
|
|
fatherPosition = fatherPositions[userPublicPlatoonSetting.SeveralRows-1] |
|
|
|
} else { |
|
|
|
fatherPosition = fatherPositions[remainder2-1] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
nowBenefitUsers, err := db.UserPublicPlatoonRelationGetOneByParams(engine, map[string]interface{}{ |
|
|
|
"key": "position", |
|
|
|
"value": fatherPosition, |
|
|
|