notice.go 893 B

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