jct-media-search-page.go 812 B

123456789101112131415161718192021222324252627282930313233343536373839
  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 MediaSearchPageReq struct {
  11. QueryVars locals.QueryVars
  12. MediaSearchVars locals.MediaSearchVars
  13. PageVars locals.PageVars
  14. }
  15. func MediaSearchPage(c echo.Context) error {
  16. v := c.Get("receiver").(MediaSearchPageReq)
  17. y := c.Get("abango").(abango.Controller)
  18. vRet := &struct {
  19. models_join.MediaSearchPageRet
  20. }{}
  21. vRet.QueryVars = v.QueryVars
  22. vRet.MediaSearchVars = v.MediaSearchVars
  23. vRet.PageVars = v.PageVars
  24. // fmt.Println(vRet)
  25. if err := vRet.GetMediaSearchPage(y.Db); err != nil {
  26. return c.String(607, err.Error())
  27. }
  28. ret, _ := json.Marshal(vRet)
  29. return c.JSONBlob(http.StatusOK, ret)
  30. }