online.go 732 B

12345678910111213141516171819202122232425262728293031
  1. package http
  2. import bm "go-common/library/net/http/blademaster"
  3. func onlineTop(c *bm.Context) {
  4. v := new(struct {
  5. Business string `form:"business" validate:"required"`
  6. Num int `form:"num" validate:"required"`
  7. })
  8. if err := c.Bind(v); err != nil {
  9. return
  10. }
  11. c.JSON(srv.OnlineTop(c, v.Business, v.Num))
  12. }
  13. func onlineRoom(c *bm.Context) {
  14. v := new(struct {
  15. Business string `form:"business" validate:"required"`
  16. Rooms []string `form:"rooms" validate:"required"`
  17. })
  18. if err := c.Bind(v); err != nil {
  19. return
  20. }
  21. c.JSON(srv.OnlineRoom(c, v.Business, v.Rooms))
  22. }
  23. func onlineTotal(c *bm.Context) {
  24. res := make(map[string]int64)
  25. res["ip_count"], res["conn_count"] = srv.OnlineTotal(c)
  26. c.JSON(res, nil)
  27. }