瀏覽代碼

update

master
DengBiao 9 月之前
父節點
當前提交
ba8ea76344
共有 1 個文件被更改,包括 15 次插入0 次删除
  1. +15
    -0
      db/dbs_user.go

+ 15
- 0
db/dbs_user.go 查看文件

@@ -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…
取消
儲存