userExp.go 817 B

12345678910111213141516171819202122232425262728293031
  1. package xuser
  2. import (
  3. "context"
  4. "github.com/pkg/errors"
  5. xuserM "go-common/app/service/live/xuser/api/grpc/v1"
  6. "go-common/library/ecode"
  7. "go-common/library/log"
  8. )
  9. // GetUserExpData ...
  10. // 调用account grpc接口cards获取用户信息
  11. func (d *Dao) GetUserExpData(c context.Context, UIDs []int64) (userResult map[int64]*xuserM.LevelInfo, err error) {
  12. userResult = make(map[int64]*xuserM.LevelInfo)
  13. lens := len(UIDs)
  14. if lens <= 0 {
  15. return
  16. }
  17. ret, err := d.xuserGRPC.GetUserExp(c, &xuserM.GetUserExpReq{Uids: UIDs})
  18. if err != nil {
  19. err = errors.WithMessage(ecode.AccountGRPCError, "GET SEA PATROL FAIL")
  20. log.Error("Call main.Account.Cards Error.Infos(%+v) error(%+v)", UIDs, err)
  21. }
  22. // 整理数据
  23. for _, item := range ret.Data {
  24. if item != nil {
  25. userResult[item.Uid] = item
  26. }
  27. }
  28. return
  29. }