find_kuaishou_product.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package handler
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "github.com/sirupsen/logrus"
  5. "youngee_b_api/model/http_model"
  6. "youngee_b_api/service"
  7. )
  8. func WrapFindKuaishouProductHandler(ctx *gin.Context) {
  9. handler := newFindKuaishouProductHandler(ctx)
  10. baseRun(handler)
  11. }
  12. func newFindKuaishouProductHandler(ctx *gin.Context) *FindKuaishouProductHandler {
  13. return &FindKuaishouProductHandler{
  14. req: http_model.NewFindKuaishouProductRequest(),
  15. resp: http_model.NewFindKuaishouProductResponse(),
  16. ctx: ctx,
  17. }
  18. }
  19. type FindKuaishouProductHandler struct {
  20. req *http_model.FindKuaishouProductRequest
  21. resp *http_model.CommonResponse
  22. ctx *gin.Context
  23. }
  24. func (h *FindKuaishouProductHandler) getRequest() interface{} {
  25. return h.req
  26. }
  27. func (h *FindKuaishouProductHandler) getContext() *gin.Context {
  28. return h.ctx
  29. }
  30. func (h *FindKuaishouProductHandler) getResponse() interface{} {
  31. return h.resp
  32. }
  33. func (h *FindKuaishouProductHandler) run() {
  34. data := *&http_model.FindKuaishouProductRequest{}
  35. data = *h.req
  36. // print("data: ", data.ItemList)
  37. res, err := service.Product.QueryKuaishouProduct(h.ctx, data)
  38. if err != nil {
  39. logrus.Info("FindKuaishouProduct fail,req:%+v", h.req)
  40. return
  41. }
  42. h.resp.Data = res
  43. }
  44. func (h *FindKuaishouProductHandler) checkParam() error {
  45. return nil
  46. }