|
|
@@ -19,7 +19,7 @@ type PublicPlatoonUserRelationDb struct { |
|
|
|
Db *xorm.Engine |
|
|
|
} |
|
|
|
|
|
|
|
func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationInsert(PublicPlatoonUserRelation *model.PublicPlatoonUserRelation) (int, error) { |
|
|
|
func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationInsert(PublicPlatoonUserRelation *model.PublicPlatoonUserRelation) (int64, error) { |
|
|
|
_, err := p.Db.InsertOne(PublicPlatoonUserRelation) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
@@ -131,7 +131,7 @@ func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationFind(uid int64) ([ |
|
|
|
return nil, zhios_order_relate_logx.Error("未查询到数据") |
|
|
|
} |
|
|
|
} else { |
|
|
|
has, err2 := p.Db.Where("level1 = ?", 1).Get(&head) |
|
|
|
has, err2 := p.Db.Where("level_total = ?", 1).Get(&head) |
|
|
|
if err2 != nil { |
|
|
|
return nil, err2 |
|
|
|
} |
|
|
@@ -193,12 +193,12 @@ func (p PublicPlatoonUserRelationDb) GetTreeBySmall(head *model.PublicPlatoonUse |
|
|
|
for len(queue) > 0 { |
|
|
|
node := queue[0] |
|
|
|
queue = queue[1:] |
|
|
|
if node.Level1 > head.Level1+leveLimit { |
|
|
|
if node.LevelTotal > head.LevelTotal+leveLimit { |
|
|
|
break |
|
|
|
} |
|
|
|
res = append(res, node) |
|
|
|
var son []*model.PublicPlatoonUserRelation |
|
|
|
err1 := p.Db.Where("father_uid1 = ?", node.Uid).Find(son) |
|
|
|
err1 := p.Db.Where("father_uid1 = ?", node.Uid).Find(&son) |
|
|
|
if err1 != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err1) |
|
|
|
} |
|
|
|