dao.go 687 B

123456789101112131415161718192021222324252627282930313233
  1. package assist
  2. import (
  3. "context"
  4. "go-common/app/interface/main/app-intl/conf"
  5. "go-common/app/service/main/assist/model/assist"
  6. assistrpc "go-common/app/service/main/assist/rpc/client"
  7. "github.com/pkg/errors"
  8. )
  9. // Dao is assist dao
  10. type Dao struct {
  11. assistRPC *assistrpc.Service
  12. }
  13. // New initial assist dao
  14. func New(c *conf.Config) (d *Dao) {
  15. d = &Dao{
  16. assistRPC: assistrpc.New(c.AssistRPC),
  17. }
  18. return
  19. }
  20. // Assist get assists data from api.
  21. func (d *Dao) Assist(c context.Context, upMid int64) (asss []int64, err error) {
  22. arg := &assist.ArgAssists{Mid: upMid}
  23. if asss, err = d.assistRPC.AssistIDs(c, arg); err != nil {
  24. err = errors.Wrapf(err, "%v", arg)
  25. }
  26. return
  27. }