jct-company-search-page.go 812 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package controllers_join
  2. import (
  3. "encoding/json"
  4. "kkscrap-go/locals"
  5. models_join "kkscrap-go/models/join"
  6. "net/http"
  7. "github.com/dabory/abango-rest"
  8. "github.com/labstack/echo"
  9. )
  10. type CompanySearchPageReq struct {
  11. QueryVars locals.QueryVars
  12. CompanySearchVars locals.CompanySearchVars
  13. PageVars locals.PageVars
  14. }
  15. func CompanySearchPage(c echo.Context) error {
  16. v := c.Get("receiver").(CompanySearchPageReq)
  17. y := c.Get("abango").(abango.Controller)
  18. vRet := &struct {
  19. models_join.CompanySearchPageRet
  20. }{}
  21. vRet.QueryVars = v.QueryVars
  22. vRet.CompanySearchVars = v.CompanySearchVars
  23. vRet.PageVars = v.PageVars
  24. if err := vRet.GetCompanySearchPage(y.Db); err != nil {
  25. return c.String(607, err.Error())
  26. }
  27. ret, _ := json.Marshal(vRet)
  28. return c.JSONBlob(http.StatusOK, ret)
  29. }