item.go 871 B

1234567891011121314151617181920212223242526272829303132333435
  1. package work
  2. import (
  3. "kpt-pasture/http/middleware"
  4. "net/http"
  5. pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  6. "gitee.com/xuyiping_admin/pkg/apierr"
  7. "gitee.com/xuyiping_admin/pkg/ginutil"
  8. "github.com/gin-gonic/gin"
  9. )
  10. func EstrusItem(c *gin.Context) {
  11. c.JSON(http.StatusOK, gin.H{"result": "ok"})
  12. return
  13. var req pasturePb.EstrusItemsRequest
  14. if err := ginutil.BindProto(c, &req); err != nil {
  15. apierr.AbortBadRequest(c, http.StatusBadRequest, err)
  16. return
  17. }
  18. pagination := &pasturePb.PaginationModel{
  19. Page: int32(c.GetInt(middleware.Page)),
  20. PageSize: int32(c.GetInt(middleware.PageSize)),
  21. PageOffset: int32(c.GetInt(middleware.PageOffset)),
  22. }
  23. res, err := middleware.BackendOperation(c).OpsService.EstrusList(c, &req, pagination)
  24. if err != nil {
  25. apierr.ClassifiedAbort(c, err)
  26. return
  27. }
  28. ginutil.JSONResp(c, res)
  29. }