grpc.go 858 B

1234567891011121314151617181920212223242526272829303132
  1. package bangumi
  2. import (
  3. "context"
  4. episodegrpc "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. "github.com/pkg/errors"
  7. )
  8. func (d *Dao) CardsInfoReply(c context.Context, seasonIds []int32) (res map[int32]*seasongrpc.CardInfoProto, err error) {
  9. arg := &seasongrpc.SeasonInfoReq{SeasonIds: seasonIds}
  10. info, err := d.rpcClient.Cards(c, arg)
  11. if err != nil {
  12. err = errors.Wrapf(err, "%v", arg)
  13. return
  14. }
  15. res = info.Cards
  16. return
  17. }
  18. func (d *Dao) EpidsCardsInfoReply(c context.Context, episodeIds []int32) (res map[int32]*episodegrpc.EpisodeCardsProto, err error) {
  19. arg := &episodegrpc.EpReq{Epids: episodeIds}
  20. info, err := d.rpcEpidsClient.Cards(c, arg)
  21. if err != nil {
  22. err = errors.Wrapf(err, "%v", arg)
  23. return
  24. }
  25. res = info.Cards
  26. return
  27. }