Skip to content

关注列表与粉丝列表是否混淆? #19

Description

@ytzeng2000

根据follower表:

  • userid:用户
  • followerid:关注的用户
    而在followDao中,获取关注列表函数:
    func (*FollowDao) GetFollowingIds(userId int64) ([]int64, error) { var ids []int64 if err := Db. Model(Follow{}). Where("follower_id = ?", userId). Pluck("user_id", &ids).Error; nil != err { // 没有关注任何人,但是不能算错。 if "record not found" == err.Error() { return nil, nil } // 查询出错。 log.Println(err.Error()) return nil, err } // 查询成功。 return ids, nil }
  • follower_id =userId,即关注了userId 的 所有用户ids , 应该是userId的粉丝列表叭?
  • 同样地,在获取粉丝列表函数中:
    func (*FollowDao) GetFollowersIds(userId int64) ([]int64, error) { var ids []int64 if err := Db. Model(Follow{}). Where("user_id = ?", userId). Where("cancel = ?", 0). Pluck("follower_id", &ids).Error; nil != err { // 没有粉丝,但是不能算错。 if "record not found" == err.Error() { return nil, nil } // 查询出错。 log.Println(err.Error()) return nil, err } // 查询成功。 return ids, nil }
  • user_id = userId,即当前用户userId 关注的所有用户ids, 应该是关注列表?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions