grpc.go 576 B

1234567891011121314151617181920212223242526272829303132
  1. package dao
  2. import (
  3. "context"
  4. arc "go-common/app/service/main/archive/api"
  5. "go-common/library/ecode"
  6. )
  7. // ArchiveUGCPay get archive ugcpay flag.
  8. func (d *Dao) ArchiveUGCPay(ctx context.Context, aid int64) (pay bool, err error) {
  9. var (
  10. req = &arc.ArcRequest{
  11. Aid: aid,
  12. }
  13. reply *arc.ArcReply
  14. )
  15. if reply, err = d.archiveAPI.Arc(ctx, req); err != nil {
  16. if err == ecode.NothingFound {
  17. err = nil
  18. pay = false
  19. return
  20. }
  21. return
  22. }
  23. if reply != nil && reply.Arc != nil && reply.Arc.Rights.UGCPay == 1 {
  24. pay = true
  25. } else {
  26. pay = false
  27. }
  28. return
  29. }