jct-chart-pages.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package controllers_join
  2. import (
  3. "boiler-go/locals"
  4. models_join "boiler-go/models/join"
  5. "encoding/json"
  6. "net/http"
  7. "github.com/dabory/abango-rest"
  8. "github.com/labstack/echo"
  9. )
  10. type ChartLine2PageReq struct {
  11. QueryVars locals.QueryVars
  12. ChartLine2Vars locals.ListType1Vars
  13. PageVars locals.PageVars
  14. }
  15. type ChartType1PageReq struct {
  16. QueryVars locals.QueryVars
  17. ChartLine2Vars locals.ListType1Vars
  18. PageVars locals.PageVars
  19. }
  20. func ChartLine2Page(c echo.Context) error {
  21. v := c.Get("receiver").(ChartLine2PageReq)
  22. y := c.Get("abango").(abango.Controller)
  23. vRet := &struct {
  24. models_join.ChartLine2PageRet
  25. }{}
  26. vRet.QueryVars = v.QueryVars
  27. vRet.ChartLine2Vars = v.ChartLine2Vars
  28. if err := vRet.GetChartLine2Page(&y); err != nil {
  29. return c.String(607, err.Error())
  30. }
  31. ret, _ := json.Marshal(vRet)
  32. return c.JSONBlob(http.StatusOK, ret)
  33. }
  34. func ChartType1Page(c echo.Context) error {
  35. v := c.Get("receiver").(ChartType1PageReq)
  36. y := c.Get("abango").(abango.Controller)
  37. vRet := &struct {
  38. models_join.ChartType1PageRet
  39. }{}
  40. vRet.QueryVars = v.QueryVars
  41. vRet.ChartLine2Vars = v.ChartLine2Vars
  42. if err := vRet.GetChartType1Page(&y); err != nil {
  43. return c.String(607, err.Error())
  44. }
  45. ret, _ := json.Marshal(vRet)
  46. return c.JSONBlob(http.StatusOK, ret)
  47. }