|
@@ -129,7 +129,7 @@ func AddPublicPlatoonRelateCommission(engine *xorm.Engine, masterId string, AddP |
|
|
publicPlatoon 公排方法 |
|
|
publicPlatoon 公排方法 |
|
|
TODO 相关公式: |
|
|
TODO 相关公式: |
|
|
1: 每个等级的起始值(1+5^0+5^1+5^2+...+5^x-2), 每个等级的结束值(`5^0+5^1+5^2+...+5^x-1) |
|
|
1: 每个等级的起始值(1+5^0+5^1+5^2+...+5^x-2), 每个等级的结束值(`5^0+5^1+5^2+...+5^x-1) |
|
|
2: 根据position查找pid { (position-1)/5 } |
|
|
|
|
|
|
|
|
2: 根据position查找父级position { (position-1)/5 } |
|
|
3: 根据position查找等级level {position-5^0-5^1-5^2-...-5^x 是否 <0 ? => x+1 } |
|
|
3: 根据position查找等级level {position-5^0-5^1-5^2-...-5^x 是否 <0 ? => x+1 } |
|
|
*/ |
|
|
*/ |
|
|
func publicPlatoon(engine *xorm.Engine, uid, recommendUid int, userPublicPlatoonSetting model.UserPublicPlatoonSetting) (model.UserPublicPlatoonRelation, error) { |
|
|
func publicPlatoon(engine *xorm.Engine, uid, recommendUid int, userPublicPlatoonSetting model.UserPublicPlatoonSetting) (model.UserPublicPlatoonRelation, error) { |
|
@@ -148,7 +148,7 @@ func publicPlatoon(engine *xorm.Engine, uid, recommendUid int, userPublicPlatoon |
|
|
|
|
|
|
|
|
//2、查找对应pid的 user_public_platoon_relation 记录 |
|
|
//2、查找对应pid的 user_public_platoon_relation 记录 |
|
|
var m1 model.UserPublicPlatoonRelation |
|
|
var m1 model.UserPublicPlatoonRelation |
|
|
if has, err := engine.Where("uid=?", pid).Get(&m1); err != nil || has == false { |
|
|
|
|
|
|
|
|
if has, err := engine.Where("position=?", pid).Get(&m1); err != nil || has == false { |
|
|
return userPublicPlatoonRelation, err |
|
|
return userPublicPlatoonRelation, err |
|
|
} |
|
|
} |
|
|
var fatherUid string |
|
|
var fatherUid string |
|
|