|
|
@@ -68,3 +68,20 @@ func (u UserRelateDb) PageFindUserRelateByParentUid(uid int64, page, pageSize in |
|
|
|
} |
|
|
|
return &userRelate, count, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (u UserRelateDb) PageFindUserRelateByParentUidAndLevel(uid int64, page, limit int, level int) (*[]model.UserRelate, int64, error) { |
|
|
|
var userRelate []model.UserRelate |
|
|
|
sess := u.Db.Where("parent_uid = ?", uid) |
|
|
|
if level == 1 || level == 2 { |
|
|
|
sess.And("level=?", level) |
|
|
|
} else if level == 0 { |
|
|
|
|
|
|
|
} else { |
|
|
|
sess.And("level != 1").And("level != 2") |
|
|
|
} |
|
|
|
total, err := sess.Limit(limit, (page-1)*page).Asc("uid").FindAndCount(&userRelate) |
|
|
|
if err != nil { |
|
|
|
return nil, 0, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
return &userRelate, total, nil |
|
|
|
} |