package controller import ( "github.com/gin-gonic/gin" "iot_manager_service/app/record/service" "iot_manager_service/util" "net/http" "strconv" ) var LightRecord = new(lightRecordCtl) type lightRecordCtl struct{} func (c *lightRecordCtl) List(ctx *gin.Context) { searchValue := ctx.Query("searchValue") start := ctx.Query("queryStartTime") end := ctx.Query("queryEndTime") groupId := ctx.Query("groupId") id := -1 if groupId != "" { id, _ = strconv.Atoi(groupId) } records, err := service.LightRecordService.List(searchValue, start, end, id) if err != nil { ctx.JSON(http.StatusOK, err) return } ctx.JSON(http.StatusOK, util.SuccessResponse(util.Succeeded, records)) }