remote.go 713 B

1234567891011121314151617181920212223242526272829303132
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/admin/main/coupon/model"
  5. seasongrpc "go-common/app/service/openplatform/pgc-season/api/grpc/season/v1"
  6. "github.com/pkg/errors"
  7. )
  8. //GetPGCInfo get pgc info.
  9. func (d *Dao) GetPGCInfo(c context.Context, oid int32) (r *model.PGCInfoResq, err error) {
  10. var (
  11. params *seasongrpc.SeasonInfoReq
  12. oids = make([]int32, 0)
  13. reply *seasongrpc.CardsInfoReply
  14. )
  15. oids = append(oids, oid)
  16. params = &seasongrpc.SeasonInfoReq{
  17. SeasonIds: oids,
  18. }
  19. if reply, err = d.rpcClient.Cards(c, params); err != nil {
  20. err = errors.WithStack(err)
  21. return
  22. }
  23. if proto, success := reply.Cards[oid]; success {
  24. r = new(model.PGCInfoResq)
  25. r.Title = proto.Title
  26. }
  27. return
  28. }