notice.go 909 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package http
  2. import (
  3. "go-common/app/interface/bbq/app-bbq/api/http/v1"
  4. "go-common/library/ecode"
  5. bm "go-common/library/net/http/blademaster"
  6. "github.com/pkg/errors"
  7. )
  8. func noticeNum(c *bm.Context) {
  9. var mid int64
  10. midValue, exists := c.Get("mid")
  11. if !exists {
  12. c.JSON(nil, ecode.NoLogin)
  13. return
  14. }
  15. mid = midValue.(int64)
  16. c.JSON(srv.GetNoticeNum(c, mid))
  17. }
  18. func noticeOverview(c *bm.Context) {
  19. var mid int64
  20. midValue, exists := c.Get("mid")
  21. if !exists {
  22. c.JSON(nil, ecode.NoLogin)
  23. return
  24. }
  25. mid = midValue.(int64)
  26. c.JSON(srv.NoticeOverview(c, mid))
  27. }
  28. func noticeList(c *bm.Context) {
  29. var mid int64
  30. midValue, exists := c.Get("mid")
  31. if !exists {
  32. c.JSON(nil, ecode.NoLogin)
  33. return
  34. }
  35. mid = midValue.(int64)
  36. req := &v1.NoticeListRequest{}
  37. if err := c.Bind(req); err != nil {
  38. errors.Wrap(err, "参数验证失败")
  39. return
  40. }
  41. req.Mid = mid
  42. c.JSON(srv.NoticeList(c, req))
  43. }