test.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. package handler
  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. operationPb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/operation"
  8. "gitee.com/xuyiping_admin/pkg/ginutil"
  9. "github.com/gin-gonic/gin"
  10. )
  11. func CowNeckRingBound(c *gin.Context) {
  12. pagination := &pasturePb.PaginationModel{
  13. Page: int32(c.GetInt(middleware.Page)),
  14. PageSize: int32(c.GetInt(middleware.PageSize)),
  15. PageOffset: int32(c.GetInt(middleware.PageOffset)),
  16. }
  17. if err := middleware.BackendOperation(c).OpsService.CowNeckRingNumberBound(c, pagination); err != nil {
  18. apierr.ClassifiedAbort(c, err)
  19. return
  20. }
  21. ginutil.JSONResp(c, &operationPb.CommonOK{
  22. Code: http.StatusOK,
  23. Msg: "ok",
  24. Data: &operationPb.Success{Success: true},
  25. })
  26. }
  27. func CowNeckRingBound2(c *gin.Context) {
  28. pagination := &pasturePb.PaginationModel{
  29. Page: int32(c.GetInt(middleware.Page)),
  30. PageSize: int32(c.GetInt(middleware.PageSize)),
  31. PageOffset: int32(c.GetInt(middleware.PageOffset)),
  32. }
  33. if err := middleware.BackendOperation(c).OpsService.CowNeckRingNumberBound2(c, pagination); err != nil {
  34. apierr.ClassifiedAbort(c, err)
  35. return
  36. }
  37. ginutil.JSONResp(c, &operationPb.CommonOK{
  38. Code: http.StatusOK,
  39. Msg: "ok",
  40. Data: &operationPb.Success{Success: true},
  41. })
  42. }
  43. func UpdateCowPen(c *gin.Context) {
  44. pagination := &pasturePb.PaginationModel{
  45. Page: int32(c.GetInt(middleware.Page)),
  46. PageSize: int32(c.GetInt(middleware.PageSize)),
  47. PageOffset: int32(c.GetInt(middleware.PageOffset)),
  48. }
  49. if err := middleware.BackendOperation(c).OpsService.UpdateCowPen(c, pagination); err != nil {
  50. apierr.ClassifiedAbort(c, err)
  51. return
  52. }
  53. ginutil.JSONResp(c, &operationPb.CommonOK{
  54. Code: http.StatusOK,
  55. Msg: "ok",
  56. Data: &operationPb.Success{Success: true},
  57. })
  58. }
  59. func DataWarning(c *gin.Context) {
  60. if err := middleware.BackendOperation(c).OpsService.TestDataWaring(c); err != nil {
  61. apierr.ClassifiedAbort(c, err)
  62. return
  63. }
  64. ginutil.JSONResp(c, &operationPb.CommonOK{
  65. Code: http.StatusOK,
  66. Msg: "ok",
  67. Data: &operationPb.Success{Success: true},
  68. })
  69. }