req_rpc.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package dao
  2. import (
  3. "context"
  4. account "go-common/app/service/main/account/api"
  5. location "go-common/app/service/main/location/model"
  6. member "go-common/app/service/main/member/api"
  7. "go-common/library/log"
  8. "go-common/library/net/metadata"
  9. "github.com/pkg/errors"
  10. )
  11. // Info3 get info by mid
  12. func (d *Dao) Info3(c context.Context, mid int64) (info *account.Info, err error) {
  13. var (
  14. arg = &account.MidReq{
  15. Mid: mid,
  16. RealIp: metadata.String(c, metadata.RemoteIP),
  17. }
  18. res *account.InfoReply
  19. )
  20. if res, err = d.accountClient.Info3(c, arg); err != nil {
  21. err = errors.Wrapf(err, "%v", arg)
  22. return nil, err
  23. }
  24. return res.Info, nil
  25. }
  26. // Infos get the ips info.
  27. func (d *Dao) Infos(c context.Context, ipList []string) (res map[string]*location.Info, err error) {
  28. if res, err = d.locRPC.Infos(c, ipList); err != nil {
  29. log.Error("s.locaRPC err(%v)", err)
  30. }
  31. return
  32. }
  33. // CheckRealnameStatus realname status
  34. func (d *Dao) CheckRealnameStatus(c context.Context, mid int64) (status int8, err error) {
  35. var (
  36. relnameStatus *member.RealnameStatusReply
  37. )
  38. if relnameStatus, err = d.memberClient.RealnameStatus(c, &member.MemberMidReq{Mid: mid, RemoteIP: metadata.String(c, metadata.RemoteIP)}); err != nil {
  39. log.Error("s.memberSvr.RealnameStatus err(%v)", err)
  40. return
  41. }
  42. return relnameStatus.RealnameStatus, nil
  43. }