supplysearchhandler.go 689 B

12345678910111213141516171819202122232425262728293031
  1. package handler
  2. import (
  3. "log"
  4. "net/http"
  5. "app.yhyue.com/moapp/jyInfo/api/internal/logic"
  6. "app.yhyue.com/moapp/jyInfo/api/internal/svc"
  7. "app.yhyue.com/moapp/jyInfo/api/internal/types"
  8. "github.com/zeromicro/go-zero/rest/httpx"
  9. )
  10. func supplySearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  11. return func(w http.ResponseWriter, r *http.Request) {
  12. var req types.PubSupplyInfoReq
  13. if err := httpx.Parse(r, &req); err != nil {
  14. httpx.Error(w, err)
  15. return
  16. }
  17. l := logic.NewSupplySearchLogic(r.Context(), svcCtx)
  18. resp, err := l.SupplySearch(&req)
  19. log.Println("resp:", resp)
  20. if err != nil {
  21. httpx.Error(w, err)
  22. } else {
  23. httpx.OkJson(w, resp)
  24. }
  25. }
  26. }