|
@@ -32,6 +32,21 @@ func DbsUserRelate(eg *xorm.Engine, uid, level int) (*[]model.UserRelate, error) |
|
|
return &userRelate, nil |
|
|
return &userRelate, nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func DbsUserRelateByParentUid(eg *xorm.Engine, uid, level int) (*[]model.UserRelate, error) { |
|
|
|
|
|
var userRelate []model.UserRelate |
|
|
|
|
|
sess := eg.Where("parent_uid = ?", uid) |
|
|
|
|
|
if level > 0 { |
|
|
|
|
|
sess.And("level<=?", level) |
|
|
|
|
|
} |
|
|
|
|
|
if err := sess.Asc("level").Find(&userRelate); err != nil { |
|
|
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
|
|
} |
|
|
|
|
|
if len(userRelate) == 0 { |
|
|
|
|
|
return nil, nil |
|
|
|
|
|
} |
|
|
|
|
|
return &userRelate, nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func SumUserRelateByParentUid(eg *xorm.Engine, parentUid string) (total int64, userRelate []*model.UserRelate, err error) { |
|
|
func SumUserRelateByParentUid(eg *xorm.Engine, parentUid string) (total int64, userRelate []*model.UserRelate, err error) { |
|
|
total, err = eg.Where("parent_uid = ?", parentUid).FindAndCount(&userRelate) |
|
|
total, err = eg.Where("parent_uid = ?", parentUid).FindAndCount(&userRelate) |
|
|
return |
|
|
return |
|
|