relation.go 906 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/service/bbq/recsys/model"
  5. "go-common/app/service/bbq/user/api"
  6. "go-common/library/log"
  7. )
  8. //GetUserFollow ...
  9. func (d *Dao) GetUserFollow(c context.Context, mid int64, u *model.UserProfile) (err error) {
  10. if mid == 0 {
  11. return
  12. }
  13. relationReq := &api.ListRelationReq{Mid: mid}
  14. listRelationReply, err := d.UserClient.ListFollow(c, relationReq)
  15. if err != nil {
  16. log.Errorv(c)
  17. return
  18. }
  19. for _, MID := range listRelationReply.List {
  20. u.BBQFollow[MID] = 1
  21. }
  22. return
  23. }
  24. //GetUserBlack ...
  25. func (d *Dao) GetUserBlack(c context.Context, mid int64, u *model.UserProfile) (err error) {
  26. if mid == 0 {
  27. return
  28. }
  29. relationReq := &api.ListRelationReq{Mid: mid}
  30. listRelationReply, err := d.UserClient.ListBlack(c, relationReq)
  31. if err != nil {
  32. log.Errorv(c)
  33. return
  34. }
  35. for _, MID := range listRelationReply.List {
  36. u.BBQBlack[MID] = 1
  37. }
  38. return
  39. }