dao.go 841 B

123456789101112131415161718192021222324252627282930313233343536
  1. package ugcpay
  2. import (
  3. "context"
  4. "fmt"
  5. "go-common/app/interface/main/app-player/conf"
  6. ugcpay "go-common/app/service/main/ugcpay/api/grpc/v1"
  7. "go-common/library/log"
  8. )
  9. // Dao is ugcpay dao.
  10. type Dao struct {
  11. // rpc
  12. ugcpayRPC ugcpay.UGCPayClient
  13. }
  14. // New new a archive dao.
  15. func New(c *conf.Config) (d *Dao) {
  16. d = &Dao{}
  17. var err error
  18. d.ugcpayRPC, err = ugcpay.NewClient(c.UGCpayClient)
  19. if err != nil {
  20. panic(fmt.Sprintf("ugcpay NewClient error(%v)", err))
  21. }
  22. return
  23. }
  24. // AssetRelation is
  25. func (d *Dao) AssetRelation(c context.Context, aid, mid int64) (relation *ugcpay.AssetRelationResp, err error) {
  26. if relation, err = d.ugcpayRPC.AssetRelation(c, &ugcpay.AssetRelationReq{Oid: aid, Mid: mid, Otype: "archive"}); err != nil {
  27. log.Error("d.ugcpayRPC.AssetRelationDetail(%d) error(%+v)", aid, err)
  28. return
  29. }
  30. return
  31. }