Ver código fonte

update

master
DengBiao 9 meses atrás
pai
commit
ba8ea76344
1 arquivos alterados com 15 adições e 0 exclusões
  1. +15
    -0
      db/dbs_user.go

+ 15
- 0
db/dbs_user.go Ver arquivo

@@ -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


Carregando…
Cancelar
Salvar