Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
douya222 opened this issue Apr 20, 2024 · 1 comment
Open

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

douya222 opened this issue Apr 20, 2024 · 1 comment

Comments

@douya222
Copy link

根据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, 应该是关注列表?
@REN-lls
Copy link
Collaborator

REN-lls commented Apr 30, 2024

你理解反了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants