Browse Source

update 共富制度

tags/v1.9.0
DengBiao 2 years ago
parent
commit
a0897fa002
2 changed files with 18 additions and 6 deletions
  1. +1
    -1
      rule/small_public_platoon_relate_commission.go
  2. +17
    -5
      svc/small_public_platoon_relate_commission.go

+ 1
- 1
rule/small_public_platoon_relate_commission.go View File

@@ -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


+ 17
- 5
svc/small_public_platoon_relate_commission.go View File

@@ -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{}{


Loading…
Cancel
Save