diff --git a/rule/integral_release_settlement.go b/rule/integral_release_settlement.go index 47d19ee..21418ae 100644 --- a/rule/integral_release_settlement.go +++ b/rule/integral_release_settlement.go @@ -257,7 +257,7 @@ func CalcReleaseRate(integralReleaseBasic *model.IntegralReleaseBasic, ordDiscou } for _, value := range businessDiscountSet { - if value.Range[0] <= ordDiscountRatio && ordDiscountRatio <= value.Range[1] { + if value.Range[0] < ordDiscountRatio && ordDiscountRatio <= value.Range[1] { releaseSpeed = value.ReleaseSpeed } } diff --git a/rule/small_public_platoon_relate_commission.go b/rule/small_public_platoon_relate_commission.go index 141cfc2..ce41370 100644 --- a/rule/small_public_platoon_relate_commission.go +++ b/rule/small_public_platoon_relate_commission.go @@ -408,80 +408,6 @@ func smallPublicPlatoon(engine *xorm.Engine, uid, recommendUid int, userPublicPl return userSmallPublicPlatoonRelation, nil } -//func naturalSmallPublicPlatoon(engine *xorm.Engine, uid int, originalPosition *int, userPublicPlatoonSetting model.UserPublicPlatoonSetting, mapBigUserSmallPublicPlatoonRelations map[int]interface{}) (model.UserSmallPublicPlatoonRelation, error) { -// var userPublicPlatoonRelation model.UserSmallPublicPlatoonRelation -// //TODO::判断 `position + userPublicPlatoonSetting.SeveralTimes(几乘)` OR `position + 1` -// var position, position1, position2 int -// position1 = *originalPosition + 1 -// position2 = *originalPosition + userPublicPlatoonSetting.SeveralTimes -// var level, level1, level2 float64 -// smallMakeSearchLevel(&position1, float64(userPublicPlatoonSetting.SeveralTimes), &level1) -// smallMakeSearchLevel(&position2, float64(userPublicPlatoonSetting.SeveralTimes), &level2) -// level = level1 -// if level > 2 { -// if level1 != level2 { -// position = smallReverseDeductionPosition(*originalPosition, smallGetLevelForFirstPosition(int(level), userPublicPlatoonSetting.SeveralTimes), userPublicPlatoonSetting.SeveralTimes) -// } else { -// if position1 == smallGetLevelForFirstPosition(int(level), userPublicPlatoonSetting.SeveralTimes) { -// position = position1 -// } else { -// position = position2 -// } -// } -// } else { -// position = position1 -// } -// if mapBigUserSmallPublicPlatoonRelations[position] != nil { -// originalPosition = &position -// return naturalSmallPublicPlatoon(engine, uid, originalPosition, userPublicPlatoonSetting, mapBigUserSmallPublicPlatoonRelations) -// } -// -// pid := makeSearchPid(position, userPublicPlatoonSetting.SeveralTimes) -// -// //2、查找对应pid的 user_public_platoon_relation 记录 -// var m1 model.UserSmallPublicPlatoonRelation -// if has, err := engine.Where("position=?", pid).Get(&m1); err != nil || has == false { -// return userPublicPlatoonRelation, err -// } -// var fatherUid string -// if m1.FatherUid == "" { -// //TODO::顶级 -// fatherUid = zhios_order_relate_utils.IntToStr(m1.Position) -// } else { -// fatherUids := strings.Split(m1.FatherUid, "-") -// if len(fatherUids) > userPublicPlatoonSetting.SeveralRows { -// fatherUid = zhios_order_relate_utils.IntToStr(m1.Position) + "-" + strings.Join(fatherUids[0:userPublicPlatoonSetting.SeveralRows:len(fatherUids)], "-") -// } else { -// fatherUid = zhios_order_relate_utils.IntToStr(m1.Position) + "-" + m1.FatherUid -// } -// } -// -// //唯一标识符(父级id-uid-等级-位置) -// var uniqueIdentifier = zhios_order_relate_utils.IntToStr(pid) + "-" + zhios_order_relate_utils.IntToStr(uid) + "-" + zhios_order_relate_utils.IntToStr(int(level)) + "-" + zhios_order_relate_utils.IntToStr(position) -// -// // 3、插入 user_public_platoon_relation 记录 -// if userPublicPlatoonSetting.SettleDay == 0 { -// userPublicPlatoonSetting.SettleDay = 30 -// } -// now := time.Now() -// userPublicPlatoonRelation.Uid = uid -// userPublicPlatoonRelation.FatherUid = fatherUid -// userPublicPlatoonRelation.Pid = pid -// userPublicPlatoonRelation.RecommendUid = 0 -// userPublicPlatoonRelation.Level = int(level) -// userPublicPlatoonRelation.Position = position -// userPublicPlatoonRelation.UniqueIdentifier = uniqueIdentifier -// userPublicPlatoonRelation.WaitForSettlementDate = now.AddDate(0, 0, userPublicPlatoonSetting.SettleDay).Format("2006-01-02") -// userPublicPlatoonRelation.JoinAt = now -// userPublicPlatoonRelation.CreateAt = now -// userPublicPlatoonRelation.UpdateAt = now -// _, err := db.UserSmallPublicPlatoonRelationInsert(engine, &userPublicPlatoonRelation) -// if err != nil { -// return model.UserSmallPublicPlatoonRelation{}, err -// } -// return userPublicPlatoonRelation, nil -//} - // smallReverseDeductionPosition 逆向推导 position func smallReverseDeductionPosition(calcPosition, levelFirstPosition, severalTimes int) (position int) { remainder := (calcPosition - 1) % severalTimes