stat.go 761 B

12345678910111213141516171819202122232425262728293031323334353637
  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. "go-common/library/xstr"
  8. )
  9. // arcStat get archive stat.
  10. func arcStat(c *bm.Context) {
  11. params := c.Request.Form
  12. aidStr := params.Get("aid")
  13. // check params
  14. aid, err := strconv.ParseInt(aidStr, 10, 64)
  15. if err != nil {
  16. c.JSON(nil, ecode.RequestErr)
  17. return
  18. }
  19. c.JSON(arcSvc.Stat3(c, aid))
  20. }
  21. // arcStats get archives stat.
  22. func arcStats(c *bm.Context) {
  23. params := c.Request.Form
  24. aidsStr := params.Get("aids")
  25. // check params
  26. aids, err := xstr.SplitInts(aidsStr)
  27. if err != nil {
  28. log.Error("query aids(%s) split error(%v)", aidsStr, err)
  29. c.JSON(nil, ecode.RequestErr)
  30. return
  31. }
  32. c.JSON(arcSvc.Stats3(c, aids))
  33. }