notice.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package http
  2. import (
  3. "strconv"
  4. "go-common/library/ecode"
  5. "go-common/library/log"
  6. bm "go-common/library/net/http/blademaster"
  7. )
  8. func notice(c *bm.Context) {
  9. c.JSON(struct{}{}, nil)
  10. }
  11. func closeNotice(c *bm.Context) {
  12. c.JSON(struct{}{}, nil)
  13. }
  14. func noticeV2(c *bm.Context) {
  15. var (
  16. params = c.Request.Form
  17. pf string
  18. build int64
  19. )
  20. mid, ok := c.Get("mid")
  21. if !ok {
  22. c.JSON(nil, ecode.RequestErr)
  23. return
  24. }
  25. uuid := params.Get("uuid")
  26. if uuid == "" {
  27. c.JSON(nil, ecode.RequestErr)
  28. return
  29. }
  30. pf = params.Get("platform")
  31. build, _ = strconv.ParseInt(params.Get("build"), 10, 64)
  32. n, err := memberSvc.NoticeV2(c, mid.(int64), uuid, pf, build)
  33. if err != nil {
  34. log.Error("memberSvc.NoticeV2(%d, %s) error(%v)", mid, uuid, err)
  35. c.JSON(nil, err)
  36. return
  37. }
  38. c.JSON(n, nil)
  39. }
  40. func closeNoticeV2(c *bm.Context) {
  41. mid, ok := c.Get("mid")
  42. if !ok {
  43. c.JSON(nil, ecode.RequestErr)
  44. return
  45. }
  46. uuid := c.Request.Form.Get("uuid")
  47. if uuid == "" {
  48. c.JSON(nil, ecode.RequestErr)
  49. return
  50. }
  51. err := memberSvc.CloseNoticeV2(c, mid.(int64), uuid)
  52. if err != nil {
  53. log.Error("memberSvc.CloseNoticeV2(%d, %s) error(%v)", mid, uuid, err)
  54. c.JSON(nil, err)
  55. }
  56. c.JSON(nil, nil)
  57. }