Pārlūkot izejas kodu

update

tags/v0.0.2
shenjiachi pirms 2 nedēļām
vecāks
revīzija
fee1ee08e1
3 mainītis faili ar 17 papildinājumiem un 7 dzēšanām
  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 Parādīt failu

@@ -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 Parādīt failu

@@ -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 Parādīt failu

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

Notiek ielāde…
Atcelt
Saglabāt