notice.go 665 B

123456789101112131415161718192021222324252627
  1. package service
  2. import (
  3. "context"
  4. "fmt"
  5. "go-common/app/interface/main/growup/model"
  6. )
  7. // LatestNotice latest notice
  8. func (s *Service) LatestNotice(c context.Context, platform int) (notice *model.Notice, err error) {
  9. return s.dao.LatestNotice(c, platform)
  10. }
  11. // GetNotices get notice
  12. func (s *Service) GetNotices(c context.Context, typ int, platform int, offset, limit int) (notices []*model.Notice, total int64, err error) {
  13. typStr := ""
  14. if typ > 0 {
  15. typStr = fmt.Sprintf("type=%d AND", typ)
  16. }
  17. total, err = s.dao.NoticeCount(c, typStr, platform)
  18. if err != nil {
  19. return
  20. }
  21. notices, err = s.dao.Notices(c, typStr, platform, offset, limit)
  22. return
  23. }