activity.go 917 B

123456789101112131415161718192021222324252627282930313233343536
  1. package newbiedao
  2. import (
  3. "context"
  4. "go-common/app/interface/main/growup/model"
  5. "go-common/library/ecode"
  6. "go-common/library/log"
  7. //"go-common/library/net/http/blademaster"
  8. "go-common/library/net/metadata"
  9. "net/url"
  10. )
  11. // const text
  12. const (
  13. // ActivityTypeVideo type "videoall"
  14. ActivityTypeVideo = "videoall"
  15. )
  16. // GetActivities get activities
  17. func (d *Dao) GetActivities(c context.Context) (res []*model.Activity, err error) {
  18. activitiesRes := new(model.ActivitiesRes)
  19. err = d.httpRead.Get(c, d.c.Host.ActivitiesURI+ActivityTypeVideo, metadata.String(c, metadata.RemoteIP), url.Values{}, &activitiesRes)
  20. if err != nil {
  21. log.Error("s.dao.GetActivities error(%v)", err)
  22. return
  23. }
  24. if activitiesRes.Code != ecode.OK.Code() {
  25. err = ecode.Int(activitiesRes.Code)
  26. log.Error("s.dao.GetActivities get activities failed, ecode: %d", activitiesRes.Code)
  27. return
  28. }
  29. res = activitiesRes.Data
  30. return
  31. }