sidebar.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package http
  2. import (
  3. "strconv"
  4. "go-common/app/interface/main/app-resource/model"
  5. "go-common/library/ecode"
  6. bm "go-common/library/net/http/blademaster"
  7. )
  8. func sidebar(c *bm.Context) {
  9. var (
  10. params = c.Request.Form
  11. module int
  12. mid int64
  13. )
  14. mobiApp := params.Get("mobi_app")
  15. buildStr := params.Get("build")
  16. device := params.Get("device")
  17. language := params.Get("lang")
  18. plat := model.Plat(mobiApp, device)
  19. build, err := strconv.Atoi(buildStr)
  20. if err != nil {
  21. c.JSON(nil, ecode.RequestErr)
  22. return
  23. }
  24. if midInter, ok := c.Get("mid"); ok {
  25. mid = midInter.(int64)
  26. }
  27. switch plat {
  28. case model.PlatAndroid, model.PlatAndroidG, model.PlatAndroidB, model.PlatAndroidI:
  29. module = 1
  30. case model.PlatIPhone, model.PlatIPhoneI, model.PlatIPhoneB:
  31. module = 3
  32. }
  33. c.JSON(sideSvr.SideBar(c, plat, build, module, mid, language), nil)
  34. }
  35. func topbar(c *bm.Context) {
  36. var (
  37. params = c.Request.Form
  38. module int
  39. mid int64
  40. )
  41. mobiApp := params.Get("mobi_app")
  42. buildStr := params.Get("build")
  43. device := params.Get("device")
  44. language := params.Get("lang")
  45. plat := model.Plat(mobiApp, device)
  46. build, err := strconv.Atoi(buildStr)
  47. if err != nil {
  48. c.JSON(nil, ecode.RequestErr)
  49. return
  50. }
  51. if midInter, ok := c.Get("mid"); ok {
  52. mid = midInter.(int64)
  53. }
  54. switch plat {
  55. case model.PlatAndroid, model.PlatAndroidG, model.PlatAndroidB, model.PlatAndroidI:
  56. module = 2
  57. case model.PlatIPhone, model.PlatIPhoneI, model.PlatIPhoneB:
  58. module = 4
  59. case model.PlatIPad, model.PlatIPadI:
  60. module = 5
  61. }
  62. c.JSON(sideSvr.SideBar(c, plat, build, module, mid, language), nil)
  63. }