account3.go 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. package client
  2. import (
  3. "context"
  4. v1 "go-common/app/service/main/account/api"
  5. "go-common/app/service/main/account/model"
  6. "go-common/library/net/rpc"
  7. )
  8. const (
  9. _info3 = "RPC.Info3"
  10. _card3 = "RPC.Card3"
  11. _infos3 = "RPC.Infos3"
  12. _infosByName3 = "RPC.InfosByName3"
  13. _cards3 = "RPC.Cards3"
  14. _profile3 = "RPC.Profile3"
  15. _profileStat3 = "RPC.ProfileWithStat3"
  16. _addExp3 = "RPC.AddExp3"
  17. _addMoral3 = "RPC.AddMoral3"
  18. _relation3 = "RPC.Relation3"
  19. _relations3 = "RPC.Relations3"
  20. _attentions3 = "RPC.Attentions3"
  21. _blacks3 = "RPC.Blacks3"
  22. _richRelations3 = "RPC.RichRelations3"
  23. )
  24. const (
  25. _appid = "account.service"
  26. )
  27. var (
  28. _noArg = &struct{}{}
  29. )
  30. // Service3 for server client3
  31. type Service3 struct {
  32. client *rpc.Client2
  33. }
  34. // New3 for new struct Service2 obj
  35. // DEPRECATED: Please use gRPC service instead.
  36. func New3(c *rpc.ClientConfig) (s *Service3) {
  37. s = &Service3{}
  38. s.client = rpc.NewDiscoveryCli(_appid, c)
  39. return
  40. }
  41. // Info3 receive ArgMid contains mid and real ip, then init user info.
  42. // DEPRECATED: Please use gRPC service instead.
  43. func (s *Service3) Info3(c context.Context, arg *model.ArgMid) (res *v1.Info, err error) {
  44. res = new(v1.Info)
  45. err = s.client.Call(c, _info3, arg, res)
  46. return
  47. }
  48. // Card3 receive ArgMid contains mid and real ip, then init user card.
  49. // DEPRECATED: Please use gRPC service instead.
  50. func (s *Service3) Card3(c context.Context, arg *model.ArgMid) (res *v1.Card, err error) {
  51. res = new(v1.Card)
  52. err = s.client.Call(c, _card3, arg, res)
  53. return
  54. }
  55. // Infos3 receive ArgMids contains mid and real ip, then init user info.
  56. // DEPRECATED: Please use gRPC service instead.
  57. func (s *Service3) Infos3(c context.Context, arg *model.ArgMids) (res map[int64]*v1.Info, err error) {
  58. err = s.client.Call(c, _infos3, arg, &res)
  59. return
  60. }
  61. // InfosByName3 receive ArgMids contains mid and real ip, then init user info.
  62. // DEPRECATED: Please use gRPC service instead.
  63. func (s *Service3) InfosByName3(c context.Context, arg *model.ArgNames) (res map[int64]*v1.Info, err error) {
  64. err = s.client.Call(c, _infosByName3, arg, &res)
  65. return
  66. }
  67. // Cards3 receive ArgMids contains mid and real ip, then init user card.
  68. // DEPRECATED: Please use gRPC service instead.
  69. func (s *Service3) Cards3(c context.Context, arg *model.ArgMids) (res map[int64]*v1.Card, err error) {
  70. err = s.client.Call(c, _cards3, arg, &res)
  71. return
  72. }
  73. // Profile3 get user profile.
  74. // DEPRECATED: Please use gRPC service instead.
  75. func (s *Service3) Profile3(c context.Context, arg *model.ArgMid) (res *v1.Profile, err error) {
  76. res = new(v1.Profile)
  77. err = s.client.Call(c, _profile3, arg, res)
  78. return
  79. }
  80. // ProfileWithStat3 get user profile.
  81. // DEPRECATED: Please use gRPC service instead.
  82. func (s *Service3) ProfileWithStat3(c context.Context, arg *model.ArgMid) (res *model.ProfileStat, err error) {
  83. res = new(model.ProfileStat)
  84. err = s.client.Call(c, _profileStat3, arg, res)
  85. return
  86. }
  87. // AddExp3 receive ArgExp contains mid, money and reason, then add exp for user.
  88. // DEPRECATED: Please use gRPC service instead.
  89. func (s *Service3) AddExp3(c context.Context, arg *model.ArgExp) (err error) {
  90. err = s.client.Call(c, _addExp3, arg, _noArg)
  91. return
  92. }
  93. // AddMoral3 receive ArgMoral contains mid, moral, oper, reason and remark, then add moral for user.
  94. // DEPRECATED: Please use gRPC service instead.
  95. func (s *Service3) AddMoral3(c context.Context, arg *model.ArgMoral) (err error) {
  96. err = s.client.Call(c, _addMoral3, arg, _noArg)
  97. return
  98. }
  99. // Relation3 get user friend relation.
  100. // DEPRECATED: Please use gRPC service instead.
  101. func (s *Service3) Relation3(c context.Context, arg *model.ArgRelation) (res *model.Relation, err error) {
  102. res = new(model.Relation)
  103. err = s.client.Call(c, _relation3, arg, res)
  104. return
  105. }
  106. // Relations3 batch get user friend relation.
  107. // DEPRECATED: Please use gRPC service instead.
  108. func (s *Service3) Relations3(c context.Context, arg *model.ArgRelations) (res map[int64]*model.Relation, err error) {
  109. err = s.client.Call(c, _relations3, arg, &res)
  110. return
  111. }
  112. // Attentions3 get user attentions ,include followings and whispers.
  113. // DEPRECATED: Please use gRPC service instead.
  114. func (s *Service3) Attentions3(c context.Context, arg *model.ArgMid) (res []int64, err error) {
  115. err = s.client.Call(c, _attentions3, arg, &res)
  116. return
  117. }
  118. // Blacks3 get user black list.
  119. // DEPRECATED: Please use gRPC service instead.
  120. func (s *Service3) Blacks3(c context.Context, arg *model.ArgMid) (res map[int64]struct{}, err error) {
  121. err = s.client.Call(c, _blacks3, arg, &res)
  122. return
  123. }
  124. // RichRelations3 get relation between owner and mids.
  125. // DEPRECATED: Please use gRPC service instead.
  126. func (s *Service3) RichRelations3(c context.Context, arg *model.ArgRichRelation) (res map[int64]int, err error) {
  127. err = s.client.Call(c, _richRelations3, arg, &res)
  128. return
  129. }