浏览代码

update

tags/v0.0.2
shenjiachi 2 周前
父节点
当前提交
fee1ee08e1
共有 3 个文件被更改,包括 17 次插入7 次删除
  1. +1
    -0
      src/dao/public_platoon_user_relation_dao.go
  2. +10
    -1
      src/implement/public_platoon_user_relation_implement.go
  3. +6
    -6
      src/implement/user_implement.go

+ 1
- 0
src/dao/public_platoon_user_relation_dao.go 查看文件

@@ -16,4 +16,5 @@ type PublicPlatoonUserRelationDao interface {
PublicPlatoonUserRelationFind(uid int64) ([]*model.PublicPlatoonUserRelation, error)
PublicPlatoonUserRelationFindByUid(uid int64) ([]*model.PublicPlatoonUserRelation, error)
PublicPlatoonUserRelationGetOneByUid(uid int64) (*model.PublicPlatoonUserRelation, error)
PublicPlatoonUserRelationGetOneByPosition(position int64) (*model.PublicPlatoonUserRelation, error)
}

+ 10
- 1
src/implement/public_platoon_user_relation_implement.go 查看文件

@@ -174,6 +174,15 @@ func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationGetOneByUid(uid in
return &parent, nil
}

func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationGetOneByPosition(position int64) (*model.PublicPlatoonUserRelation, error) {
var relation model.PublicPlatoonUserRelation
_, err := p.Db.Where("position = ?", position).Get(&relation)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
return &relation, nil
}

func (p PublicPlatoonUserRelationDb) GetTreeBySmall(head *model.PublicPlatoonUserRelation, leveLimit int) ([]*model.PublicPlatoonUserRelation, error) {
if leveLimit == 0 {
leveLimit = 1
@@ -193,7 +202,7 @@ func (p PublicPlatoonUserRelationDb) GetTreeBySmall(head *model.PublicPlatoonUse
if err1 != nil {
return nil, zhios_order_relate_logx.Error(err1)
}
res = append(res, son...)
queue = append(queue, son...)
}
return res, nil
}

+ 6
- 6
src/implement/user_implement.go 查看文件

@@ -16,22 +16,22 @@ type UserDb struct {
}

func (p UserDb) UserGetOneByPhone(phone int) (*model.User, error) {
var user *model.User
has, err := p.Db.Where("phone = ?", phone).Get(user)
var user model.User
has, err := p.Db.Where("phone = ?", phone).Get(&user)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, zhios_order_relate_logx.Error("未查询到相关用户记录")
}
return user, nil
return &user, nil
}

func (p UserDb) UserGetOneById(id int64) (*model.User, error) {
var user *model.User
_, err := p.Db.Where("phones = ?", id).Get(&user)
var user model.User
_, err := p.Db.Where("id = ?", id).Get(&user)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
return user, nil
return &user, nil
}

正在加载...
取消
保存