cache.go 935 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package http
  2. import (
  3. "go-common/library/ecode"
  4. "go-common/library/log"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. func infoPBCache(c *bm.Context) {
  8. var (
  9. err error
  10. key = c.Request.Form.Get("key")
  11. )
  12. if key == "" {
  13. c.JSON(nil, ecode.RequestErr)
  14. return
  15. }
  16. info, err := srv.InfoPBCache(c, key)
  17. if err != nil {
  18. log.Error("service.InfoPBCache(%s) error(%v)", key, err)
  19. res := map[string]interface{}{}
  20. res["code"] = err
  21. res["message"] = err.Error()
  22. c.JSONMap(res, nil)
  23. return
  24. }
  25. c.JSON(info, nil)
  26. }
  27. func tokenPBCache(c *bm.Context) {
  28. var (
  29. err error
  30. key = c.Request.Form.Get("key")
  31. )
  32. if key == "" {
  33. c.JSON(nil, ecode.RequestErr)
  34. return
  35. }
  36. info, err := srv.TokenPBCache(c, key)
  37. if err != nil {
  38. log.Error("service.TokenPBCache(%s) error(%v)", key, err)
  39. res := map[string]interface{}{}
  40. res["code"] = err
  41. res["message"] = err.Error()
  42. c.JSONMap(res, nil)
  43. return
  44. }
  45. c.JSON(info, nil)
  46. }