Browse Source

update

master
DengBiao 11 months ago
parent
commit
ba8ea76344
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      db/dbs_user.go

+ 15
- 0
db/dbs_user.go View File

@@ -32,6 +32,21 @@ func DbsUserRelate(eg *xorm.Engine, uid, level int) (*[]model.UserRelate, error)
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) {
total, err = eg.Where("parent_uid = ?", parentUid).FindAndCount(&userRelate)
return


Loading…
Cancel
Save