grpc.go 989 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package pgc
  2. import (
  3. "context"
  4. epgrpc "go-common/app/service/openplatform/pgc-season/api/grpc/episode/v1"
  5. seasongrpc "go-common/app/service/openplatform/pgc-season/api/grpc/season/v1"
  6. "go-common/library/log"
  7. )
  8. //CardsInfoReply pgc grpc
  9. func (d *Dao) CardsInfoReply(c context.Context, seasonIds []int32) (res map[int32]*seasongrpc.CardInfoProto, err error) {
  10. arg := &seasongrpc.SeasonInfoReq{
  11. SeasonIds: seasonIds,
  12. }
  13. info, err := d.rpcClient.Cards(c, arg)
  14. if err != nil {
  15. log.Error("d.rpcClient.Cards error(%v)", err)
  16. return nil, err
  17. }
  18. res = info.Cards
  19. return
  20. }
  21. //CardsEpInfoReply get pgc ep cards values by epid
  22. func (d *Dao) CardsEpInfoReply(c context.Context, epIds []int32) (res map[int32]*epgrpc.EpisodeCardsProto, err error) {
  23. var epInfo *epgrpc.EpisodeCardsReply
  24. arg := &epgrpc.EpReq{
  25. Epids: epIds,
  26. }
  27. epInfo, err = d.epClient.Cards(c, arg)
  28. if err != nil {
  29. log.Error("d.rpcClient.Cards error(%v)", err)
  30. return nil, err
  31. }
  32. res = epInfo.Cards
  33. return
  34. }