| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- package controller
- import (
- "github.com/gin-gonic/gin"
- "iot_manager_service/app/device/model"
- "iot_manager_service/app/device/service"
- "iot_manager_service/util"
- "net/http"
- "strconv"
- )
- var IntelligentLighting = new(intelligentLightingCtl)
- type intelligentLightingCtl struct{}
- func (c *intelligentLightingCtl) Detail(ctx *gin.Context) {
- publicId, e := strconv.Atoi(ctx.Query("publicId"))
- if e != nil {
- ctx.JSON(http.StatusOK, util.ParamsInvalidResponse(e.Error(), nil))
- return
- }
- if publicId == 0 {
- ctx.JSON(http.StatusOK, util.ParamsInvalidResponse(model.RelationIdInvalid, nil))
- return
- }
- //当前类型1=灯杆2=灯杆分组
- relationType, e := strconv.Atoi(ctx.Query("type"))
- if e != nil {
- ctx.JSON(http.StatusOK, util.ParamsInvalidResponse(e.Error(), nil))
- return
- }
- if relationType == model.RelationTypeLight {
- detail, err := service.IntelligentLightingService.GetDetailByLight(publicId)
- if err != nil {
- ctx.JSON(http.StatusOK, err)
- return
- }
- ctx.JSON(http.StatusOK, util.SuccessResponse(util.Succeeded, detail))
- } else if relationType == model.RelationTypeLampPoleGroup {
- detail, err := service.IntelligentLightingService.GetDetailByGroup(publicId)
- if err != nil {
- ctx.JSON(http.StatusOK, err)
- return
- }
- ctx.JSON(http.StatusOK, util.SuccessResponse(util.Succeeded, detail))
- } else {
- ctx.JSON(http.StatusOK, util.ParamsInvalidResponse(model.RelationTypeInvalid, nil))
- }
- }
- func (c *intelligentLightingCtl) List(ctx *gin.Context) {
- }
- func (c *intelligentLightingCtl) RelationList(ctx *gin.Context) {
- }
- func (c *intelligentLightingCtl) Relation(ctx *gin.Context) {
- }
- func (c *intelligentLightingCtl) Remove(ctx *gin.Context) {
- }
- func (c *intelligentLightingCtl) ChangeHandSwitch(ctx *gin.Context) {
- }
- func (c *intelligentLightingCtl) GetStatus(ctx *gin.Context) {
- }
|