task_rpc.go 967 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package dao
  2. import (
  3. "context"
  4. relmod "go-common/app/service/main/relation/model"
  5. uprpc "go-common/app/service/main/up/api/v1"
  6. "go-common/library/log"
  7. terrors "github.com/pkg/errors"
  8. )
  9. // FansCount 粉丝数
  10. func (d *Dao) FansCount(c context.Context, mid int64) (fans int64, err error) {
  11. if d.c.Debug {
  12. return 10086, nil
  13. }
  14. arg := &relmod.ArgMid{Mid: mid}
  15. stat, err := d.relRPC.Stat(c, arg)
  16. if err != nil || stat == nil {
  17. log.Error("FansCount error(%v)", terrors.WithStack(err))
  18. return
  19. }
  20. fans = stat.Follower
  21. return
  22. }
  23. // UpSpecial 分组信息
  24. func (d *Dao) UpSpecial(c context.Context, mid int64) (groupids []int64, err error) {
  25. if d.c.Debug {
  26. return
  27. }
  28. req := &uprpc.UpSpecialReq{Mid: mid}
  29. var reply *uprpc.UpSpecialReply
  30. if reply, err = d.upRPC.UpSpecial(c, req); err != nil || reply == nil {
  31. log.Error("UpSpecial(%d) error(%+v)", mid, err)
  32. return
  33. }
  34. if reply.UpSpecial != nil {
  35. groupids = reply.UpSpecial.GroupIDs
  36. }
  37. return
  38. }