package controller import ( "github.com/gin-gonic/gin" "iot_manager_service/app/middleware" "iot_manager_service/app/operation/service" "iot_manager_service/util/common" "net/http" ) var Environment = new(environmentCtl) type environmentCtl struct{} func (c *environmentCtl) EnvironmentList(ctx *gin.Context) { value, _ := ctx.Get(middleware.Authorization) claims := value.(*middleware.Claims) records, err := service.EnvironmentService.EnvironmentList(claims.TenantId) if err != nil { ctx.JSON(http.StatusOK, err) return } ctx.JSON(http.StatusOK, common.SuccessResponse(common.Succeeded, records)) }