act.go 649 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package http
  2. import (
  3. "go-common/library/ecode"
  4. bm "go-common/library/net/http/blademaster"
  5. )
  6. func redDot(c *bm.Context) {
  7. v := new(struct {
  8. Mid int64 `form:"mid" validate:"min=1"`
  9. })
  10. if err := c.Bind(v); err != nil {
  11. return
  12. }
  13. c.JSON(likeSvc.RedDot(c, v.Mid))
  14. }
  15. func clearRedDot(c *bm.Context) {
  16. var loginMid int64
  17. v := new(struct {
  18. Mid int64 `form:"mid"`
  19. })
  20. if err := c.Bind(v); err != nil {
  21. return
  22. }
  23. if midInter, ok := c.Get("mid"); ok {
  24. loginMid = midInter.(int64)
  25. if loginMid != 0 {
  26. v.Mid = loginMid
  27. }
  28. }
  29. if v.Mid == 0 {
  30. c.JSON(nil, ecode.RequestErr)
  31. return
  32. }
  33. c.JSON(nil, likeSvc.ClearRetDot(c, v.Mid))
  34. }