static.go 750 B

1234567891011121314151617181920212223242526272829303132
  1. package http
  2. import (
  3. "go-common/app/interface/main/app-resource/model"
  4. "go-common/library/ecode"
  5. "go-common/library/log"
  6. bm "go-common/library/net/http/blademaster"
  7. "strconv"
  8. "time"
  9. )
  10. // getStatic get static
  11. func getStatic(c *bm.Context) {
  12. params := c.Request.Form
  13. mobiApp := params.Get("mobi_app")
  14. device := params.Get("device")
  15. ver := params.Get("ver")
  16. buildStr := params.Get("build")
  17. build, err := strconv.Atoi(buildStr)
  18. if err != nil {
  19. log.Error("build(%s) error(%v)", buildStr, err)
  20. c.JSON(nil, ecode.RequestErr)
  21. return
  22. }
  23. plat := model.Plat(mobiApp, device)
  24. data, version, err := staticSvc.Static(plat, build, ver, time.Now())
  25. res := map[string]interface{}{
  26. "data": data,
  27. "ver": version,
  28. }
  29. c.JSONMap(res, err)
  30. }