wr.go 858 B

123456789101112131415161718192021222324252627282930313233343536
  1. package wr
  2. import (
  3. "mtp2_if/global/app"
  4. "mtp2_if/global/e"
  5. "mtp2_if/logger"
  6. "mtp2_if/models"
  7. "net/http"
  8. "github.com/gin-gonic/gin"
  9. )
  10. // 仓单服务
  11. // GetWRCategoryInfo 获取现货分类信息
  12. // @Summary 获取现货分类信息
  13. // @Produce json
  14. // @Success 200 {object} models.WRCategoryTree
  15. // @Failure 500 {object} app.Response
  16. // @Router /WR/GetWRCategoryInfo [get]
  17. // @Tags 仓单服务
  18. func GetWRCategoryInfo(c *gin.Context) {
  19. appG := app.Gin{C: c}
  20. categories, err := models.CreateCategoryTree(0)
  21. if err != nil {
  22. // 查询失败
  23. logger.GetLogger().Errorf("GetWRCategoryInfo failed: %s", err.Error())
  24. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  25. return
  26. }
  27. // 查询成功返回
  28. logger.GetLogger().Debugln("GetWRCategoryInfo successed: %v", categories)
  29. appG.Response(http.StatusOK, e.SUCCESS, categories)
  30. }